hylan:mongo客户端连接mongod服务端失败


python@ubuntu:~$ mongo
MongoDB shell version: 3.2.8
connecting to: test
2018-05-10T11:08:41.291+0800 W NETWORK  [thread1] Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
2018-05-10T11:08:41.292+0800 E QUERY    [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:229:14
@(connect):1:6

exception: connect failed

 reason: errno:111 Connection refused 

解决方法:

python@ubuntu:~$ sudo chown root:root /tmp
python@ubuntu:~$ sudo chmod 777 /tmp
python@ubuntu:~$ ls -ld /tmp
drwxrwxrwx 15 root root 4096 5月  10 11:05 /tmp
python@ubuntu:~$ sudo service mongod start
python@ubuntu:~$ mongo
MongoDB shell version: 3.2.8
connecting to: test
Server has startup warnings: 
2018-05-10T11:11:06.720+0800 I CONTROL  [initandlisten] 
2018-05-10T11:11:06.720+0800 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2018-05-10T11:11:06.720+0800 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2018-05-10T11:11:06.720+0800 I CONTROL  [initandlisten] 
2018-05-10T11:11:06.720+0800 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2018-05-10T11:11:06.720+0800 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2018-05-10T11:11:06.720+0800 I CONTROL  [initandlisten] 
> exit
bye

你可能感兴趣的:(mongodb)