25th Anniversary Savings | 25% Off Dedicated Servers*Shop Now
25th Anniversary Savings | 25% Off VPS Hosting* †††Shop Now
Dedicated Hosting Deals | From $99/moShop Now
Earn hosting credits and a chance to win an Amazon gift card when you refer friends to Liquid Web!Read our promo rules

Cassandra Failed to connect Error: [SOLVED]

Reading Time: < 1 minute
Pre-Flight Check
  • These instructions are intended specifically for solving the error: Failed to connect to ‘127.0.0.1:7199’: Connection refused.
  • I’ll be working from both Liquid Web Core Managed CentOS 6 and CentOS 7 servers, and I’ll be logged in as root.

Error While Using Cassandra’s ‘nodetool’

This error may occur when using the ‘nodetool’ command, such as in the following example:

nodetool status

For both CentOS 6 and CentOS 7 search the following configuration file:

vim /etc/cassandra/default.conf/cassandra-env.sh

For a refresher on editing files with vim see: New User Tutorial: Overview of the Vim Text Editor

Search for:

JVM_OPTS="$JVM_OPTS -Djava.rmi.server.hostname=

Which for my search resulted in:

# add this if you're having trouble connecting:
# JVM_OPTS="$JVM_OPTS -Djava.rmi.server.hostname=<public name>"

Uncomment the second line, and add the hostname of your server or the IP address which you’re connecting to/from. In this case, replacing <public name> with 127.0.0.1 resolved the issue, because we are connecting to/from that IP address.

Then exit and save the file with the command:
wq

Then, restart Cassandra:

systemctl restart cassandra

About the Author: J. Mays

As a previous contributor, JMays shares his insight with our Knowledge Base center. In our Knowledge Base, you'll be able to find how-to articles on Ubuntu, CentOS, Fedora and much more!

Latest Articles

How to Force HTTPS For Your Domain

Read Article

What is CGI-Bin and What Does it Do?

Read Article

Top 10 Password Security Standards

Read Article

Top 10 Password Security Standards

Read Article

How to Use the WP Toolkit to Secure and Update WordPress

Read Article