我在运行 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:服务延迟时间已过,正在安排重新启动。”失败了。但为什么呢?
答案1
该问题定义如下:
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 beam 文件的 ebin 目录,但由于权限问题 (eacces) 而失败。然而,原因不在于权限,而在于路径:为什么它在 /root 目录中查找 beams?可能是因为它在检查所有其他选项时失败(并且该服务以 root 身份运行,这很糟糕)。
唯一可能的答案是您的 $ERL_LIBS 路径配置错误。需要为 beam 命令行参数设置它-env ERL_LIBS $ERL_LIBS:/usr/lib64/couchdb/erlang/lib
- 请注意,此处的路径应根据您的安装进行设置。