Python Cassandra cqlsh“无法连接到任何服务器”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/33002404/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Cassandra cqlsh "unable to connect to any servers"
提问by cdn
I get the following message when executing cqlsh.bat on the command line
在命令行上执行 cqlsh.bat 时收到以下消息
Connection error: ('Unable to connect to any servers', {'127.0.0.1': ProtocolError("cql_version '3.3.0' is not supported by remote (w/ native protocol). Supported versions: [u'3.2.0']",)})
I'm running Python version 2.7.10 along with Cassandra version 2.2.1. Not sure if it's related but when I start the Cassandra server I need to run "Set-ExecutionPolicy Unrestricted" on PowerShell or else it doesn't work.
我正在运行 Python 2.7.10 版和 Cassandra 2.2.1 版。不确定它是否相关,但是当我启动 Cassandra 服务器时,我需要在 PowerShell 上运行“Set-ExecutionPolicy Unrestricted”,否则它不起作用。
采纳答案by Eric Walsh
You can force cqlsh to use a specific cql version using the flag
您可以使用标志强制 cqlsh 使用特定的 cql 版本
--cqlversion="#.#.#"
--cqlversion="#.#.#"
Example cqlsh usage (and key/values):
cqlsh 用法示例(和键/值):
cqlsh 12.34.56.78 1234 -u username -p password --cqlversion="3.2.0"
cqlsh (IP ADDR) (PORT) (DB_USERN) (DB_PASS) (VER)
回答by RussS
ProtocolError("cql_version '3.3.0' is not supported by remote (w/ native protocol). Supported versions: [u'3.2.0']"
Indicates that there is a version mismatch between the C* version you are running and the python driver run by CQLSH. Make sure they are all out of the same release.
表示您正在运行的 C* 版本与 CQLSH 运行的 python 驱动程序之间存在版本不匹配。确保它们都来自同一个版本。
回答by Harshad Vyawahare
I was facing a similar issue when I was executing bin/cqlsh. I was seeing the below error:
我在执行 bin/cqlsh 时遇到了类似的问题。我看到以下错误:
Connection error: ('Unable to connect to any servers', {'cassandra-1.alpha.mimosacloud.co': ProtocolError("cql_version '3.2.0' is not supported by remote (w/ native protocol). Supported versions: [u'3.2.1']",)})
My remote server was using cassandra 2.1.12 and I was trying to connect to it using the cqlsh bundeled with apache-cassandra-2.1.7. My problem was resolved when I downloaded apache-cassandra-2.1.12 from this linkand used the cqlsh bundled with it.
我的远程服务器使用的是 cassandra 2.1.12,我试图使用与 apache-cassandra-2.1.7 捆绑的 cqlsh 连接到它。当我从此链接下载 apache-cassandra-2.1.12并使用与之捆绑的 cqlsh时,我的问题得到了解决。
Details of my server are: [cqlsh 5.0.1 | Cassandra 2.1.12 | CQL spec 3.2.1 | Native protocol v3]
我的服务器的详细信息是:[cqlsh 5.0.1 | 卡桑德拉 2.1.12 | CQL 规范 3.2.1 | 本机协议 v3]
回答by Dhairya Bhardwaj
edit cqlsh.py file (you can find it using which cqlsh
) and change the value of
DEFAULT_CQLVER = 'z.z.z'
to the supported version.
编辑 cqlsh.py 文件(您可以使用 找到它which cqlsh
)并将 的值更改
DEFAULT_CQLVER = 'z.z.z'
为支持的版本。