ssich
ssich

Reputation: 79

Cannot connect to my Cassandra with localhost

My Cassandra used to work with no problems.

I was able to connect with no problems but now for some reason it doesn't work anymore.

[default@unknown] connect localhost/9160;
Exception connecting to localhost/9160. Reason: Connection refused.

I am in Ubuntu server

Thanks in-advance

Upvotes: 3

Views: 21867

Answers (3)

eruh
eruh

Reputation: 11

I faced the same problem and the reason was that I had configured Cassandra to listen on the Server IP and not on localhost.

/etc/dse/cassandra/cassandra.yaml

listen_address: 10.102.8.71

So try this and check if it works for you:

cassandra-cli --host "your host name"

Upvotes: 1

sdolgy
sdolgy

Reputation: 7001

The solution to this question was provided to you on the pycassa google group:

This is not a pycassa problem. The problems you are having are specific to starting a Cassandra instance and not following the documentation in the README.txt that is in the root folder of the distribution:

Getting started

This short guide will walk you through getting a basic one node cluster up and running, and demonstrate some simple reads and writes.

  • tar -zxvf apache-cassandra-$VERSION.tar.gz
  • cd apache-cassandra-$VERSION
  • sudo mkdir -p /var/log/cassandra
  • sudo chown -R whoami /var/log/cassandra
  • sudo mkdir -p /var/lib/cassandra
  • sudo chown -R whoami /var/lib/cassandra

Note: The sample configuration files in conf/ determine the file-system locations Cassandra uses for logging and data storage. You are free to change these to suit your own environment and adjust the path names used here accordingly.

Now that we're ready, let's start it up!

  • bin/cassandra -f

Running the startup script with the -f argument will cause Cassandra to remain in the foreground and log to standard out.

Now let's try to read and write some data using the command line client.

  • bin/cassandra-cli --host localhost

The command line client is interactive so if everything worked you should be sitting in front of a prompt...

Connected to: "Test Cluster" on localhost/9160 Welcome to cassandra CLI.

Type 'help;' or '?' for help. Type 'quit;' or 'exit;' to quit. [default@unknown]

As the banner says, you can use 'help;' or '?' to see what the CLI has to offer, and 'quit;' or 'exit;' when you've had enough fun.

Upvotes: 4

zznate
zznate

Reputation: 1908

Verify the following:

  • Cassandra process is running and thrift is listening on 9160 (netstat-tulpn)
  • 9160 port not being blocked by a firewall rule or similar

If the above are true, then check the cassandra log for additional information.

Other than that your description is pretty vague. So any other information about what may have changed in the environment would be helpful.

Upvotes: 1

Related Questions