问题如下:
[root@localhost bin]# ./mongod -f mongodb.conf &
[1] 2276
[root@localhost bin]# warning: bind_ip of 0.0.0.0 is unnecessary; listens on all ips by default
about to fork child process, waiting until server is ready for connections.
forked process: 2278
ERROR: child process failed, exited with error number 100
[1]+ Exit 100 ./mongod -f mongodb.conf
解决办法:
[root@localhost bin]# ./mongo
MongoDB shell version: 3.0.6
connecting to: test
Server has startup warnings:
2020-11-06T09:23:51.508+0800 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2020-11-06T09:23:51.508+0800 I CONTROL [initandlisten]
2020-11-06T09:23:51.508+0800 I CONTROL [initandlisten]
2020-11-06T09:23:51.508+0800 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2020-11-06T09:23:51.508+0800 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2020-11-06T09:23:51.508+0800 I CONTROL [initandlisten]
2020-11-06T09:23:51.508+0800 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2020-11-06T09:23:51.508+0800 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2020-11-06T09:23:51.508+0800 I CONTROL [initandlisten]
> db.shutdownServer()
shutdown command only works with the admin database; try 'use admin'
> use admin
switched to db admin
> db.shutdownServer()
2020-11-06T09:29:38.738+0800 I NETWORK DBClientCursor::init call() failed
server should be down...
2020-11-06T09:29:38.739+0800 I NETWORK trying reconnect to 127.0.0.1:27017 (127.0.0.1) failed
2020-11-06T09:29:38.739+0800 W NETWORK Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
2020-11-06T09:29:38.739+0800 I NETWORK reconnect 127.0.0.1:27017 (127.0.0.1) failed failed couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed
>
>
bye
重启mongodb
[root@ip-10-2-2-12 bin]# ./mongod -f mongodb.conf &
[1] 2350
[root@ip-10-2-2-12 bin]# warning: bind_ip of 0.0.0.0 is unnecessary; listens on all ips by default
about to fork child process, waiting until server is ready for connections.
forked process: 2352
child process started successfully, parent exiting
[1]+ Done ./mongod -f mongodb.conf