FreeBSD上的CouchDB无法以couchdb用户身份启动

时间:2013-08-23 11:31:38

标签: couchdb freebsd

我已经从portage在FreeBSD上安装了CouchDB 1.3.1。它在root用户启动时运行查找。但是,当尝试通过rc-script启动它时,它不会出现。

我为/var/log/couchdb /var/run/couchdb/usr/local/etc/couchdb

设置了正确的(couchdb拥有它)权限 然而,那并不是瑞克。我已登录couchdb用户帐户并尝试启动couchdb。结果我得到了这个:

Apache CouchDB 1.3.1 (LogLevel=info) is starting.
[error] [<0.97.0>] {error_report,<0.30.0>,
                    {<0.97.0>,crash_report,
                     [[{initial_call,{couch_file,init,['Argument__1']}},
                       {pid,<0.97.0>},
                       {registered_name,[]},
                       {error_info,
                        {exit,
                         {{badmatch,{error,eacces}},
                          [{couch_file,init,1,
                            [{file,"couch_file.erl"},{line,314}]},
                           {gen_server,init_it,6,
                            [{file,"gen_server.erl"},{line,304}]},
                           {proc_lib,init_p_do_apply,3,
                            [{file,"proc_lib.erl"},{line,227}]}]},
                         [{gen_server,init_it,6,
                           [{file,"gen_server.erl"},{line,328}]},
                          {proc_lib,init_p_do_apply,3,
                           [{file,"proc_lib.erl"},{line,227}]}]}},
                       {ancestors,[<0.96.0>]},
                       {messages,[]},
                       {links,[#Port<0.2176>,<0.96.0>]},
                       {dictionary,[]},
                       {trap_exit,true},
                       {status,running},
                       {heap_size,610},
                       {stack_size,24},
                       {reductions,478}],
                      [{neighbour,
                        [{pid,<0.96.0>},
                         {registered_name,[]},
                         {initial_call,{erlang,apply,2}},
                         {current_function,{proc_lib,sync_wait,2}},
                         {ancestors,[]},
                         {messages,
                          [{ack,<0.97.0>,
                            {error,
                             {{badmatch,{error,eacces}},
                              [{couch_file,init,1,
                                [{file,"couch_file.erl"},{line,314}]},
                               {gen_server,init_it,6,
                                [{file,"gen_server.erl"},{line,304}]},
                               {proc_lib,init_p_do_apply,3,
                                [{file,"proc_lib.erl"},{line,227}]}]}}}]},
                         {links,[<0.86.0>,<0.97.0>]},
                         {dictionary,[]},
                         {trap_exit,false},
                         {status,runnable},
                         {heap_size,233},
                         {stack_size,20},
                         {reductions,28}]}]]}}
{"init terminating in do_boot",{{badmatch,{error,{bad_return,{{couch_app,start,[normal,["/usr/local/etc/couchdb/default.ini","/usr/local/etc/couchdb/local.ini"]]},{'EXIT',{{badmatch,{error,shutdown}},[{couch_server_sup,start_server,1,[{file,"couch_server_sup.erl"},{line,98}]},{application_master,start_it_old,4,[{file,"application_master.erl"},{line,274}]}]}}}}}},[{couch,start,0,[{file,"couch.erl"},{line,18}]},{init,start_it,1,[]},{init,start_em,1,[]}]}}
init terminating in do_boot ()

我还可以尝试使用非root帐户启动couchdb吗?

1 个答案:

答案 0 :(得分:2)

问题解决了。那里有几个原因让它不起作用。这是简短版本:

安装端口后,请勿以root身份运行couchdb。这样做会破坏权限。

快速修复就是完全删除couchdb并重新安装它。当然,只要数据库中没有任何内容,这只是一个选项。以下脚本将确保完全从系统中清除couchdb:

cd /usr/ports/database/couchdb
make deinstall
make clean
rm -rf /var/{db,lib,log,run}/couchdb /usr/local/etc/couchdb/

之后再次安装couchdb并运行它应该运行

cd /usr/ports/database/couchdb
make install clean
service couchdb start

如果您无法重新安装,请运行以下脚本来修复权限。

chown -R couchdb:couchdb /var/{db,lib,log,run}/couchdb /usr/local/etc/couchdb/
chmod -R ug+rw /var/{db,lib,log,run}/couchdb /usr/local/etc/couchdb/local.ini
chmod -R o-rwx /var/{db,lib,log,run}/couchdb /usr/local/etc/couchdb/

最后一行删除couchdb以外的用户的权限,因为所有数据都是商店。这当然是可选的,但可以提高安全性。

这些解决方案已经使用FreeBSD 9.1和CouchDB 1.3.1进行了测试。

特别感谢this blogpost因为它包含了关于错误的重要线索。

相关问题