linux -mongodb 启动问题(Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed : )

-bash-4.1# ./mongo
MongoDB shell version v3.4.6
connecting to: mongodb://127.0.0.1:27017
2017-09-20T20:02:14.620+0800 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: Connection refused
2017-09-20T20:02:14.620+0800 E QUERY [thread1] Error: couldn’t connect to server 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:237:13
@(connect):1:6

启动时,错误如上

(1) cd /usr/local/mongodb/bin
(2) ./mongod –dbpath =/data/db/
(3)出现内容如下:(后面省略)
-bash-4.1# /usr/local/mongodb/bin/mongod –dbpath=/data/db/
2017-09-20T20:31:49.199+0800 I CONTROL [initandlisten] MongoDB starting : pid=xxx port=xxx dbpath=/data/db/ 64-bit host=xxxx
2017-09-20T20:31:49.199+0800 I CONTROL [initandlisten] db version v3.4.6
2017-09-20T20:31:49.199+0800 I CONTROL [initandlisten] git version:

(4) 上一步路径设置成功,但是不要关闭这个界面,需要重新打开一个新的窗口来启动mongo
(5)-bash-4.1# cd /usr/local/mongodb/
(6)-bash-4.1# ./bin/mongo
(7)出现如下界面表示启动成功:
-bash-4.1# cd /usr/local/mongodb/
-bash-4.1# ./bin/mongo
MongoDB shell version v3.4.6
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.4.6
Server has startup warnings:
2017-09-20T20:14:22.717+0800 I STORAGE [initandlisten]
2017-09-20T20:14:22.717+0800 I STORAGE [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2017-09-20T20:14:22.717+0800 I STORAGE [initandlisten] ** See http://dochub.mongodb.org/core/prodnotes-filesystem
2017-09-20T20:14:23.057+0800 I CONTROL [initandlisten]
2017-09-20T20:14:23.058+0800 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
2017-09-20T20:14:23.058+0800 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
2017-09-20T20:14:23.058+0800 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2017-09-20T20:14:23.058+0800 I CONTROL [initandlisten]
2017-09-20T20:14:23.058+0800 I CONTROL [initandlisten]
2017-09-20T20:14:23.058+0800 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is ‘always’.
2017-09-20T20:14:23.058+0800 I CONTROL [initandlisten] ** We suggest setting it to ‘never’
2017-09-20T20:14:23.058+0800 I CONTROL [initandlisten]
2017-09-20T20:14:23.058+0800 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is ‘always’.
2017-09-20T20:14:23.058+0800 I CONTROL [initandlisten] ** We suggest setting it to ‘never’
2017-09-20T20:14:23.058+0800 I CONTROL [initandlisten]
2017-09-20T20:14:23.058+0800 I CONTROL [initandlisten] ** WARNING: soft rlimits too low. rlimits set to 15219 processes, 65535 files. Number of processes should be at least 32767.5 : 0.5 times number of files.
2017-09-20T20:14:23.058+0800 I CONTROL [initandlisten]

你可能感兴趣的:(mongodb)