Score:0

Connection error: (Unable to connect to any servers, {127.0.0.1:9042: ConnectionRefusedError(111, Tried connecting to [(127.0.0.1, 9042)]

pl flag

Sometimes when I try cqlsh command on my Ubuntu 22.04 machine I get the following error:

Connection error: (Unable to connect to any servers, {127.0.0.1:9042: ConnectionRefusedError(111, Tried connecting to [(127.0.0.1, 9042)]. Last error: Connection refused)})

And stopping or restarting Cassandra service won't help at all. This happens with no obvious reason, I mean I may exit the cqlsh and put my laptop on stand-by and comeback after hours and it works, but sometime it won't work!

After trying different solutions on the internet I found that if I run cassandra command it seems it executes some codes and keeps waiting at the end, but cqlsh command works after this in a new terminal, even if I cancel or close the previous terminal that I have been running cassandra command on.

I like to know why this happens after a while and how can I prevent it to happen again? Also what does cassandra command do? Why systemctl status cassandra shows it is active with no errors but cqlsh doesn't work until I run cassandra command?

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.