The second issue is a bit trickier and requires configuring Couchbase to use a DNS entry instead of an IP address. By default, Couchbase Servers use their IP address as a unique identifier. If the IP changes, an individual node will not be able to identify its own configuration and other nodes that it was clustered to will not be able to access it. In order for a node to identify itself via a DNS name rather than and IP address, the following instructions must be followed. Note that this configuration is automatically handled by the RightScale server template.
A few points to keep in mind when setting this up:
Make sure that this hostname always resolves to the IP address of the node that it is on. This can be accomplished by using a dynamic DNS service such as DNSMadeEasy which will allow you to automatically update the hostname when an underlying IP address changes.
It is best to make sure that the IP address registered with the hostname is the internal address for the node (rather than the external one provided by Amazon) so that other nodes and application machines can contact it
The below steps will completely wipe any data and configuration from the node, so it is best to start with a fresh Couchbase install. If you already have a running cluster, you can easily rebalance a node out of the cluster, make the change and then rebalance it back into the cluster. Nodes with IPs and hostnames can exist in the same cluster.
For Linux:
Install the Couchbase software
Execute:
sudo /etc/init.d/couchbase-server stop
Edit the start() function in the script
located at
/opt/couchbase/bin/couchbase-server
Under the line that reads:
-run ns_bootstrap -- \Add a new line that reads:
-name ns_1@hostname \
Where hostname is either a DNS name
or an IP address that you want this server to identify
the node (the 'ns_1@' prefix is mandatory). For example:
... -run ns_bootstrap -- \ -name ns_1@couchbase1.company.com \ -ns_server config_path "\"/opt/couchbase/etc/couchbase/static_config\"" \ ...
Delete the files under:
/opt/couchbase/var/lib/couchbase/data/*
/opt/couchbase/var/lib/couchbase/mnesia/*
/opt/couchbase/var/lib/couchbase/config/config.dat
Execute:
sudo /etc/init.d/couchbase-server startSee the node correctly identifying itself as the hostname in the GUI under the Manage Servers page (you will be taken back to the setup wizard since the configuration was cleared out, but after completing the wizard the node will be named properly).
For Windows:
Install the Couchbase Server software
Stop the service by running:
C:\Program Files\Couchbase\Server\bin\service_stop.batUnregister the service by running:
C:\Program Files\Couchbase\Server\bin\service_unregister.bat
Edit the script located at C:\Program
Files\Couchbase\Server\bin\service_register.bat:
On the 7th line it says set
NS_NAME=ns_1@%IP_ADDR%
Replace %IP_ADDR% with the
hostname/IP address that you want to use.
Register the service by running the modified script
C:\Program
Files\Couchbase\Server\bin\service_register.bat
Delete the files located under C:\Program
Files\Couchbase \Server\var\lib\couchbase\mnesia.
Start the service by running:
C:\Program Files\Couchbase\Server\bin\service_start.batSee the node correctly identifying itself as the hostname in the GUI under the Manage Servers page (you will be taken back to the setup wizard since the configuration was cleared out, but after completing the wizard the node will be named properly).