bchcouchdb

Connect to CouchDB from a different machine

For security reasons, the CouchDB port in this solution cannot be accessed over a public IP address. To connect to CouchDB from a different machine, you must open port 5984 for remote access. Refer to the FAQ for more information on this.

IMPORTANT: Making this application’s network ports public is a significant security risk. You are strongly advised to only allow access to those ports from trusted networks. If, for development purposes, you need to access from outside of a trusted network, please do not allow access to those ports via a public IP address. Instead, use a secure channel such as a VPN or an SSH tunnel. Follow these instructions to remotely connect safely and reliably.

Once the firewall rule is in place, perform these additional steps:

  • Stop your CouchDB server and edit the /opt/bitnami/couchdb/etc/local.ini file. Change the bind_address from 127.0.0.1 to 0.0.0.0:

    [chttpd]
    port = 5984
    bind_address = 0.0.0.0
    ...
    
    [httpd]
    bind_address = 0.0.0.0
    ...
    
  • Restart your server for the changes to take effect.

    $ sudo /opt/bitnami/ctlscript.sh restart couchdb
    

You should now be able to connect to the CouchDB server from a different machine using the server’s IP address and receive a welcome message. This is shown in the example command and output below:

$ curl http://SERVER-IP:5984/
{"couchdb":"Welcome","version":"2.1.1","features":["scheduler"],"vendor":{"name":"The Apache Software Foundation"}}
Last modification October 1, 2018