企业架构LNMP学习笔记55

news2024/10/6 2:29:34

MongoDB的安装和配置:

1、安装方式介绍:

yum安装方式:

手动通用安装方式:

2、二进制可执行安装:

下载路径:Download MongoDB Community Server | MongoDB

 下载mongodb的源码包进行安装。

1)解压到安装目录并移动:

shell > tar xvf mongodb-linux-x86_64-rhel62-3.6.5.tgz
shell > mv mongodb-linux-x86_64-rhel62-3.6.5 /usr/local/mongodb


[root@server10 soft]# tar -zxvf mongodb-linux-x86_64-rhel62-3.6.5.tgz
mongodb-linux-x86_64-rhel62-3.6.5/README
mongodb-linux-x86_64-rhel62-3.6.5/THIRD-PARTY-NOTICES
mongodb-linux-x86_64-rhel62-3.6.5/MPL-2
mongodb-linux-x86_64-rhel62-3.6.5/GNU-AGPL-3.0
mongodb-linux-x86_64-rhel62-3.6.5/bin/mongodump
mongodb-linux-x86_64-rhel62-3.6.5/bin/mongorestore
mongodb-linux-x86_64-rhel62-3.6.5/bin/mongoexport
mongodb-linux-x86_64-rhel62-3.6.5/bin/mongoimport
mongodb-linux-x86_64-rhel62-3.6.5/bin/mongostat
mongodb-linux-x86_64-rhel62-3.6.5/bin/mongotop
mongodb-linux-x86_64-rhel62-3.6.5/bin/bsondump
mongodb-linux-x86_64-rhel62-3.6.5/bin/mongofiles
mongodb-linux-x86_64-rhel62-3.6.5/bin/mongoreplay
mongodb-linux-x86_64-rhel62-3.6.5/bin/mongoperf
mongodb-linux-x86_64-rhel62-3.6.5/bin/mongod
mongodb-linux-x86_64-rhel62-3.6.5/bin/mongos
mongodb-linux-x86_64-rhel62-3.6.5/bin/mongo
mongodb-linux-x86_64-rhel62-3.6.5/bin/install_compass
[root@server10 soft]# ll
total 98236
drwxr-xr-x 3 root root        91 Sep 16 20:05 mongodb-linux-x86_64-rhel62-3.6.5
-rw-r--r-- 1 root root 100589678 Sep 16 20:04 mongodb-linux-x86_64-rhel62-3.6.5.tgz
[root@server10 soft]#
[root@server10 soft]# mv mongodb-linux-x86_64-rhel62-3.6.5 /usr/local/mongodb

2)创建数据存储目录和日志目录:

shell > cd /usr/local/mongodb
shell > mkdir data
shell > mkdir logs

3)启动mongod服务:

shell > cd /usr/local/mongodb/bin
shell > ./mongod --dbpath=/usr/local/mongodb/data --logpath=/usr/local/mongodb/logs/log.txt --fork

#可以通过进程和端口的方式检测是否启动成功
shell > ps aux|grep mongod
shell > netstat -lntp|grep mongod

 端口是27017,为什么是127.0.0.1是本地,是为了安全。

[root@server10 bin]# ./mongod --help
Options:

General options:
  -h [ --help ]                         show this usage information
  --version                             show version information
  -f [ --config ] arg                   configuration file specifying
                                        additional options
  -v [ --verbose ] [=arg(=v)]           be more verbose (include multiple times
                                        for more verbosity e.g. -vvvvv)
  --quiet                               quieter output
  --port arg                            specify port number - 27017 by default
  --bind_ip arg                         comma separated list of ip addresses to
                                        listen on - localhost by default
  --bind_ip_all                         bind to all ip addresses
  --ipv6                                enable IPv6 support (disabled by
                                        default)
  --listenBacklog arg (=128)            set socket listen backlog size
  --maxConns arg                        max number of simultaneous connections
                                        - 1000000 by default
  --logpath arg                         log file to send write to instead of
                                        stdout - has to be a file, not
                                        directory
  --syslog                              log to system's syslog facility instead
                                        of file or stdout
  --syslogFacility arg                  syslog facility used for mongodb syslog
                                        message
  --logappend                           append to logpath instead of
                                        over-writing
  --logRotate arg                       set the log rotation behavior
                                        (rename|reopen)
  --timeStampFormat arg                 Desired format for timestamps in log
                                        messages. One of ctime, iso8601-utc or
                                        iso8601-local
  --pidfilepath arg                     full path to pidfile (if not set, no
                                        pidfile is created)
  --timeZoneInfo arg                    full path to time zone info directory,
                                        e.g. /usr/share/zoneinfo
  --keyFile arg                         private key for cluster authentication
  --noauth                              run without security
  --setParameter arg                    Set a configurable parameter
  --transitionToAuth                    For rolling access control upgrade.
                                        Attempt to authenticate over outgoing
                                        connections and proceed regardless of
                                        success. Accept incoming connections
                                        with or without authentication.
  --clusterAuthMode arg                 Authentication mode used for cluster
                                        authentication. Alternatives are
                                        (keyFile|sendKeyFile|sendX509|x509)
  --nounixsocket                        disable listening on unix sockets
  --unixSocketPrefix arg                alternative directory for UNIX domain
                                        sockets (defaults to /tmp)
  --filePermissions arg                 permissions to set on UNIX domain
                                        socket file - 0700 by default
  --fork                                fork server process
  --networkMessageCompressors [=arg(=disabled)] (=snappy)
                                        Comma-separated list of compressors to
                                        use for network messages
  --auth                                run with security
  --clusterIpSourceWhitelist arg        Network CIDR specification of permitted
                                        origin for `__system` access.
  --slowms arg (=100)                   value of slow for profile and console
                                        log
  --slowOpSampleRate arg (=1)           fraction of slow ops to include in the
                                        profile and console log
  --profile arg                         0=off 1=slow, 2=all
  --cpu                                 periodically show cpu and iowait
                                        utilization
  --sysinfo                             print some diagnostic system
                                        information
  --noIndexBuildRetry                   don't retry any index builds that were
                                        interrupted by shutdown
  --noscripting                         disable scripting engine
  --notablescan                         do not allow table scans
  --shutdown                            kill a running server (for init
                                        scripts)

Replication options:
  --oplogSize arg                       size to use (in MB) for replication op
                                        log. default is 5% of disk space (i.e.
                                        large is good)

Master/slave options (old; use replica sets instead):
  --master                              master mode
  --slave                               slave mode
  --source arg                          when slave: specify master as
                                        <server:port>
  --only arg                            when slave: specify a single database
                                        to replicate
  --slavedelay arg                      specify delay (in seconds) to be used
                                        when applying master ops to slave
  --autoresync                          automatically resync if slave data is
                                        stale

Replica set options:
  --replSet arg                         arg is <setname>[/<optionalseedhostlist
                                        >]
  --replIndexPrefetch arg               specify index prefetching behavior (if
                                        secondary) [none|_id_only|all]
  --enableMajorityReadConcern [=arg(=1)] (=1)
                                        enables majority readConcern

Sharding options:
  --configsvr                           declare this is a config db of a
                                        cluster; default port 27019; default
                                        dir /data/configdb
  --shardsvr                            declare this is a shard db of a
                                        cluster; default port 27018

SSL options:
  --sslOnNormalPorts                    use ssl on configured ports
  --sslMode arg                         set the SSL operation mode
                                        (disabled|allowSSL|preferSSL|requireSSL
                                        )
  --sslPEMKeyFile arg                   PEM file for ssl
  --sslPEMKeyPassword arg               PEM file password
  --sslClusterFile arg                  Key file for internal SSL
                                        authentication
  --sslClusterPassword arg              Internal authentication key file
                                        password
  --sslCAFile arg                       Certificate Authority file for SSL
  --sslCRLFile arg                      Certificate Revocation List file for
                                        SSL
  --sslDisabledProtocols arg            Comma separated list of TLS protocols
                                        to disable [TLS1_0,TLS1_1,TLS1_2]
  --sslWeakCertificateValidation        allow client to connect without
                                        presenting a certificate
  --sslAllowConnectionsWithoutCertificates
                                        allow client to connect without
                                        presenting a certificate
  --sslAllowInvalidHostnames            Allow server certificates to provide
                                        non-matching hostnames
  --sslAllowInvalidCertificates         allow connections to servers with
                                        invalid certificates
  --sslFIPSMode                         activate FIPS 140-2 mode at startup

Storage options:
  --storageEngine arg                   what storage engine to use - defaults
                                        to wiredTiger if no data files present
  --dbpath arg                          directory for datafiles - defaults to
                                        /data/db
  --directoryperdb                      each database will be stored in a
                                        separate directory
  --noprealloc                          disable data file preallocation - will
                                        often hurt performance
  --nssize arg (=16)                    .ns file size (in MB) for new databases
  --quota                               limits each database to a certain
                                        number of files (8 default)
  --quotaFiles arg                      number of files allowed per db, implies
                                        --quota
  --smallfiles                          use a smaller default file size
  --syncdelay arg (=60)                 seconds between disk syncs (0=never,
                                        but not recommended)
  --upgrade                             upgrade db if needed
  --repair                              run repair on all dbs
  --repairpath arg                      root directory for repair files -
                                        defaults to dbpath
  --journal                             enable journaling
  --nojournal                           disable journaling (journaling is on by
                                        default for 64 bit)
  --journalOptions arg                  journal diagnostic options
  --journalCommitInterval arg           how often to group/batch commit (ms)

WiredTiger options:
  --wiredTigerCacheSizeGB arg           maximum amount of memory to allocate
                                        for cache; defaults to 1/2 of physical
                                        RAM
  --wiredTigerJournalCompressor arg (=snappy)
                                        use a compressor for log records
                                        [none|snappy|zlib]
  --wiredTigerDirectoryForIndexes       Put indexes and data in different
                                        directories
  --wiredTigerCollectionBlockCompressor arg (=snappy)
                                        block compression algorithm for
                                        collection data [none|snappy|zlib]
  --wiredTigerIndexPrefixCompression arg (=1)
                                        use prefix compression on row-store
                                        leaf pages

 学会使用./mongod --help 查看选项。

参数介绍:

dbpath 数据存储路径

logpath 日志存储路径  指向到一个文件

fork  后台启动

auth  权限开启

bind_ip  指定绑定网卡ip

fork是后台启动。这个要记住的。

目录不在不会创建,文件不在是需要创建的。

配置下环境变量:

vim /etc/profile

然后再source /etc/profile操作下。

命令行客户端操作:

./mongo

[root@server10 bin]# ./mongo
MongoDB shell version v3.6.5
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.6.5
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
        http://docs.mongodb.org/
Questions? Try the support group
        http://groups.google.com/group/mongodb-user
Server has startup warnings:
2023-09-16T20:07:07.975+0800 I CONTROL  [initandlisten]
2023-09-16T20:07:07.975+0800 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2023-09-16T20:07:07.975+0800 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2023-09-16T20:07:07.975+0800 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2023-09-16T20:07:07.975+0800 I CONTROL  [initandlisten]
2023-09-16T20:07:07.975+0800 I CONTROL  [initandlisten] ** WARNING: This server is bound to localhost.
2023-09-16T20:07:07.975+0800 I CONTROL  [initandlisten] **          Remote systems will be unable to connect to this server.
2023-09-16T20:07:07.975+0800 I CONTROL  [initandlisten] **          Start the server with --bind_ip <address> to specify which IP
2023-09-16T20:07:07.975+0800 I CONTROL  [initandlisten] **          addresses it should serve responses from, or with --bind_ip_all to
2023-09-16T20:07:07.975+0800 I CONTROL  [initandlisten] **          bind to all interfaces. If this behavior is desired, start the
2023-09-16T20:07:07.975+0800 I CONTROL  [initandlisten] **          server with --bind_ip 127.0.0.1 to disable this warning.
2023-09-16T20:07:07.975+0800 I CONTROL  [initandlisten]
2023-09-16T20:07:07.975+0800 I CONTROL  [initandlisten]
2023-09-16T20:07:07.975+0800 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2023-09-16T20:07:07.975+0800 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2023-09-16T20:07:07.975+0800 I CONTROL  [initandlisten]
2023-09-16T20:07:07.975+0800 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2023-09-16T20:07:07.975+0800 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2023-09-16T20:07:07.975+0800 I CONTROL  [initandlisten]
>

输入help检查相关信息。 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1015615.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

220kV 及以下避雷器直流泄露电流试验

试验步骤: 1) 记录试验现场的环境温度、 湿度。 2) 对被试设备充分放电后可靠接地。 3) 试验前正确设置安全围栏和悬挂标示牌。 4) 做上节避雷器直流试验时, 根据图进行试验接线, 微安表的一端夹子接在上节避雷器的下端, 另一端安装在高压直流发生器的电压输出端, 上节避雷…

cgroup限制内存

首先简单介绍下cgroup限制cpu的使用率&#xff0c;写一段代码如下&#xff1a; #include <stdio.h> #include <pthread.h>int main() { int i 0; for(;;)i; return 0; }很明显&#xff0c;这里面是单核拉满&#xff0c;然后top看下进程的cpu使用率&#xff0c;如…

【深度学习】Pytorch 系列教程(十四):PyTorch数据结构:6、模块(Module):前向传播

目录 一、前言 二、实验环境 三、PyTorch数据结构 0、分类 1、张量&#xff08;Tensor&#xff09; 2、张量操作&#xff08;Tensor Operations&#xff09; 3、变量&#xff08;Variable&#xff09; 4、数据集&#xff08;Dataset&#xff09; 5、数据加载器&#x…

科学计算器网站Desmos网站

科学计算器网站Desmos网站 有时在学习工作或者生活中&#xff0c;需要用到计算问题&#xff0c;但由于电脑上没有安装相应的专业软件&#xff0c;难以计算有的问题&#xff0c;因而&#xff0c;本文推荐一种免费的在线计算网站Desmos。 一、Desmos网址 Desmos官网的地址为&a…

[管理与领导-96]:IT基层管理者 - 扩展技能 - 5 - 职场丛林法则 -10- 七分做,三分讲,完整汇报工作的艺术

目录 前言&#xff1a; 一、汇报工作的重要性 1.1 汇报的重要性&#xff1a;汇报工作是工作重要的一环 1.2 向上司汇报工作状态具有重要的意义 1.2 汇报工作存在一些误解 1.3 汇报工作中的下错误做法 1.4 汇报工作与做实际工作的关系 二、工作汇报的内容与艺术 2.1 工…

【深度学习】- NLP系列文章之 1.文本表示以及mlp来处理分类问题

系列文章目录 1. 文本分类与词嵌入表示&#xff0c;mlp来处理分类问题 2. RNN、LSTM、GRU三种方式处理文本分类问题 3. 评论情绪分类 还是得开个坑&#xff0c;最近搞论文&#xff0c;使用lstm做的ssd的cache prefetching&#xff0c;意味着我不能再划水了。 文章目录 系列文章…

js创建动态key的对象ES6和ES5的方法

前提&#xff1a; 有个场景&#xff0c;循环数组&#xff0c;根据每一项的值&#xff0c;往一个数组中push一个新对象&#xff0c;对象的key不同要从数组中获取 情况解析&#xff1a;push没有什么问题&#xff0c;问题就是创建一个动态key的对象。下面就说一下如何以参数为key…

【pwn入门】基础知识

声明 本文是B站你想有多PWN和星盟安全学习的笔记&#xff0c;包含一些视频外的扩展知识。 工具和命令 常见的工具 pwntools安装checksec安装pwndbg的安装和gdb使用ubuntu没有使用全部磁盘空间 sudo lvextend -l 100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv sudo resize2f…

Vue中一键批量注册全局组件

文件目录如下 1. component文件夹中编写所有的公共组件 注意&#xff1a;之后一键注册的全局组件名就是每个公共组件&#xff08;xxx.vue&#xff09;文件的文件名 xxx 2. plugins/components.js中批量注册组件 import Vue from "vue"let requireFile require.con…

关于阿里云服务器Ubuntu编译jdk8中遇到的坑及解决方案

关于阿里云服务器Ubuntu系统安装jdk8中遇到的坑及解决方案 记录一下困扰了很多天、到处查资料最后终于成功安装的过程 关于阿里云服务器无法登录的问题 基本反馈是这样的&#xff1a; 如果你添加了ip之后仍然登不进去&#xff0c;有一种方法是直接从第三个选项进去登录之后修…

十天学完基础数据结构-第一天(绪论)

1. 数据结构的研究内容 数据结构的研究主要包括以下核心内容和目标&#xff1a; 存储和组织数据&#xff1a;数据结构研究如何高效地存储和组织数据&#xff0c;以便于访问和操作。这包括了在内存或磁盘上的数据存储方式&#xff0c;如何将数据元素组织成有序或无序的集合&…

浅谈C++|多态篇

1.多态的基本概念 多态是C面向对象三大特性之一多态分为两类 1. 静态多态:函数重载和运算符重载属于静态多态&#xff0c;复用函数名 2.动态多态:派生类和虚函数实现运行时多态 静态多态和动态多态区别: 静态多态的函数地址早绑定–编译阶段确定函数地址 动态多态的函数地址晚绑…

浅谈C++|类的继承篇

引子&#xff1a; 继承是面向对象三大特性之一、有些类与类之间存在特殊的关系&#xff0c;例如下图中: 我们发现&#xff0c;定义这些类时&#xff0c;下级别的成员除了拥有上一级的共性&#xff0c;还有自己的特性。 这个时候我们就可以考虑利用继承的技术&#xff0c;减少…

Learn Prompt-人工智能基础

什么是人工智能&#xff1f;很多人能举出很多例子说这就是人工智能&#xff0c;但是让我们给它定义一个概念大家又觉得很难描述的清楚。实际上&#xff0c;人工智能并不是计算机科学领域专属的概念&#xff0c;在其他学科包括神经科学、心理学、哲学等也有人工智能的概念以及相…

机器学习第六课--朴素贝叶斯

朴素贝叶斯广泛地应用在文本分类任务中&#xff0c;其中最为经典的场景为垃圾文本分类(如垃圾邮件分类:给定一个邮件&#xff0c;把它自动分类为垃圾或者正常邮件)。这个任务本身是属于文本分析任务&#xff0c;因为对应的数据均为文本类型&#xff0c;所以对于此类任务我们首先…

Jprofiler的使用查看oom

一、安装 idea安装插件 安装客户端 链接 IDEA配置Jprofiler执行文件 二、产生oom import java.util.ArrayList; import java.util.List;//测试代码 public class TestHeap {public static void main(String[] args) {int num 0;List<Heap> list new ArrayList&l…

【深度学习实验】线性模型(一):使用NumPy实现简单线性模型:搭建、构造损失函数、计算损失值

目录 一、实验介绍 二、实验环境 三、实验内容 0. 导入库 1. linear_model函数 2. loss_function函数 3. 定义数据 4. 调用函数 一、实验介绍 使用Numpy实现 线性模型搭建构造损失函数进行模型前向传播并计算损失值 二、实验环境 conda create -n DL python3.7 cond…

Learn Prompt-什么是ChatGPT?

ChatGPT&#xff08;生成式预训练变换器&#xff09;是由 OpenAI 在2022年11月推出的聊天机器人。它建立在 OpenAI 的 GPT-3.5 大型语言模型之上&#xff0c;并采用了监督学习和强化学习技术进行了微调。 ChatGPT 是一种聊天机器人&#xff0c;允许用户与基于计算机的代理进行对…

LVS+Haproxy

LVSHaproxy 一、Haproxy简介1.1、Haproxy应用分析1.2、Haproxy的特性1.3、常见负载均衡策略1.4、LVS、Haproxy、Nginx区别1.5、 Haproxy的优点1.6、常见的Web集群调度器 二、Haproxy部署实例四、日志定义优化 一、Haproxy简介 Haproxy 是一个使用C语言编写的自由及开放源代码软…

ES6中新增加的Proxy对象及其使用方式

聚沙成塔每天进步一点点 ⭐ 专栏简介⭐ Proxy对象的基本概念Proxy对象的主要陷阱&#xff08;Traps&#xff09; ⭐ 使用Proxy对象⭐ 写在最后 ⭐ 专栏简介 前端入门之旅&#xff1a;探索Web开发的奇妙世界 记得点击上方或者右侧链接订阅本专栏哦 几何带你启航前端之旅 欢迎来…