Setting up your host file and DNS system correctly
Posted on August 16th, 2011
Apache Cassandra is a distributed storage system. Like many distributed storage systems it is a requirement that your IP and DNS systems are setup correctly on all hosts for proper functionality.
Getting ready
For this recipe assume you have three hosts cas01.domain.pvt(10.1.1.1), cas02.domain.pvt(10.1.1.2), cas03.domain.pvt(10.1.1.3)
How to do it…
Ensure your hostfile resolves the DNS name to your routable IP (not localhost) by editing /etc/hosts
127.0.0.1 localhost.localdomain localhost
10.1.1.1 cas01.domain.pvt cas01
Run the hostname command and ensure the hostname exactly matches your host file
$ hostname
cas01.domain.pvt
Go to another machine on your network and ping this host by hostname.
# ping -c1 cas01.domain.pvt
PING cas01.domain.pvt (10.1.1.1) 56(84) bytes of data.
64 bytes from cas01.domain.pvt (10.1.1.1): icmp_seq=1 ttl=64 time=0.020 ms
How it works…
Unless the DNS system is setup correctly hosts will have difficult time communicating with each other. It is possible to work around DNS by rpc_address and listen_address in the conf/cassnadra.yaml file, but Java’s JMX systems which is used by nodetool uses RMI and will may have trouble connecting to remove hosts if the name resolution is not correct.
There is more…
If possible try to avoid multiple ip per machine which can cause applications to auto-detect the wrong IP. Also be aware of IPV6 support which is enabled by default in many Linux distributions. IPV6 can lead to confusion if enabled but not configured correctly.
At times you can set the java property -D java.rmi.server.hostname=XXX in the conf/cassandra-env.sh file.
See also…
Infomation on java properties that effect the JMX port can be found at http://download.oracle.com/javase/1.4.2/docs/guide/rmi/javarmiproperties.html
For information about how JMI and RMI are challenged by multi-homed systems visit http://weblogs.java.net/blog/emcmanus/archive/2006/12/multihomed_comp.html
Tags: cassandra, DNS, JMX
Filed under Chapter 1 Getting Started | 64 Comments »