How to connect Cassandra to localhost using cqlsh?
- Albert Lim
- 2014-06-01 03:15
- 9
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 ?
9 Answers
Consider changing /etc/cassandra.yaml:
# Whether to start the thrift rpc server. start_rpc: false
to
start_rpc: true
connect to remote cassandra cqlsh, You might need to put cqlsh from 2.1 or 2.0 on your mac to match the server you are trying to connect to. So that's what I'd try first. Cqlsh is a utility for running simple CQL (Cassandra Query Language) commands on a local or remote Cassandra cluster. This article
Hall Newman
2016-01-06 16:18
You need to connect to cassandra through the rpc_address defined in cassandra.yaml. For example, I use cqlsh 10.0.80.49 9160.
connect to cassandra command line, You can also use cqlsh to access remotely to the cluster: cqlsh node_ip 9043. but this will require cqlsh to be present on your machine. In general, Cassandra uses an initial set of contact nodes and a gossip protocol to contact and learn the cluster composition. to the Thrift port, which defaults to 9160, not the JMX or Storage Port:
Daniel Compton
2014-09-08 05:08
if you see this in cassandra logs:
INFO [main] 2015-07-21 12:06:27,426 CassandraDaemon.java:406 - 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
install cqlsh mac, Unable to start cqlsh in Mac OS X? Ask Question Asked 5 years, 10 months ago. Active 5 years, 8 months ago. No cqlsh on Cassandra install on CentOS 7.2. 1. Starting cqlsh on Linux and Mac OS X. Navigate to the Cassandra installation directory. Start cqlsh on the Mac OSX, for example. bin/cqlsh. If you use security features, provide a user name and password. Print the help menu for cqlsh . bin/cqlsh --help. Optionally, specify the IP address and port to start cqlsh on a
Vincent de Lagabbe
2015-07-21 11:14
If you are on OSX
brew install cassandra
First start the Cassandra
cassandra
Connect via CQL shell
cqlsh 127.0.0.1

cqlsh download, CQLSH is a command line shell for interacting with your database through CQL (Cassandra Query Language). This tool provides a useful interface for administrators and developers to access the database and issue CQL commands. The versions of CQLSH correspond to a DataStax database version. By downloading this DataStax product, you agree to the terms of the EULA. On the DataStax Download page, click Tools > CQLSH. If you agree with the license
Gajen Sunthara
2015-11-24 21:43
Maybe start cassandra on your local machine by bin/cassandra -f first?
connect to cassandra from mac, Creating a Cassandra cluster in a Custom VPC. Setting Up a Datacenter with EBS Encryption. Using Cassandra. Connecting to a Cluster. Connect to Cassandra Using Cqlsh. Connect to Cassandra with C#. Connect to Cassandra with Golang. Connect to Cassandra with Node.js. Avoiding range slice issues in Cassandra. Install most recent version of Java. Install homebrew if you don't already have it.
Jun
2015-07-27 18:01
It's not listening on 127.0.0.1 since you told it to only listen on <public IP>. Make the listen address 0.0.0.0 to listen on all addresses (or just omit it if possible as this is usually the default). See Listening Sockets .NET tutorial or any other socket tutorial to get a basic understanding of socket binding.
Update (@c45556037):
Note that listen_address is the one for other nodes to use to connect to this one (a misleading name). rpc_address is the actual address to locally bind to. It's unclear from the 2.0 docs and is explained better in the 1.0 docs.
how to connect to cassandra database, Find database cassandra on TheAnswerHub.com. TheAnswerHub is a top destination for finding answers online. Browse our content today! Navigate to File | Data Sources or press Ctrl+Shift+Alt+S .
ivan_pozdeev
2017-05-23 10:31
I faced same situation while starting cqlsh . I got following error while starting cassandra
Enter only ----cassandra----- in terminal.
it will show all jars and log files . if terminal hang , just escape from it and then enter cqlsh. then it will enter to cassandra cli.
This worked for me
cassandra connection closed, Had same problem recently after downgrade from Cassandra 3.0 to Cassandra 2.2 on ArchLinux. Unlike above solutions my problem wasn't in .cassandra, but version 3.0 left its configuration in /var/lib/cassandra directory. Following commands solved my problem: sudo rm -R /var/lib/cassandra sudo rm -R /var/log/cassandra sudo rm -R /usr/share/cassandra I'm using Cassandra 2.0.10, go version go1.4.2 darwin/amd64. to connect to "localhost:9042": gocql: connection closed waiting for response
Satish Kumar Tiriveedhi
2016-04-16 18:29
for 2.0.5 the following works for me ..
$CASSANDRA_HOME/bin/cqlsh xx.xx.xxx.xxx 9160
cassandra cluster nohostavailable(unable to connect to any servers), Active Oldest Votes. 0. Before connecting to your cluster you have to provide the nodes contact point and auth provider or you have to run cassandra on your localhost ip address. try this : ap = PlainTextAuthProvider(username=<username>,password=<password>) cass_contact_points= [<ip address of your node>,..] cluster = Cluster(cass_contact_points,auth_provider=ap) session = cluster.connect(<keyspace name>) cassandra.cluster.NoHostAvailable: ('Unable to connect to any servers', {'192.168.19.1': error(None, "Tried connecting to [('192.168.19.1',
user2720864
2014-07-25 15:21

cassandra.yamlfile on the line withrpc_port :normally by default= 9160cassandracqlsh 127.0.0.1 9160: should be ok in any casecqlsh [IP of host] 9160: if ok thencassandrareachable from lan, if ok thencassandrais not reachable fromlanbut onlylocalhost 127.0.0.1Connect to Cassandra from a different machine, . Refer to the FAQ for more information on this. to stay in the foreground instead of running as a background process.
LeGeekDOzoZoo
2017-05-13 03:30