Configuring single-node CouchDB instance
Introduction
Configuring CouchDB node
To configure Erlang GenServer, we should to edit file vm.args in<COUCHDB_INSTALL_DIR>/etc/vm.argsIf you are installed from sources, like described in Installing single-node CouchDB from sources in Fedora Linux, then open this file in text editor by command:
sudo nano /opt/couchdb/etc/vm.args
Node name. This name uses for nodes identification inside cluster. You can use text name of node and IP, short hostname or fully qualified domain name after "@", like:
node1@192.168.0.1
doc_db@archive_srv
docs_node@db.domain.com
I will use in my posts node names with IP addresses, so:
# Each node in the system must have a unique name. A name can be short # (specified using -sname) or it can by fully qualified (-name). There can be # no communication between nodes running with the -sname flag and those running # with the -name flag. -name first_node@172.17.0.1I have chose this IP, because have installed Docker, and 172.17.0.0/16 is default network of Docker. 172.17.0.1 it is IP of hosting OS. If you plan to read this series of posts, then install Docker(if not installed) and make the same. It will be used in the future.
Erlang cookie. Purpose of this field is securing connections between Erlang GenServer nodes. On each node in the cluster this field should be the same. Also in single-node configuration we are should change it to secure node from intrusion. For generating value of this field I'm using SHA256 checksum of the random string. So, open new terminal window and enter this command:
< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-2048} | sha256sumyou will see string like this:
3021b47687e682bdd31dac8996537dea14bd0d4e7d90dc618a7f400a3024c048 -copy text before space and minus, and set it in the vm.args file as value of "-setcookie" field:
# All nodes must share the same magic cookie for distributed Erlang to work. # Comment out this line if you synchronized the cookies by other means (using # the ~/.erlang.cookie file, for example). -setcookie 3021b47687e682bdd31dac8996537dea14bd0d4e7d90dc618a7f400a3024c048Restart couchdb service:
sudo systemctl restart couchdb.service
Next open link
http://localhost:5984/_utils/#_config/first_node@172.17.0.1 in your browser,
find section chttpd and change value of parameter bind_address to 0.0.0.0, click OK.
Try to open http://172.17.0.1:5984/_utils/
Comments
Post a Comment