CassandraDB Shell - Unable to connect to any servers
| 2 minutes
VMware vCloud Availability vCloud Director CassandraDB

One of the core pre-requisites for vCloud Availability for vCloud Director 2.0 is CassandraDB. This database service stores replication state and storage information and is used by the HCS (vSphere Replication Cloud Service) appliance.

As part of my strained vCloud Availability deployment I needed to build a simple CassandraDB server. VMware Docs and the vCloud Architecture blog have some great information to get you started:

Symptom

I built the CassandraDB server as described in the blog post and Docs pages above, but when I would try to connect to the database using the Cassandra shell (cqlsh {ip-address} 9042) I would get the following error:

Connection error: (‘Unable to connect to any servers’, {’::1’: error(101, “Tried connecting to [(’::1’, 9042, 0, 0)]. Last error: Network is unreachable”), ‘{ip-address}’: error(111, “Tried connecting to [(’{ip-address}’, 9042)]. Last error: Connection refused”)})

Investigation

Plenty of Googling later showed that this might’ve been a listening address vs listening interface config issue but VMware explicitly state that you should listen on the interface and not the IP you’ve set. I rebuilt the server a few times thinking I had stuffed the build, but I still couldn’t get it working…

Solution

There is a specific step during the CassandraDB configuration that the VMware Docs will call out as having the potential to throw a Python error. Specifically Step 1f has the following:

Enter Cassandra command line to verify setup:
# cqlsh
If an error regarding python occurs when running cqlsh, update Python to Python 2.7.

While I was not getting a Python error, I tried the Python 2.7 fix anyway as detailed in the page above:

# yum install -y centos-release-SCL

# yum install -y python27

# scl enable python27 bash

# echo "/usr/lib/python2.7/site-packages/" > /opt/rh/python27/root/usr/lib/python2.7/site-packages/usrlocal.pth

Boom! The CassandraDB shell was able to connect to the database instance.

For the record, this was on a CentOS 7 installation.

About Stellios Williams
Senior Cloud Solutions Architect - Service Providers VMware
This is my personal tech related blog for anything private and public cloud - including homelabs! My postings are my own and don’t necessarily represent VMware’s positions, strategies or opinions. Any technical guidance or advice is given without warranty or consideration for your unique issues or circumstances.
Comments
comments powered by Disqus
Advertisement