简体   繁体   English

使用Linux Shell脚本远程连接到Cassandra实例

[英]Connecting to Cassandra Instance Remotely using Linux Shell Script

I want to connect to Cassandra installed in a remote server from my dev environment. 我想从我的开发环境连接到安装在远程服务器上的Cassandra。 Dev Environment doesn't have cassandra installed and hence it is not allowing me to do the below for connecting to my cassandra server running on a different machine. 开发环境未安装cassandra,因此不允许我执行以下操作以连接到在不同计算机上运行的cassandra服务器。

Client System - Dev System without Cassandra Destination System - Prod Environment where Cassandra is installed 客户端系统-不带Cassandra的Dev系统目标系统-安装Cassandra的产品环境

I am trying the below command over my dev terminal to connect to Prod Cassandra. 我正在通过我的开发人员终端尝试以下命令以连接到Prod Cassandra。

/opt/cassandra/dse-4.8.7/bin/cqlsh -e "select * from /"IasService/"./"Table/" limit 10" remote.stress.py1.s.com 9160 -u test-p test2; /opt/cassandra/dse-4.8.7/bin/cqlsh -e“ select * from /"IasService/"./"Table/” limit 10“ remote.stress.py1.s.com 9160 -u test-p test2 ;

Any leads would be helpful. 任何线索都将有所帮助。

tldr; tldr;

Remove the 9160 from your command. 从命令中删除9160。

It would be easier to help you if you provided the error message or result of your command. 如果提供了错误消息或命令结果,将更容易为您提供帮助。

That being said, DSE 4.8.7 has Cassandra 2.1.14 at its core. 话虽如此,DSE 4.8.7的核心是Cassandra 2.1.14。 As of Cassandra 2.1, cqlsh connects using the native binary protocol on port 9042. So forcing it to 9160 (as you are) will definitely not work. 从Cassandra 2.1开始,cqlsh在端口9042上使用本机二进制协议进行连接。因此,将其强制设置为9160(如您所愿)绝对不起作用。

$ cqlsh -e "SELECT release_version FROM system.local" 192.168.6.5 9042 
  -u cassdba -p superSecret

 release_version
-----------------
          2.1.13

(1 rows)

And since 9042 is the default port used by cqlsh now, you don't need to specify it at all. 而且由于9042是cqlsh现在使用的默认端口,因此根本不需要指定它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM