mongo -无法连接服务器 127.0.0.1:27017

mongo MongoDB shell version:2.2.1 connecting to: test FriNov916:44:06Error: couldn't connect to server 127.0.0.1:27017 src/mongo/shell/mongo.js:91

exception: connect failed



ubuntu@VM-143-196-ubuntu:~$ mongo MongoDB shell version: 2.4.9 connecting to: test Sat May 26 05:49:12.333 Error: couldn't connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:145 exception: connect failed ubuntu@VM-143-196-ubuntu:~$ mongo timestamp MongoDB shell version: 2.4.9 connecting to: timestamp Sat May 26 05:54:13.587 Error: couldn't connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:145 exception: connect failed ubuntu@VM-143-196-ubuntu:~$ mongod The program 'mongod' is currently not installed. You can install it by typing: sudo apt-get install mongodb-server ubuntu@VM-143-196-ubuntu:~$ sudo apt install mongodb-server Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: mongodb-server 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 3,312 kB of archives. After this operation, 13.7 MB of additional disk space will be used. Get:1 http://mirrors.tencentyun.com/ubuntu/ trusty/universe mongodb-server amd64 1:2.4.9-1ubuntu2 [3,312 kB] Fetched 3,312 kB in 0s (4,544 kB/s) Selecting previously unselected package mongodb-server. (Reading database ... 101995 files and directories currently installed.) Preparing to unpack .../mongodb-server_1%3a2.4.9-1ubuntu2_amd64.deb ... Unpacking mongodb-server (1:2.4.9-1ubuntu2) ... Processing triggers for ureadahead (0.100.0-16) ... Processing triggers for man-db (2.6.7.1-1ubuntu1) ... Setting up mongodb-server (1:2.4.9-1ubuntu2) ... mongodb start/running, process 7520 Processing triggers for ureadahead (0.100.0-16) ... ubuntu@VM-143-196-ubuntu:~$ mongod mongod --help for help and startup options Sat May 26 05:56:41.144 [initandlisten] MongoDB starting : pid=7539 port=27017 dbpath=/data/db/ 64-bit host=VM-143-196-ubuntu Sat May 26 05:56:41.144 [initandlisten] db version v2.4.9 Sat May 26 05:56:41.144 [initandlisten] git version: nogitversion Sat May 26 05:56:41.144 [initandlisten] build info: Linux orlo 3.2.0-58-generic #88-Ubuntu SMP Tue Dec 3 17:37:58 UTC 2013 x86_64 BOOST_LIB_VERSION=1_54 Sat May 26 05:56:41.144 [initandlisten] allocator: tcmalloc Sat May 26 05:56:41.144 [initandlisten] options: {} Sat May 26 05:56:41.313 [initandlisten] exception in initAndListen: 10296 ********************************************************************* ERROR: dbpath (/data/db/) does not exist. Create this directory or give existing directory in --dbpath. See http://dochub.mongodb.org/core/startingandstoppingmongo ********************************************************************* , terminating Sat May 26 05:56:41.313 dbexit: Sat May 26 05:56:41.313 [initandlisten] shutdown: going to close listening sockets... Sat May 26 05:56:41.313 [initandlisten] shutdown: going to flush diaglog... Sat May 26 05:56:41.313 [initandlisten] shutdown: going to close sockets... Sat May 26 05:56:41.314 [initandlisten] shutdown: waiting for fs preallocator... Sat May 26 05:56:41.314 [initandlisten] shutdown: lock for final commit... Sat May 26 05:56:41.314 [initandlisten] shutdown: final commit... Sat May 26 05:56:41.314 [initandlisten] shutdown: closing all files... Sat May 26 05:56:41.314 [initandlisten] closeAllFiles() finished Sat May 26 05:56:41.314 dbexit: really exiting now ubuntu@VM-143-196-ubuntu:~$ mongo MongoDB shell version: 2.4.9 connecting to: test Sat May 26 05:56:52.196 Error: couldn't connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:145 exception: connect failed ubuntu@VM-143-196-ubuntu:~$ mongod mongod --help for help and startup options Sat May 26 05:57:18.196 [initandlisten] MongoDB starting : pid=7577 port=27017 dbpath=/data/db/ 64-bit host=VM-143-196-ubuntu Sat May 26 05:57:18.196 [initandlisten] db version v2.4.9 Sat May 26 05:57:18.196 [initandlisten] git version: nogitversion Sat May 26 05:57:18.196 [initandlisten] build info: Linux orlo 3.2.0-58-generic #88-Ubuntu SMP Tue Dec 3 17:37:58 UTC 2013 x86_64 BOOST_LIB_VERSION=1_54 Sat May 26 05:57:18.196 [initandlisten] allocator: tcmalloc Sat May 26 05:57:18.197 [initandlisten] options: {} Sat May 26 05:57:18.197 [initandlisten] exception in initAndListen: 10296 ********************************************************************* ERROR: dbpath (/data/db/) does not exist. Create this directory or give existing directory in --dbpath. See http://dochub.mongodb.org/core/startingandstoppingmongo ********************************************************************* , terminating Sat May 26 05:57:18.197 dbexit: Sat May 26 05:57:18.197 [initandlisten] shutdown: going to close listening sockets... Sat May 26 05:57:18.197 [initandlisten] shutdown: going to flush diaglog... Sat May 26 05:57:18.197 [initandlisten] shutdown: going to close sockets... Sat May 26 05:57:18.197 [initandlisten] shutdown: waiting for fs preallocator... Sat May 26 05:57:18.197 [initandlisten] shutdown: lock for final commit... Sat May 26 05:57:18.197 [initandlisten] shutdown: final commit... Sat May 26 05:57:18.197 [initandlisten] shutdown: closing all files... Sat May 26 05:57:18.197 [initandlisten] closeAllFiles() finished Sat May 26 05:57:18.197 dbexit: really exiting now ubuntu@VM-143-196-ubuntu:~$ sudo rm /var/lib/mongodb/mongod.lock ubuntu@VM-143-196-ubuntu:~$ mongod -repair Sat May 26 05:57:42.026 [initandlisten] MongoDB starting : pid=7611 port=27017 dbpath=/data/db/ 64-bit host=VM-143-196-ubuntu Sat May 26 05:57:42.026 [initandlisten] db version v2.4.9 Sat May 26 05:57:42.026 [initandlisten] git version: nogitversion Sat May 26 05:57:42.026 [initandlisten] build info: Linux orlo 3.2.0-58-generic #88-Ubuntu SMP Tue Dec 3 17:37:58 UTC 2013 x86_64 BOOST_LIB_VERSION=1_54 Sat May 26 05:57:42.026 [initandlisten] allocator: tcmalloc Sat May 26 05:57:42.026 [initandlisten] options: { repair: true } Sat May 26 05:57:42.026 [initandlisten] exception in initAndListen: 10296 ********************************************************************* ERROR: dbpath (/data/db/) does not exist. Create this directory or give existing directory in --dbpath. See http://dochub.mongodb.org/core/startingandstoppingmongo ********************************************************************* , terminating Sat May 26 05:57:42.026 dbexit: Sat May 26 05:57:42.026 [initandlisten] shutdown: going to close listening sockets... Sat May 26 05:57:42.026 [initandlisten] shutdown: going to flush diaglog... Sat May 26 05:57:42.027 [initandlisten] shutdown: going to close sockets... Sat May 26 05:57:42.027 [initandlisten] shutdown: waiting for fs preallocator... Sat May 26 05:57:42.027 [initandlisten] shutdown: closing all files... Sat May 26 05:57:42.027 [initandlisten] closeAllFiles() finished Sat May 26 05:57:42.027 dbexit: really exiting now ubuntu@VM-143-196-ubuntu:~$ sudo service mongod start mongod start/running, process 7628 ubuntu@VM-143-196-ubuntu:~$


--
凉葱落

凉葱落python开发工程师