Debian

升級 MongoDB 後它沒有啟動並且日誌為空

  • August 17, 2015

你能幫我解決這個問題嗎?我已更新(apt-get upgrade)我的系統 Debian GNU/Linux 7.6(wheezy),但由於磁碟空間操作失敗的問題。在我釋放磁碟空間後,MongoDB 沒有啟動。我已經嘗試了幾個程序。

第一的apt-get --purge remove mongodb-org:

invoke-rc.d: unknown initscript, /etc/init.d/mongod not found.
dpkg: error processing mongodb-org-server (--configure):
subprocess installed post-installation script returned error exit status 100
Errors were encountered while processing:
mongodb-org-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

/etc/init.d/是:

mongod -> /lib/init/upstart-job 

我刪除了它並用來自其他系統的其他 mongoDB 安裝的 mongod 替換它。然後解除安裝是正確的。

在我執行apt-get install -y mongodb-org但失敗後:

invoke-rc.d: unknown initscript, /etc/init.d/mongod not found.
dpkg: error processing mongodb-org-server (--configure):
subprocess installed post-installation script returned error exit status 100
Setting up MongoDB package-org-Mongos (2.6.4) ...
Setting up MongoDB package-org-tools (2.6.4) ...
dpkg: unmet dependencies prevent configuration package MongoDB-org:
 MongoDB-org depends on MongoDB-org-server; but:
  MongoDB package-org-server is not configured yet.

/etc/init.d/是:

mongod -> /lib/init/upstart-job 
mongod.dpkg-bak

我刪除了 mongod 並重命名mongod.dpkg-bakmongod. 然後安裝是正確的。但是 MongoDB 沒有啟動。

Reading package lists ... Done
It creates a dependency tree
Reading state information ... Done
MongoDB-org is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation will be used to drive other 0 B.
Setting up MongoDB package-org-server (2.6.4) ...
[FAIL] Starting database: mongodb failed!
invoke-rc.d: initscript mongod, action "start" failed.
dpkg: error processing MongoDB-org-server (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: unmet dependencies prevent configuration package MongoDB-org:
MongoDB-org depends on MongoDB-org-server; but:
MongoDB package-org-server is not configured yet.

dpkg: error processing MongoDB-org (--configure):
  dependency problem - leave it unconfigured
Errors were encountered while processing:

MongoDB-org-server MongoDB-org E: 子程序/usr/bin/dpkg返回錯誤碼(1)

如果我執行service mongod start

[FAIL] Starting database: mongodb failed!

/var/log/mongod/mongod.log不包含此時的任何條目。非常感謝您的幫助。

dpkg-query -l “MongoDB-org *” 輸出:

+++-=================================-=====================-=====================-=======================================================================
   iU  mongodb-org                       2.6.4                 i386                  MongoDB open source document-oriented database system (metapackage)
   ii  mongodb-org-mongos                2.6.4                 i386                  MongoDB sharded cluster query router
   iF  mongodb-org-server                2.6.4                 i386                  MongoDB database server
   ii  mongodb-org-shell                 2.6.4                 i386                  MongoDB shell client
   ii  mongodb-org-tools                 2.6.4                 i386                  MongoDB tools
   un  mongodb-org-unstable              <none>                                  (no description available)
   un  mongodb-org-unstable-mongos       <none>                                  (no description available)
   un  mongodb-org-unstable-server       <none>                                 (no description available)
   un  mongodb-org-unstable-shell        <none>                                  (no description available)
   un  mongodb-org-unstable-tools        <none>                                  (no description available)

dpkg –configure mongodb-org-server mongodb-org:

Setting up mongodb-org-server (2.6.4) …
[FAIL] Starting database: mongodb failed!
invoke-rc.d: initscript mongod, action "start" failed.
dpkg: error processing mongodb-org-server (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: unmet dependencies prevent configuration package MongoDB-org:
MongoDB-org depends on MongoDB-org-server; but:
MongoDB package-org-server is not configured yet.

dpkg: error processing MongoDB-org (--configure):
dependency problem - leave it unconfigured
Errors were encountered while processing:
MongoDB-org-server
MongoDB-org

dpkg –configure –force-depends mongodb-org-server mongodb-org:

Setting up mongodb-org-server (2.6.4) …
[FAIL] Starting database: mongodb failed!
invoke-rc.d: initscript mongod, action "start" failed.
dpkg: error processing mongodb-org-server (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems, but configuring as per your requirement:
mongodb-org depends on mongodb-org-server; however:
 MongoDB package-org-server is not configured yet.

Setting org-package MongoDB (2.6.4) ...
Errors were encountered while processing:
mongodb-org-server

選項1:

由於您似乎已半配置mongodb-org-server和解壓縮但(未配置)mongodb-org,請嘗試以下命令:

dpkg --configure mongodb-org-server mongodb-org

如果依賴問題也失敗了,試試這個:

dpkg --configure --force-depends mongodb-org-server mongodb-org

選項 2:

由於在您的情況下包配置似乎沒有完成,我建議接下來嘗試清理以前安裝的系統,然後進行全新安裝。但是,以下是非常粗略的方法,我建議您先通讀一遍,並記住我還沒有實際測試過它。

首先,獲取 mongodb-org 包安裝的文件列表:

dpkg-query -L mongodb-org mongodb-org-server mongodb-org-mongos mongodb-org-shell mongodb-org-tools | grep "^\/[^\.]" > mongo.files

然後,通過執行以下操作驗證mongo.files(以確保它僅包含可以刪除的路徑)的內容:

less mongo.files

然後,通過發出以下命令從系統中刪除這些文件:

rm `cat mongo.files`

接下來是時候通過手動修改來告訴包管理器這些包目前沒有安裝在系統中/var/lib/dpkg/status。在對該文件進行任何操作之前,請備份它以防出現問題(請記住,我們正在對包管理器內部數據進行手術……)。該文件被格式化為連續文本行的部分,這些部分由空行分隔。找出文件中以開頭的所有部分Package: mongodb-org並將其刪除(刪除以“Package”開頭的行到空行的所有行)。完成後,保存文件並執行,apt-get update然後執行apt-get install mongodb-org.

我當然希望這不會破壞任何東西,最後你會得到一個執行良好的 MongoDB 副本。

引用自:https://unix.stackexchange.com/questions/157917