"连接被拒绝"添加" fork:true"时出错在mongod.conf中

时间:2016-09-27 00:55:23

标签: mongodb ubuntu-16.04

/etc/mongod.conf

storage:
  dbPath: /var/lib/mongodb
  journal:
    enabled: true

systemLog:
  destination: file
  logAppend: true
  path: /var/log/mongodb/mongod.log

net:
  port: 27017
  bindIp: 127.0.0.1

processManagement:
  fork: true

replication:
  replSetName: rs0

当我发表评论时,MongoDB开始正常:

processManagement:
fork: true

否则,它会给我错误:

askar@mongo0:~$ mongo
MongoDB shell version: 3.2.9
connecting to: test
2016-09-27T00:46:19.773+0000 W NETWORK  [thread1] Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
2016-09-27T00:46:19.773+0000 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

日志输出没有给我任何提示:

2016-09-27T00:44:07.077+0000 I CONTROL  [initandlisten] MongoDB starting : pid=3440 port=27017 dbpath=/var/lib/mongodb 64-bit host=mongo0.askar.xyz
2016-09-27T00:44:07.077+0000 I CONTROL  [initandlisten] db version v3.2.9
2016-09-27T00:44:07.077+0000 I CONTROL  [initandlisten] git version: 22ec9e93b40c85fc7cae7d56e7d6a02fd811088c
2016-09-27T00:44:07.077+0000 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2g  1 Mar 2016
2016-09-27T00:44:07.077+0000 I CONTROL  [initandlisten] allocator: tcmalloc
2016-09-27T00:44:07.077+0000 I CONTROL  [initandlisten] modules: none
2016-09-27T00:44:07.077+0000 I CONTROL  [initandlisten] build environment:
2016-09-27T00:44:07.077+0000 I CONTROL  [initandlisten]     distmod: ubuntu1604
2016-09-27T00:44:07.077+0000 I CONTROL  [initandlisten]     distarch: x86_64
2016-09-27T00:44:07.077+0000 I CONTROL  [initandlisten]     target_arch: x86_64
2016-09-27T00:44:07.077+0000 I CONTROL  [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1", port: 27017 }, processManagement: { fork: true }, replication: { replSetName: "rs0" }, storage: { dbPath: "/var/lib/mongodb", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log", quiet: true } }
2016-09-27T00:44:07.103+0000 I -        [initandlisten] Detected data files in /var/lib/mongodb created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2016-09-27T00:44:07.103+0000 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=1G,session_max=20000,eviction=(threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
2016-09-27T00:44:07.264+0000 I CONTROL  [signalProcessingThread] got signal 15 (Terminated), will terminate after current cmd ends
2016-09-27T00:44:07.264+0000 W REPL     [signalProcessingThread] ReplicationCoordinatorImpl::shutdown() called before startReplication() finished.  Shutting down without cleaning up the replication system
2016-09-27T00:44:07.264+0000 I CONTROL  [signalProcessingThread] now exiting
2016-09-27T00:44:07.264+0000 I NETWORK  [signalProcessingThread] shutdown: going to close listening sockets...
2016-09-27T00:44:07.264+0000 I NETWORK  [signalProcessingThread] removing socket file: /tmp/mongodb-27017.sock
2016-09-27T00:44:07.264+0000 I NETWORK  [signalProcessingThread] shutdown: going to flush diaglog...
2016-09-27T00:44:07.264+0000 I NETWORK  [signalProcessingThread] shutdown: going to close sockets...
2016-09-27T00:44:07.264+0000 I STORAGE  [signalProcessingThread] WiredTigerKVEngine shutting down
2016-09-27T00:44:07.367+0000 I STORAGE  [signalProcessingThread] shutdown: removing fs lock...
2016-09-27T00:44:07.367+0000 I CONTROL  [signalProcessingThread] dbexit:  rc: 0

我搜索了SO,发现了类似的错误,但似乎他们不是我的情况。

我在Ubuntu 16.04.1上使用MongoDB的3.2.9版本

0 个答案:

没有答案