按照README文档,解压完mongodb压缩文件之后执行./mongod
输入启动命令,出现如下情况:
./mongod
017-05-03T02:44:28.693-0700 I CONTROL [initandlisten] MongoDB starting : pid=2286 port=27017 dbpath=/data/db 64-bit host=ubuntu
2017-05-03T02:44:28.694-0700 I CONTROL [initandlisten] db version v3.4.4
2017-05-03T02:44:28.694-0700 I CONTROL [initandlisten] git version: 888390515874a9debd1b6c5d36559ca86b44babd
2017-05-03T02:44:28.694-0700 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2g-fips 1 Mar 2016
2017-05-03T02:44:28.694-0700 I CONTROL [initandlisten] allocator: tcmalloc
2017-05-03T02:44:28.694-0700 I CONTROL [initandlisten] modules: none
2017-05-03T02:44:28.694-0700 I CONTROL [initandlisten] build environment:
2017-05-03T02:44:28.694-0700 I CONTROL [initandlisten] distmod: ubuntu1604
2017-05-03T02:44:28.694-0700 I CONTROL [initandlisten] distarch: x86_64
2017-05-03T02:44:28.694-0700 I CONTROL [initandlisten] target_arch: x86_64
2017-05-03T02:44:28.694-0700 I CONTROL [initandlisten] options: {}
2017-05-03T02:44:28.694-0700 I STORAGE [initandlisten] exception in initAndListen: 29 Data directory /data/db not found., terminating
2017-05-03T02:44:28.694-0700 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2017-05-03T02:44:28.694-0700 I NETWORK [initandlisten] shutdown: going to flush diaglog...
2017-05-03T02:44:28.694-0700 I CONTROL [initandlisten] now exiting
2017-05-03T02:44:28.694-0700 I CONTROL [initandlisten] shutting down with code:100
出现错误,shutting down with code:100。
通过运行:
sudo ./mongod解决,启动之后可通过
netstat -lanp | grep "27017"
查看是否正常启动
tcp 0 0 0.0.0.0:27017 0.0.0.0:* LISTEN -
unix 2 [ ACC ] STREAM LISTENING 27064 - /
网友评论