标签:ice shell dir base network 连接数 running oda adc
cd /usr/local/src/ wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-4.0.5.tgz tar xf mongodb-linux-x86_64-4.0.5.tgz mv mongodb-linux-x86_64-4.0.5 /usr/local/ ln -s /usr/local/mongodb-linux-x86_64-4.0.5 /usr/local/mongodb
mkdir /data/mongodata -p mkdir /data/logs/mongolog -p
echo ‘export PATH=$PATH:/usr/local/mongodb/bin‘ >>/etc/profile source /etc/profile #测试 [root@iZm5e68ouhl866li7184cnZ src]# mongo -version MongoDB shell version v4.0.5 git version: 3739429dd92b92d1b0ab120911a23d50bf03c412 allocator: tcmalloc modules: none build environment: distarch: x86_64 target_arch: x86_64
mkdir /usr/local/mongodb/conf [root@iZm5e68ouhl866li7184cnZ src]# cat /usr/local/mongodb/conf/mongodb.conf #数据文件存放目录 dbpath = /data/mongodata #日志文件存放目录 logpath = /data/logs/mongolog/mongodb.log #端口 port = 27017 #以守护程序的方式启用,即在后台运行 fork = true #监听ip bind_ip=0.0.0.0 #最大连接数 maxConns=65536 # pid文件 pidfilepath=/var/run/mongod.pid
[root@iZm5e68ouhl866li7184cnZ src]# cat /usr/lib/systemd/system/mongodb.service [Unit] Description=mongodb After=network.target [Service] Type=forking PIDFile=/var/run/mongod.pid ExecStart=/root/mongodb/bin/mongod -f /usr/local/mongodb/bin/mongodb.conf ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s QUIT $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target
systemctl start mongodb.service [root@iZm5e68ouhl866li7184cnZ ~]# systemctl status mongodb.service ● mongodb.service - mongodb Loaded: loaded (/usr/lib/systemd/system/mongodb.service; disabled; vendor preset: disabled) Active: active (running) since Tue 2019-01-22 16:05:40 CST; 5min ago Process: 4541 ExecStart=/usr/local/mongodb/bin/mongod -f /usr/local/mongodb/conf/mongodb.conf (code=exited, status=0/SUCCESS) Main PID: 4543 (mongod) CGroup: /system.slice/mongodb.service └─4543 /usr/local/mongodb/bin/mongod -f /usr/local/mongodb/conf/mongodb.conf Jan 22 16:05:39 iZm5e68ouhl866li7184cnZ systemd[1]: Starting mongodb... Jan 22 16:05:39 iZm5e68ouhl866li7184cnZ mongod[4541]: about to fork child process, waiting until server is ready for connections. Jan 22 16:05:39 iZm5e68ouhl866li7184cnZ mongod[4541]: forked process: 4543 Jan 22 16:05:40 iZm5e68ouhl866li7184cnZ mongod[4541]: child process started successfully, parent exiting Jan 22 16:05:40 iZm5e68ouhl866li7184cnZ systemd[1]: Started mongodb. #查看 [root@iZm5e68ouhl866li7184cnZ ~]# ss -lntp|grep mongod LISTEN 0 128 *:27017 *:* users:(("mongod",pid=4543,fd=11))
[root@iZm5e68ouhl866li7184cnZ ~]# mongo --host 127.0.0.1 MongoDB shell version v4.0.5 connecting to: mongodb://127.0.0.1:27017/?gssapiServiceName=mongodb Implicit session: session { "id" : UUID("06f9f2c7-17d1-456e-9e77-e53bf66b2adc") } MongoDB server version: 4.0.5 Server has startup warnings: 2019-01-22T16:05:39.029+0800 I STORAGE [initandlisten] 2019-01-22T16:05:39.029+0800 I STORAGE [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine 2019-01-22T16:05:39.029+0800 I STORAGE [initandlisten] ** See http://dochub.mongodb.org/core/prodnotes-filesystem 2019-01-22T16:05:40.172+0800 I CONTROL [initandlisten] 2019-01-22T16:05:40.172+0800 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database. 2019-01-22T16:05:40.172+0800 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted. 2019-01-22T16:05:40.172+0800 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended. 2019-01-22T16:05:40.172+0800 I CONTROL [initandlisten] 2019-01-22T16:05:40.172+0800 I CONTROL [initandlisten] 2019-01-22T16:05:40.172+0800 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is ‘always‘. 2019-01-22T16:05:40.172+0800 I CONTROL [initandlisten] ** We suggest setting it to ‘never‘ 2019-01-22T16:05:40.172+0800 I CONTROL [initandlisten] 2019-01-22T16:05:40.172+0800 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is ‘always‘. 2019-01-22T16:05:40.172+0800 I CONTROL [initandlisten] ** We suggest setting it to ‘never‘ 2019-01-22T16:05:40.172+0800 I CONTROL [initandlisten] > show dbs admin 0.000GB config 0.000GB local 0.000GB
标签:ice shell dir base network 连接数 running oda adc
原文地址:https://www.cnblogs.com/zhangb8042/p/10304434.html