我在Azure VPS上運行Ubuntu 15。我安裝了MongoDB並啓動並運行正常。於是,我停止了mongod
服務,我改變了數據庫路徑和日誌路徑mongod.conf
指向我一個附加的磁盤上創建的目錄:Mongo無法連接
# Where and how to store data.
storage:
dbPath: /datadrive/lib/mongodb
journal:
enabled: true
# engine:
# mmapv1:
# wiredTiger:
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /datadrive/log/mongodb/mongod.log
我重新啓動整個VPS進行雙重確認的新變化生效。現在,當我鍵入mongo
我收到以下錯誤:如果我扭轉我的變化,並使用原來的log
和lib
位置
2016-02-05T14:49:41.004+0000 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
2016-02-05T14:49:41.018+0000 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
[email protected]/mongo/shell/mongo.js:224:14
@(connect):1:6
,它的工作原理。我能做些什麼來確保使用新地點?
編輯
保留舊日誌的位置和嘗試上述步驟後,我得到了在日誌中以下內容:
2016-02-05T15:19:47.049+0000 I CONTROL [main] ***** SERVER RESTARTED *****
2016-02-05T15:19:47.146+0000 I CONTROL [initandlisten] MongoDB starting : pid=1158 port=27017 dbpath=/datadrive/lib/mongodb 64-bit host=CLIENTPROJECTS
2016-02-05T15:19:47.146+0000 I CONTROL [initandlisten] db version v3.2.1
2016-02-05T15:19:47.146+0000 I CONTROL [initandlisten] git version: a14d55980c2cdc565d4704a7e3ad37e4e535c1b2
2016-02-05T15:19:47.146+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2d 9 Jul 2015
2016-02-05T15:19:47.146+0000 I CONTROL [initandlisten] allocator: tcmalloc
2016-02-05T15:19:47.146+0000 I CONTROL [initandlisten] modules: none
2016-02-05T15:19:47.146+0000 I CONTROL [initandlisten] build environment:
2016-02-05T15:19:47.146+0000 I CONTROL [initandlisten] distmod: ubuntu1404
2016-02-05T15:19:47.146+0000 I CONTROL [initandlisten] distarch: x86_64
2016-02-05T15:19:47.146+0000 I CONTROL [initandlisten] target_arch: x86_64
2016-02-05T15:19:47.146+0000 I CONTROL [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1", port: 27017 }, storage: { dbPath: "/datadrive/lib/mongodb", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log" } }
2016-02-05T15:19:47.693+0000 I STORAGE [initandlisten] exception in initAndListen: 98 Unable to create/open lock file: /datadrive/lib/mongodb/mongod.lock errno:13 Permission denied Is a mongod instance already running?, terminating
2016-02-05T15:19:47.693+0000 I CONTROL [initandlisten] dbexit: rc: 100
mongodb啓動時的任何日誌?看來運行mongod的帳戶在新目錄中沒有保留。 – Peter
@Peter沒有日誌。它沒有使用新的日誌位置。有任何想法嗎? – Coop
保持舊的日誌位置,看看出了什麼問題 – Peter