Ubuntu

Couchdb 服務在啟動後關閉一秒鐘

  • February 27, 2020

我在執行 couchdb 服務時遇到問題。當我啟動它時,它只存在一秒鐘左右就會自行關閉。這是一個範例 - 首先是一個狀態命令,顯示它處於非活動狀態。啟動時它聲稱正在執行,下一個狀態命令表示它處於活動狀態,一秒鐘後發出一個新狀態表示它失敗了。這是怎麼回事?

username@myPC:~$ /etc/init.d/couchdb status
? couchdb.service - System-wide CouchDB instance
  Loaded: loaded (/lib/systemd/system/couchdb.service; enabled; vendor preset: enabled)
  Active: failed (Result: start-limit) since to. 2016-01-28 22:56:32 CET; 9min ago
 Process: 2906 ExecStart=/usr/bin/couchdb (code=exited, status=1/FAILURE)
Main PID: 2906 (code=exited, status=1/FAILURE)

jan. 28 22:56:32 myPC systemd[1]: couchdb.service: Main process exited, code=exited, status=1/FAILURE
jan. 28 22:56:32 myPC systemd[1]: couchdb.service: Unit entered failed state.
jan. 28 22:56:32 myPC systemd[1]: couchdb.service: Failed with result 'exit-code'.
jan. 28 22:56:32 myPC systemd[1]: couchdb.service: Service hold-off time over, scheduling restart.
jan. 28 22:56:32 myPC systemd[1]: Stopped System-wide CouchDB instance.
jan. 28 22:56:32 myPC systemd[1]: couchdb.service: Start request repeated too quickly.
jan. 28 22:56:32 myPC systemd[1]: Failed to start System-wide CouchDB instance.
jan. 28 22:56:32 myPC systemd[1]: couchdb.service: Unit entered failed state.
jan. 28 22:56:32 myPC systemd[1]: couchdb.service: Failed with result 'start-limit'.

username@myPC:~$ /etc/init.d/couchdb start
[ ok ] Starting couchdb (via systemctl): couchdb.service.

username@myPC:~$ /etc/init.d/couchdb status
? couchdb.service - System-wide CouchDB instance
  Loaded: loaded (/lib/systemd/system/couchdb.service; enabled; vendor preset: enabled)
  Active: active (running) since to. 2016-01-28 23:06:34 CET; 367ms ago
Main PID: 3071 (beam)
  CGroup: /system.slice/couchdb.service
          +-3071 /usr/lib/erlang/erts-7.0/bin/beam -Bd -K true -A 4 -- -root /usr/lib/erlang -progname erl -- -home /var/...

jan. 28 23:06:34 myPC systemd[1]: couchdb.service: Service hold-off time over, scheduling restart.
jan. 28 23:06:34 myPC systemd[1]: Stopped System-wide CouchDB instance.
jan. 28 23:06:34 myPC systemd[1]: Started System-wide CouchDB instance.
jan. 28 23:06:34 myPC couchdb[3071]: {error_logger,{{2016,1,28},{23,6,34}},std_error,"File operation error: eacces....ver."}
jan. 28 23:06:34 myPC couchdb[3071]: {error_logger,{{2016,1,28},{23,6,34}},std_error,"File operation error: eacces....ver."}
jan. 28 23:06:34 myPC couchdb[3071]: =ERROR REPORT==== 29-Jan-2016::00:06:34 ===
jan. 28 23:06:34 myPC couchdb[3071]: File operation error: eacces. Target: /lost+found/ebin. Function: read_file_in...erver.
jan. 28 23:06:34 myPC couchdb[3071]: =ERROR REPORT==== 29-Jan-2016::00:06:34 ===
jan. 28 23:06:34 myPC couchdb[3071]: File operation error: eacces. Target: /root/ebin. Function: read_file_info. Pr...erver.
Hint: Some lines were ellipsized, use -l to show in full.


username@myPC:~$ /etc/init.d/couchdb status
? couchdb.service - System-wide CouchDB instance
  Loaded: loaded (/lib/systemd/system/couchdb.service; enabled; vendor preset: enabled)
  Active: failed (Result: start-limit) since to. 2016-01-28 23:06:35 CET; 1s ago
 Process: 3097 ExecStart=/usr/bin/couchdb (code=exited, status=1/FAILURE)
Main PID: 3097 (code=exited, status=1/FAILURE)

jan. 28 23:06:35 myPC systemd[1]: couchdb.service: Main process exited, code=exited, status=1/FAILURE
jan. 28 23:06:35 myPC systemd[1]: couchdb.service: Unit entered failed state.
jan. 28 23:06:35 myPC systemd[1]: couchdb.service: Failed with result 'exit-code'.
jan. 28 23:06:35 myPC systemd[1]: couchdb.service: Service hold-off time over, scheduling restart.
jan. 28 23:06:35 myPC systemd[1]: Stopped System-wide CouchDB instance.
jan. 28 23:06:35 myPC systemd[1]: couchdb.service: Start request repeated too quickly.
jan. 28 23:06:35 myPC systemd[1]: Failed to start System-wide CouchDB instance.
jan. 28 23:06:35 myPC systemd[1]: couchdb.service: Unit entered failed state.
jan. 28 23:06:35 myPC systemd[1]: couchdb.service: Failed with result 'start-limit'.

我找不到任何日誌文件/stdout/stderr。似乎有些東西正在嘗試重新啟動 couchdb,但基於“couchdb.service: Service hold-off time over, schedule restart.”而失敗。但為什麼?

問題在以下幾行中定義:

jan. 28 23:06:34 myPC couchdb[3071]: =ERROR REPORT==== 29-Jan-2016::00:06:34 ===
jan. 28 23:06:34 myPC couchdb[3071]: File operation error: eacces. Target: /lost+found/ebin. Function: read_file_in...erver.
jan. 28 23:06:34 myPC couchdb[3071]: =ERROR REPORT==== 29-Jan-2016::00:06:34 ===
jan. 28 23:06:34 myPC couchdb[3071]: File operation error: eacces. Target: /root/ebin. Function: read_file_info. Pr...erver.

它嘗試使用已編譯的 CouchDB 光束文件查找 ebin 目錄,但由於權限問題 (eacces) 而失敗。但是,原因不在於權限,而在於路徑:為什麼要在 /root 目錄中查找梁?可能是因為它在檢查所有其他選項時失敗(並且該服務以 root 身份執行,這是不好的)。

唯一可能的答案是您的 $ERL_LIBS 路徑配置錯誤。需要為像這樣的梁命令行參數設置它-env ERL_LIBS $ERL_LIBS:/usr/lib64/couchdb/erlang/lib- 請注意,此處的路徑應根據您的安裝設置。

引用自:https://serverfault.com/questions/752524