如何使用cqlsh连接到Cassandra(remotehost)

mob*_*Dev 11 cassandra cqlsh

我不能cqlsh到远程主机

 ./cqlsh xx.xx.x.xxx 9042
   Connection error: ('Unable to connect to any servers', {'10.101.33.163':   
   ConnectionException(u'Did not get expected SupportedMessage response; 
   instead, got: <ErrorMessage code=0000 [Server error]      
   message="io.netty.handler.codec.DecoderException: 
   org.apache.cassandra.transport.ProtocolException: Invalid or unsupported 
   protocol version: 4">',)})
Run Code Online (Sandbox Code Playgroud)

我使用的是cqlsh 5.0.1和python 2.7.10

  ./cqlsh --version
     cqlsh 5.0.1
  python -V
    Python 2.7.10
Run Code Online (Sandbox Code Playgroud)

我在Mac上并使用http://www.datastax.com/2012/01/working-with-apache-cassandra-on-mac-os-x中的说明下载cassandra.

我本地的Cassandra是2.2.1(据我从zip文件中理解),看起来远程主机上的cassandra不是2.2.1(我假设它是2.0或2.1).如果没有明确知道远程主机上的版本是什么,我该如何尝试连接到远程主机上的cassandra

小智 12

1)确保服务正在运行:

$ ps aux | grep cassandra

示例:106 7387 5.1 70.9 2019816 1454636?SLl Sep02 16:39/usr/lib/jvm/java-7-oracle/jre // bin/java -Ddse.system_cpu_cores = 2 -Ddse.system_memory_in_mb = 2003 -Dcassandra.config.loader = com.datastax.bdp.config .DseConfigurationLoader -Ddse.system_cpu_cores = 2 -Ddse.system_memory_in_mb = 2003 -Dcassandra.config.loader = com.datastax.bdp.config.DseConfigurationLoader -ea -javaagen ...

2)通过检查服务器配置确保使用正确的IP:

$ ifconfig

例:

eth1链接封装:以太网HWaddr 08:00:27:a6:4e:46
inet地址:192.168.56.10 Bcast:192.168.56.255掩码:255.255.255.0 inet6地址:fe80 :: a00:27ff:fea6:4e46/64范围: Link UP BROADCAST RUNNING MULTICAST MTU:1500公制:1

3)确保您可以从您所在的服务器连接到该IP:

$ ssh user@xxx.xxx.xx.xx

4)检查节点的状态并确认它显示相同的IP:

$ nodetool状态

5)运行命令以连接IP(如果未使用默认值,则仅指定端口):

$ cqlsh xxx.xxx.xx.xx