如何以编程方式连接到群集

时间:2014-05-09 12:20:43

标签: java cassandra

我已成功安装cassandra,当我使用" connect localhost/9160;"进行测试时它对我来说很好。我想连接不同的IP地址/端口。我更改了listen_address文件中的cassandra.yaml并重新启动了服务器并测试它显示如下错误。

 Exception retrieving information about the cassandra node, check you have connected to the thrift port.

org.apache.thrift.transport.TTransportException: Read a negative frame size (-21
13929216)!
        at org.apache.thrift.transport.TFramedTransport.readFrame(TFramedTranspo
rt.java:133)
        at org.apache.thrift.transport.TFramedTransport.read(TFramedTransport.ja
va:101)
        at org.apache.thrift.transport.TTransport.readAll(TTransport.java:84)
        at org.apache.thrift.protocol.TBinaryProtocol.readAll(TBinaryProtocol.ja
va:362)
        at org.apache.thrift.protocol.TBinaryProtocol.readI32(TBinaryProtocol.ja
va:284)
        at org.apache.thrift.protocol.TBinaryProtocol.readMessageBegin(TBinaryPr
otocol.java:191)
        at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:69)
        at org.apache.cassandra.thrift.Cassandra$Client.recv_describe_cluster_na
me(Cassandra.java:1206)
        at org.apache.cassandra.thrift.Cassandra$Client.describe_cluster_name(Ca
ssandra.java:1194)
        at org.apache.cassandra.cli.CliMain.connect(CliMain.java:138)
        at org.apache.cassandra.cli.CliClient.executeConnect(CliClient.java:2393
)
        at org.apache.cassandra.cli.CliClient.executeCLIStatement(CliClient.java
:282)
        at org.apache.cassandra.cli.CliMain.processStatementInteractive(CliMain.
java:201)
        at org.apache.cassandra.cli.CliMain.main(CliMain.java:331)

对我来说真的很有帮助。我的英语不好......

1 个答案:

答案 0 :(得分:0)

如果您更改的唯一参数是listen_address,那么您仍需要使用端口9160连接cassandra-cli。如果您还想更改该端口,则需要相应调整rpc_port中的cassandra.yaml。 listen_address定义两个Cassandra节点将通过的端口。它独立于Thrift客户端使用的端口(如cassandra-cli)。