Couchdb not starting. -- Failure to start Mochiweb: eaddrinuse
Asked Answered
J

5

9

I have configure and installed couchdb 1.6.1 on ubuntu 10.04. While configuring and installing it said successfully done. But when I start couchdb it gives me error.

When start first..

Apache CouchDB 1.6.1 (LogLevel=info) is starting.

Apache CouchDB has started. Time to relax.

**[info] [<0.32.0>] Apache CouchDB has started on http://127.0.0.1:5984/**

When starting again

 Apache CouchDB 1.6.1 (LogLevel=info) is starting.

 **Failure to start Mochiweb: eaddrinuse**

[error] [<0.127.0>] {error_report,<0.31.0>,
                    {<0.127.0>,crash_report,[[{initial_call,
                           {mochiweb_socket_server,init,['Argument__1']}},
                       {pid,<0.127.0>},
                       {registered_name,[]},
                       {error_info,
                           {exit,eaddrinuse,
                               [{gen_server,init_it,6},
                                {proc_lib,init_p_do_apply,3}]}},
                       {ancestors,
                           [couch_secondary_services,couch_server_sup,
                            <0.32.0>]},
                       {messages,[]},
                       {links,[<0.95.0>]},
                       {dictionary,[]},
                       {trap_exit,true},
                       {status,running},
                       {heap_size,987},
                       {stack_size,24},
                       {reductions,467}],
                      []]}}
{"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},{application_master,start_it_old,4}]}}}}}},[{couch,start,0},{init,start_it,1},{init,start_em,1}]}}

Crash dump was written to: erl_crash.dump
init terminating in do_boot ()

in local.ini I changed Port to 5983 and also ip to 0.0.0.0 from 127.0.0.1 Nothing helped

When i run sudo netstat -tulpn

I get following output

tcp 0 0 127.0.0.1:5984 0.0.0.0:* LISTEN 21688/beam.smp

couchdb -s says Apache CouchDB is not running.

Thanks in advance

Jaejaeger answered 14/5, 2015 at 9:28 Comment(6)
does curl http://localhost:5984/ give you any response?Plumbing
Hello Akshat thanks for reply, It doesn't give me any response... i guess waiting to connect couchdb -s says Apache CouchDB is not running.Jaejaeger
You can manually kill couchdb with a utility like htop. Just install it.Type htop on terminal. Press F4 to search for couchdb and F9+enter to kill it. See if it helps.Plumbing
couchdb -d will shut down CouchDB background processes.Ratio
@Ratio Thanks for reply.. couchdb -d says Apache CouchDB is not running.Jaejaeger
Try to avoid 0.0.0.0 as host, or you are sure you want to have a public accessable CouchDB. Try to kill all the processes listening on Port 5984 and make sure they are gone. If that does not help, wait a little bit - that has helped my sometimes, when a port has not been freed by a program correctly.Mala
M
3

If you came here because you recently upgrade you CouchDB 2.0, make sure you updated your local.ini config file. The section for the web server configuration has changed (the name changed from something like httpd to chttpd). Because of that the port directive wasn't being picked up and it was defaulting to 80 which was the same as the web server.

Maisey answered 28/10, 2016 at 3:25 Comment(2)
I've found that if you had both chttpd and httpd set, you'd get this error. Commenting out the httpd section worked for me.Maxiemaxilla
Thank you! upgrading from v1.x to 2.x, this was definitely the problem.Allegra
C
3

Based on the error message entries provided, CouchDB is already up & running on your machine/ server with port 5984

**Failure to start Mochiweb: eaddrinuse**

That's why When you run sudo netstat -tulpn command on Linux based machine, you are getting the following output :

tcp 0 0 127.0.0.1:5984 0.0.0.0:* LISTEN 21688/beam.smp

Solutions :

couchdb is not a service script in the way you're trying to use it. It is just trying to start up again and failing because one is already running (erlang beam.smp process is still running).

Check & kill all CouchDB processes using following commands :

/bin/ps aux | grep couchdb | grep -v grep | awk '{print $2}' | xargs killl

Start CouchDB again using following command using root linux user :

service couchdb start

Note :

  • When you enter couchdb -s command, You are getting the message like Apache CouchDB is not running.

  • When you enter couchdb -d command, You are getting the message like Apache CouchDB is not running.

Reason for above outputs, You are executing above mentioned commands as non privileged linux users accounts.

Try to execute above mentioned commands as root Or couchDB running linux users accounts.

Colvert answered 19/4, 2017 at 9:14 Comment(0)
M
0

Even i faced same problem. I just did..

sudo apt-get update

sudo apt-get install couchdb

Note:i just re-installed couchdb now it's working fine. before re-install i did below configuration.

Install ICU and use locate to find the icu-config command:

locate icu-config


sudo apt-get install libicu-dev

for more details refer below link

https://wiki.apache.org/couchdb/Error_messages

Mcclurg answered 4/6, 2015 at 11:18 Comment(0)
G
0

I face the same problem...

Luckily there's a fix in the Couchdb Error messages documentation. https://wiki.apache.org/couchdb/Error_messages

Problem

$ couchdb
Apache CouchDB 0.9.0a747640 (LogLevel=info) is starting. Failure to start Mochiweb: eaddrinuse {"init terminating in do_boot",{{badmatch,{error,shutdown}},[{couch_server_sup,start_server,1},{erl_eval,do_apply,5},{erl_eval,exprs,5},{init,start_it,1},{init,start_em,1}]}}

Solution

Edit your /etc/couchdb/couch.ini file and change the Port setting to an available port.

But mine didn't have couch.ini but had default.ini. I changed that to another port that i guessed should be free and it worked

Greylag answered 10/5, 2016 at 19:19 Comment(0)
G
0

I have encountered this error in starting couchdb on ubuntu 16.04

The reason being erlang running on the port 5984, you would be something like below when running the command "netstat -tulpn"

0 0 127.0.0.1:5984 0.0.0.0:* LISTEN 13967/beam.smp

open the file /etc/couchdb/default.ini in super user mode and change the httpd port to some other port which is available and you would be able to start couchdb without any fail.

Goalkeeper answered 7/6, 2017 at 17:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.