I need to configure Couchbase 2.2 to use short hostname.
Currently I am using Couchbase 2.0.1 and in this case the solution was easy:
/opt/couchbase/var/lib/couchbase/ip
and /opt/couchbase/var/lib/couchbase/ip_start
files. extra="-name ns_1@$ip"
for extra="-sname ns_1@$ip"
in _start()
function into /opt/couchbase/bin/couchbase-server
. This parameter was used to run erl (-run ns_bootstrap -- $extra
)This steps allows me to configure the node with the short hostname and create the cluster based on these.
In Couchbase 2.2 I can't do that because erl runs using babysitter. I try to configure babysitter to use short hostname but I couldn't make it work...
The servers were deployed in an a private Virtualization environment that only handle short hostname.
Each node has 2 ips, one public and one private. If I run a ping
command from itself i get their private IP and I run ping a command from any other node I get their public IP.
For example, if I have one node: myhost-00 (private IP: 192.168.8.170 public IP: 10.254.171.29)
from itself:
$ ping myhost-00
PING myhost-00 (192.168.8.170) 56(84) bytes of data.
from other node:
$ ping myhost-00
PING myhost-00 (10.254.171.29) 56(84) bytes of data.
Any ideas?
I figured out a workaround:
Firstly, I don't modify any of the Couchbase files.
Secondly, I add a fake domain to my short hostname in each /etc/hosts file. In the file I append the private IP for the current node and the public IP for other nodes with the fake domain.
For example, assuming I have 2 hosts:
myhost-00 (private IP: 192.168.8.170 public IP: 10.254.171.29)
myhost-01 (private IP: 192.168.8.168 public IP: 10.254.171.30)
myhost-00 /etc/hosts file:
...
192.168.8.170 myhost-00.mydomain
10.254.171.30 myhost-01.mydomain
...
myhost-01 /etc/hosts file:
...
10.254.171.29 myhost-00.mydomain
192.168.8.168 myhost-01.mydomain
...
Finally, I create de cluster using the hostnames with the fake domains (myhost-00.mydomain and myhost-01.mydomain)