MongoDB数据库启动停止

  • 正常停库:(登录——切换admin——停库——exit——查进程)
[root@localhost bin]# mongo
MongoDB shell version v3.4.9
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.4.9
Server has startup warnings:
2019-12-19T08:52:54.033+0800 I STORAGE  [initandlisten]
2019-12-19T08:52:54.033+0800 I STORAGE  [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2019-12-19T08:52:54.033+0800 I STORAGE  [initandlisten] **          See http://dochub.mongodb.org/core/prodnotes-filesystem
2019-12-19T08:52:55.132+0800 I CONTROL  [initandlisten]
2019-12-19T08:52:55.132+0800 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2019-12-19T08:52:55.132+0800 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2019-12-19T08:52:55.132+0800 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2019-12-19T08:52:55.132+0800 I CONTROL  [initandlisten]
2019-12-19T08:52:55.132+0800 I CONTROL  [initandlisten]
2019-12-19T08:52:55.132+0800 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2019-12-19T08:52:55.132+0800 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2019-12-19T08:52:55.132+0800 I CONTROL  [initandlisten]
2019-12-19T08:52:55.132+0800 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2019-12-19T08:52:55.132+0800 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2019-12-19T08:52:55.132+0800 I CONTROL  [initandlisten]
> use adminuse admin
switched to db admin
> db.shutdownServer();db.shutdownServer();
server should be down...
2019-12-19T08:54:16.182+0800 I NETWORK  [thread1] trying reconnect to 127.0.0.1:27017 (127.0.0.1) failed
2019-12-19T08:54:16.182+0800 W NETWORK  [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: Connection refused
2019-12-19T08:54:16.182+0800 I NETWORK  [thread1] reconnect 127.0.0.1:27017 (127.0.0.1) failed failed
> exitexit
bye
[root@localhost bin]# ps aux | grep mongo
root     23417  0.0  0.0 103256   864 pts/2    S+   08:54   0:00 grep mongo
[root@localhost bin]# 

stopmongodb


  • 正常起库:(进bin目录——启动——查进程)
[root@localhost bin]# pwd
/opt/soap/mongodb-linux-x86_64-rhel62-3.4.9/bin
[root@localhost bin]# ./mongod -f mongodb.conf &
[1] 23525
[root@localhost bin]# about to fork child process, waiting until server is ready for connections.
forked process: 23527
child process started successfully, parent exiting

 
[1]+  Done                    ./mongod -f mongodb.conf
[root@localhost bin]# ps aux | grep mongo
root     23527  7.1  0.0 1022744 51024 ?       Sl   09:01   0:01 ./mongod -f mongodb.conf
root     23556  0.0  0.0 103256   868 pts/2    S+   09:01   0:00 grep mongo
[root@localhost bin]#
 

startmongodb

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值