How to connect Cassandra to localhost using cqlsh?

connect to remote cassandra cqlsh
connect to cassandra command line
install cqlsh mac
cqlsh download
connect to cassandra from mac
how to connect to cassandra database
cassandra connection closed
cassandra cluster nohostavailable(unable to connect to any servers)

I set rpc_port to the public IP address, and now I can connect to Cassandra just fine from an outside server.

However, I cannot connect from the Cassandra server itself, using cqlsh

I am getting an error.Thar are:

 Connection error: Could not connect to localhost:9160

Is there a configuration, I can change to be able to connect from the server itself ?

  1. Check the cassandra.yaml file on the line with rpc_port : normally by default = 9160
  2. Login to the machine hosting cassandra
  3. Try cqlsh 9160 : should be ok in any case
  4. try cqlsh [IP of host] 9160 : if ok then cassandra reachable from lan, if ok then cassandra is not reachable from lan but only localhost

Connect to Cassandra from a different machine, to stay in the foreground instead of running as a background process. Connecting to Instaclustr with SSL. a) For Mac/Linux. Open your terminal and using the following command, create a “.cassandra/cqlshrc” file in your user home directory. vi .cassandra / cqlshrc. Copy the following content and paste it into the empty cqlshrc file. Then save the file. b) For Windows.

Consider changing /etc/cassandra.yaml:

# Whether to start the thrift rpc server.
start_rpc: false


start_rpc: true

Cassandra - Installation, Specifying a hostname or IP address after the cqlsh command (and options) connects the CQL session to a specified Cassandra node. By default, CQL shell launches a session with the local host on 127.0. 0.1. You can only connect CQL shell to remote hosts that have a higher or equal version than the local copy. Cassandra is one of the most popular NoSQL database systems available and is the best build to be used in distributed environments. Dealing with Cassandra is pretty easy for beginners with some knowledge of RDBMS and SQL. CQL is very similar to SQL to a certain extent, and CQLSH makes testing and debugging much easier.

You need to connect to cassandra through the rpc_address defined in cassandra.yaml. For example, I use cqlsh 9160.

Starting cqlsh, DataStax Astra — Built on Apache Cassandra and designed from the ground To connect the CQL session to a specified node, specify a hostname or IP By default, the CQL shell launches a session with the local host on address 127.0.​0.1. Check the cassandra.yaml file on the line with rpc_port : normally by default = 9160; Login to the machine hosting cassandra; Try cqlsh 9160: should be ok in any case; try cqlsh [IP of host] 9160: if ok then cassandra reachable from lan, if ok then cassandra is not reachable from lan but only localhost

if you see this in cassandra logs:

INFO  [main] 2015-07-21 12:06:27,426 - Not starting RPC server as requested. Use JMX (StorageService->startRPCServer()) or nodetool (enablethrift) to start it

then just open a terminal and

$ nodetool enablethrift

as written in the INFO message. Should now work. Got this when my system upgraded to cassandra 2.2.0

cqlsh (startup options), However, the error clearly showed that cqlsh was trying to connect to spec 3.2.​1 | Native protocol v3] Use HELP for help. cassandra@cqlsh>. docker pull cassandra docker run --name cassandra -p -p -d cassandra This will ensure the docker container maps to the IPv4. 9160 - Thrift client API 9042 - CQL native transport port From your PHP application, you have to connect to the Thrift port.

If you are on OSX

brew install cassandra

First start the Cassandra


Connect via CQL shell


Getting "connection refused" error while logging into Cassandra, In this section, we will show how to connect to and use Apache cqlsh localhost -u cassandra -p cassandra Connected to Test Cluster at  Thanks for contributing an answer to Stack Overflow! Please be sure to answer the question.Provide details and share your research! But avoid …. Asking for help, clarification, or responding to other answers.

Cassandra Tutorials, Step 1. Create a Apache Cassandra connection. Navigate to File | Data Sources Ctrl+Shift+Alt+S . In the Data Sources and Drivers dialog, click the Add icon ( The Add icon ) For example, jdbc:cassandra://localhost:9042/?sslenabled=true. I have a cassandra node at a machine. When I access cqlsh from the same machne it works properly. But when I tried to connect to it's cqlsh using "192.x.x.x" from another machine, I'm getting an e

How to connect to Cassandra with SSL - Help, In this post, I am going to talk about Apache Cassandra, its purpose, a bit about Cassandra and how to use CQL and connecting it in your  CONSISTENCY − Shows the current consistency level, or sets a new consistency level. COPY − Copies data to and from Cassandra. DESCRIBE − Describes the current cluster of Cassandra and its objects. EXPAND − Expands the output of a query vertically. EXIT − Using this command, you can terminate cqlsh.

Getting started with Apache Cassandra and Python, Pls find the error while using multiple clusters Connection url must specify a host, e.g., jdbc:cassandra://localhost:9170/Keyspace1 at org.apache.cassandra.​cql.jdbc. Setting up Cassandra 1. Download the Cassandra release from * * I downloaded release 1.1.4 1. Create the directory “/usr/local

  • Thank you for pointing the direction, actually in my case I found start_rpc: false, setting it to true fixed the problem.
  • Actually, I have such an option and such a problem
  • Daniel - I am trying to run cassandra on google cloud and want to use external IP. I specified the external address in rpc_address but got error when trying to start cassandra- INFO [main] 2019-12-17 19:00:37,251 - Starting listening for CQL clients on / (unencrypted)... Exception (java.lang.IllegalStateException) encountered during startup: Failed to bind port 9042 on xx.xx.x.xx. java.lang.IllegalStateException: Failed to bind port 9042 on x.x.x.x.x.. Would you know what I might be doing wrong?
  • Sorry no, I don't know what the issue is from your description. Perhaps try the Cassandra users mailing list or other community support forums?
  • But cassandra from datastax, says not to set to listen addres in the .yaml file itself? Why so
  • Cassandra throws an error when I do this. It is not recommended
  • @JonathanKelsey without more details, your comment isn't very helpful
  • Ok, this causes an error in Cassandra A typical yaml will have this comment about the listen address: 'Setting this to is always wrong.' Or from the Cassandra apache FAQ we have this note 'Cassandra is a gossip-based distributed system. ListenAddress is also "contact me here address," i.e., the address it tells other nodes to reach it at. Telling other nodes "contact me on any of my addresses" is a bad idea; if different nodes in the cluster pick different addresses for you, Bad Things happen.' In short this is simply bad advice
  • @JonathanKelsey Sigh. See the 2nd part, it clearly tells one to set rpc_address rather that listen_address.
  • Could you explain why this answer is a solution?