如何使用cqlsh连接到Cassandra(remotehost) [英] How to connect to Cassandra(remotehost) using cqlsh

查看:349
本文介绍了如何使用cqlsh连接到Cassandra(remotehost)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法cqlsh到远程主机

I cannot cqlsh to remote host

 ./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">',)})

我正在使用cqlsh 5.0.1和python 2.7.10

I am using cqlsh 5.0.1 and python 2.7.10

  ./cqlsh --version
     cqlsh 5.0.1
  python -V
    Python 2.7.10

我在Mac上,并使用了 http://www.datastax.com/2012/01/working-with-apache-cassandra-on-mac- os-x 下载cassandra。

I am on mac and used the instructions from http://www.datastax.com/2012/01/working-with-apache-cassandra-on-mac-os-x to download cassandra.

Cassandra在我的本地计算机上是2.2.1(据我从zip文件了解),并且看起来远程主机上的cassandra不是2.2.1(我假设它是2.0或2.1)。在没有确切知道远程主机上的版本的情况下,如何尝试连接到远程主机上的cassandra

Cassandra on my local is 2.2.1(as I understand from the zip file) and it appears like cassandra on remote host is NOT 2.2.1 (I assume it is either 2.0 or 2.1). Without definitively knowing what the version is on remote host, how can I try to connect to cassandra on remote host

推荐答案

1)确保服务正在运行:

$ ps aux | grep cassandra

$ 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 ...

Example: 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

$ ifconfig

示例:

eth1链接封套:以太网HWaddr 08:00:27:a6:4e:46

inet地址:192.168.56.10 广播:192.168.56.255掩码:255.255.255.0
inet6地址:fe80 :: a00:27ff:fea6:4e46 / 64范围:链接
广播运行MULTICAST MTU:1500指标:1

eth1 Link encap:Ethernet HWaddr 08:00:27:a6:4e:46
inet addr:192.168.56.10 Bcast:192.168.56.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fea6:4e46/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

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

$ ssh user@xxx.xxx.xx.xx

$ ssh user@xxx.xxx.xx.xx

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

$ nodetool状态

$nodetool status

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

$ cqlshxxx.xxx.xx。 xx

$ cqlsh xxx.xxx.xx.xx

这篇关于如何使用cqlsh连接到Cassandra(remotehost)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆