Scenario / Questions
Update: I got it working now. Jim Zajkowski’s answer helped me detect that my /etc/init.d/couchdb reboot calls weren’t actually rebooting the instance. After I manually killed the CouchDB processes and started a new instance, it picked up the required BindAddress change.
I have installed CouchDB via
aptitude install couchdb
From my server, I can connect via
telnet localhost 5984
and execute RESTful commands. When I try to access the server from another machine on our network or from a machine external of our network, I get a The connection was reset error. I’ve set up port forwarding on the router, and the server is otherwise accessible via Apache, Tomcat, SSH, etc.
I’m new to Linux/Ubuntu, so I wasn’t sure if there was a default firewall blocking the connection, so I ran:
iptables -A INPUT -p tcp –dport 5984 -j ACCEPT
but it didn’t help.
Here is the dump from running iptables -L -n -v
Chain INPUT (policy ACCEPT 2121K packets, 1319M bytes) pkts bytes target prot opt in out source destination 70 3864 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:5984 9 1647 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:8080 0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:8080 Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) pkts bytes target prot opt in out source destination Chain OUTPUT (policy ACCEPT 1708K packets, 1136M bytes) pkts bytes target prot opt in out source destination
I assume the bytes showing as transfered for 5984 are due to my localhost connection.
Here is the dump from running netstat -an | grep 5984
tcp 0 0 127.0.0.1:5984 0.0.0.0:* LISTEN
I configured couch.ini to have “BindAddress=0.0.0.0” and rebooted, so it should be listening on all interfaces. When I run “sudo /etc/init.d/couchdb stop” then run netstat, however, I still see the above entry. It looks like CouchDB isn’t actually stopping at all. This may explain my problem, because it means it may mean that CouchDB never actually rebooted and never picked up the BindAddress change.
I manually killed the CouchDB process and started it up again. Now netstat shows:
tcp 0 0 127.0.0.1:5984 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:5984 127.0.0.1:35366 TIME_WAIT
I still can’t connect though, even from another machine on the LAN.
Find below all possible solutions or suggestions for the above questions..
netstat -an | grep 5984 say? Does it say
*:5984? If it’s
127.0.0.1, then couchdb needs to be set to listen to either all interfaces.
You have to change the bind_address in /etc/couchdb/default.ini. Then restart the service and try again.
I noticed that in order for this to work you must manually kill the running erlang process for some reason.
ps ax | grep beam ought to reveal the erlang process, you should get something along lines of
0:00 /usr/lib/erlang/erts somewhere in the output. If you kill this process and then run
/etc/init.d/couchdb restart the new config file will be loaded.
On home PC/Mac run this command:
ssh -L 5984:localhost:5984 YOUR-SERVER-IP-HERE
next open in your browser localhost:5984/_utils …
It works for me
If you change it from the Futon configuration panel, you don’t have to do anything else (rebooting the db etc.):
Before changing the default bind_address:
peter@earth:~/$ netstat -an | grep 5984 tcp 0 0 127.0.0.1:5984 0.0.0.0:* LISTEN
After changing to 0.0.0.0:
peter@earth:~/$ netstat -an | grep 5984 tcp 0 0 0.0.0.1:5984 0.0.0.0:* LISTEN
Note non-gurus: computers which cannot access yours (normally, anything outside your local network) will still not be able to access your computer (CouchDB or anything else).
I encountered this, and my problem ended up being that there was, apparently, couchdb already installed in my installation of Ubuntu. I had been editing the config files under /etc/couchdb, but the one that was running was in fact pulling config from /usr/local/etc/couchdb.
The tip-off was that the configs in /etc/couchdb mentioned couch 0.10, but I had just installed 1.0.1.
iptables -L -n -v will show you your current firewall rules. See if there’s one that’s dropping those packets before it gets to your rule.
Kubernetes Free Online Tutorial, Kubernetes Beginner Tutorial
DevOps Free Online Tutorial, DevOps Beginner Tutorial
Ansible Free Online Tutorial, Ansible Beginner Tutorial
Docker Free Online Tutorial, Docker Beginner Tutorial
Openstack Free Online Tutorial, Openstack Beginner Tutorial
Disclaimer: This has been sourced from a third party syndicated feed through internet. We are not responsibility or liability for its dependability, trustworthiness, reliability and data of the text. We reserves the sole right to alter, delete or remove (without notice) the content in its absolute discretion for any reason whatsoever.