0

C:\Users\spant2\Downloads\apache-cassandra-3.11.5\bin>cassandra -f

Starting Cassandra Server

C:\Users\spant2\Downloads\apache-cassandra-3.11.5\bin>cqlsh

Connection error: ('Unable to connect to any servers', {'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")})

  • 1
    Please show us some of your code and have a look at [How do I ask a good question?](https://stackoverflow.com/help/how-to-ask). – SparkFountain Feb 06 '20 at 09:32
  • please edit your question and add the command that you are using to connect to Cassandra – abi_pat Feb 06 '20 at 10:19
  • @abi_pat I updated the commands. Can you please suggest? – Shubhangi Pant Feb 06 '20 at 10:37
  • is your cassandra node running on same host? – abi_pat Feb 06 '20 at 10:40
  • based on your question, I am assuming your cassandra node is running on same machine/host. Refer https://docs.datastax.com/en/archived/cql/3.3/cql/cql_reference/cqlsh.html and mention host port parameters. If you still face the issue, I think you may need to update your hosts file - https://www.howtogeek.com/howto/27350/beginner-geek-how-to-edit-your-hosts-file/ – abi_pat Feb 06 '20 at 10:43
  • if the problem still persists, follow this answer - https://stackoverflow.com/a/36846543/3601406 – abi_pat Feb 06 '20 at 10:46
  • Try starting cassandra with `cassandra -p cassandra.pid` instead. – Aaron Feb 07 '20 at 14:48

2 Answers2

1

can you check if any other process/application is running on port 9042

linux command

netstat -anp|grep -i 9042

if any process is already running on same port, kill that process.

kus
  • 446
  • 3
  • 7
0

Please use cqlsh with IP address if you set rpc_address is public IP.

You may refer below https://docs.datastax.com/en/archived/cql/3.3/cql/cql_reference/cqlsh.html

Also, please check whether port 9042 is open or not on your system.

LetsNoSQL
  • 1,478
  • 1
  • 11
  • 23