问题描述
我正在尝试在计算机上运行Cassandra。绑定cqlsh会给我这个错误,
Connection error: ('Unable to connect to any servers',{'127.0.0.1:9042': error(61,"Tried connecting to [('127.0.0.1',9042)]. Last error: Connection refused")})
正在运行的cassandra -f
挂起。
我使用brew install cassandra
安装了cassandra。
我还完成了以下所有操作:
- 杀死的docker实例
- 卸载并重新安装Cassandra(从我的计算机上删除了所有Cassandra数据和填充)
- 重启我的机器
- 清除的docker数据
我不知道为什么我仍然遇到这个问题。运行brew services list
显示:
Name Status User Plist
cassandra started aanish /Users/aanish/Library/LaunchAgents/homebrew.mxcl.cassandra.plist
MysqL stopped
MysqL@5.7 started aanish /Users/aanish/Library/LaunchAgents/homebrew.mxcl.MysqL@5.7.plist
postgresql stopped
解决方法
cqlsh
连接错误表明localhost
没有在端口9042
(Cassandra的CQL客户端端口)上侦听。最可能的原因是Cassandra进程未运行。
如果在终端中运行以下命令,则可以确认Java进程是否正在监听端口9042
:
$ sudo lsof -nPi -sTCP:LISTEN
您将需要查看system.log
(通常在/var/log/cassandra
中)以了解Cassandra的情况。
请注意,如果将rpc_address
中的cassandra.yaml
设置为Mac的IP,则在与cqlsh
连接时需要指定该地址。例如:
$ cqlsh 10.1.2.3