How to connect Cassandra to localhost using cqlsh?

2020-05-30 03:56发布

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 ?

14条回答
甜甜的少女心
2楼-- · 2020-05-30 04:19

Please execute the below query to resolve the issue

#!/bin/bash
export CASSANDRA_HOME=/opt/apache-cassandra-2.1.8
export CQLSH_HOST=192.168.1.200
export CQLSH_PORT=9042
echo $@
$CASSANDRA_HOME/bin/cqlsh $@'    

Make sure to change the IP and location of cassandra Home Directory

查看更多
趁早两清
3楼-- · 2020-05-30 04:27

If you are on OSX

brew install cassandra

First start the Cassandra

cassandra

Start the Cassandra Connect via CQL shell

cqlsh 127.0.0.1

enter image description here

查看更多
登录 后发表回答