John
John

Reputation: 31

How to Resolve Error Message: "No connection could be made because the target machine actively refused it."

I accidentally shorted out the power to my PC while programming Cassandra via cqlsh within Windows Command Prompt. After restoring power, I tried to re-run Cassandra via cqlsh:

C:\Program Files\....\apache-cassandra\bin>cqlsh

and received the following error message;

Connection error: (Unable to connect to any server’ {‘127.0.0.1’: error (10061,
“Tried connecting to [(‘127.0.0.1’, 9042)]. Last error:  No connection
could be made because the target machine actively refused it”)}).

I’m using Cassandra version 3.0 on a single PC with a window 7 operating system and am using cqlsh via Command Prompt. This PC does not have any connections to any external clusters.

From similar questions relating to the same error message, there was the comment ‘”Actively refused it” means that the host sent a reset instead of an ack when you tried to connect. ….Either there is a firewall blocking the connection or the process that is hosting the service is not listening on that port. This may be because it is not running at all or because it is listening on a different port. Once you start the process hosting your service, try netstat –anb to verify that it is running and listening on the expected port.”

Based on the above, I have looked at Windows Firewall Inbound and Outbound rules and cannot find any Local Port 9042. Unfortuntely, I don’t know the pathway in order to run netstat –anb.

Could someone provide steps to follow to re-establish the connection to port 9042, if this will fix the problem, or how to re-establish access to run cqlsh in Command Prompt again.

Upvotes: 2

Views: 5062

Answers (3)

Sanket Goti
Sanket Goti

Reputation: 13

I think your answer no this https://phoenixnap.com/kb/install-cassandra-on-windows

these are a steps for , from installation to start Cassandra server Everything is explained step by steps. I hope its helpful for you.

Upvotes: 0

Mranal Jadhav
Mranal Jadhav

Reputation: 29

For my case, I hadn't started the Cassandra server but was trying to connect to it directly. Here are the steps for what I did on Windows:

  1. Start the Cassandra server via cmd

    \bin> cassandra

  2. Try to connect to its node

    \bin> cqlsh

Upvotes: 1

Jeff Jirsa
Jeff Jirsa

Reputation: 4426

It's likely that the cassandra daemon/service is not running - I'm not familiar with Cassandra on windows (whether it runs as a service, or if you have to start it via command line), but however you started it previously, you should start it again in the same manner. On Linux, that would be /etc/init.d/cassandra start or ./bin/cassandra - on Windows, you'll either want to start the service, or ./bin/cassandra.bat or ./bin/cassandra.ps1 or similar.

Upvotes: 2

Related Questions