virtualMachinecouchdb

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.

CouchDB versions prior to 3.0.0-2

Prior to version 3.0.0-2, you need to perform some additional changes after the firewall rule is in place. To do so, follow these 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":"3.0.0","git_sha":"03a77db6c","uuid":"0321b58fd1fdb720a9720ca9dec383e7","features":["access-ready","partitioned","pluggable-storage-engines","reshard","scheduler"],"vendor":{"name":"The Apache Software Foundation"}}
Last modification December 21, 2022