Cassandra 未正确启动
我尝试使用 3 个节点构建 Cassandra 集群
在节点 1 上,当我尝试使用 cqlsh 时遇到了麻烦:
Connection error: ('Unable to connect to any servers', {'127.0.0.1': error(111, "Tried connecting to [('127.0.0.1', 9042)]. Last error: Connection refused")})
在 cassandra.yaml 中,我没有看到 ip 127.0.0.1 的字符串,我在那里写了正确的参数(在我看来)
cluster_name: 'cassandra_cluster'
seeds: "node_public_ip_1,node_public_ip_2,node_public_ip_3"
listen_address: node_public_ip_1
rpc_adress: node_public_ip_1
在 cassandra-topology.properties 中:
`# Cassandra Node IP=Data Center:Rack`
node_public_ip_1=dc1:rac1
node_public_ip_2=dc1:rac1
node_public_ip_3=dc1:rac1
我做错了什么? 谢谢!
I try to build Cassandra cluster with 3 nodes
On node 1 i've got a trouble when i try use cqlsh:
Connection error: ('Unable to connect to any servers', {'127.0.0.1': error(111, "Tried connecting to [('127.0.0.1', 9042)]. Last error: Connection refused")})
In cassandra.yaml i dont't see strings with ip 127.0.0.1, i wrote there correct parametres (in my mind)
cluster_name: 'cassandra_cluster'
seeds: "node_public_ip_1,node_public_ip_2,node_public_ip_3"
listen_address: node_public_ip_1
rpc_adress: node_public_ip_1
in cassandra-topology.properties:
`# Cassandra Node IP=Data Center:Rack`
node_public_ip_1=dc1:rac1
node_public_ip_2=dc1:rac1
node_public_ip_3=dc1:rac1
What i do wrong?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当您在未指定主机的情况下运行CQLSH时,它默认为
localhost
(127.0.0.0.1
)。您需要指定要连接到运行CQLSH时要连接的节点的客户端IP地址(rpc_address
)。此外,多建筑服务器的标准建议是将私有IP用于内部群集通讯和公共IP进行客户连接。这意味着在
cassandra.yaml
中,您将配置:由于种子用于播种集群通信,您还将使用节点的私有IP地址配置种子列表。
最后,如果您使用旧的
propertyfilesnitch
,则还应将cassandra-topology.properties
与节点的私有IP地址配置。但是,PFS确实很旧,在几乎所有情况下,我们的建议是使用
gossipingpropertyfilesnitch
,因为它具有能够在将来扩展群集的所有好处,而没有任何缺陷,如我所解释的那样。发帖 - https://community.datastax.com/questions.questions/questions/8887/8887/ 。管理GPF也很简单,因为您只需要在
cassandra-rackdc.properties
中设置单个节点的dc和rack配置,而无需重新配置所有节点。簇。当您切换到GPF时,您应该在节点上删除
cassandra-topology.properties
,以防止将来的任何八卦问题,如我在这篇文章中所述 - https://community.datastax.com/questions/questions/4621/ 。干杯!When you run cqlsh without specifying the host, it defaults to
localhost
(127.0.0.1
). You need to specify the client IP address (rpc_address
) of the node you want to connect to when running cqlsh.Also, the standard recommendation for multi-homed servers is to use the private IP for internal cluster comms and the public IP for client connections. This means that in
cassandra.yaml
you would configure:Since the seeds are used for seeding cluster communication, you would also configure the seeds list with the nodes' private IP addresses.
Finally, if you're using the old
PropertyFileSnitch
, you should also configurecassandra-topology.properties
with the nodes' private IP addresses.However, PFS is really old and in almost all cases our recommendation is to use
GossipingPropertyFileSnitch
since it has all the benefits of being able to expand the cluster in the future without any downsides as I've explained in this post -- https://community.datastax.com/questions/8887/.It is also a lot simpler to manage GPFS since you only need to set a single node's DC and rack configuration in
cassandra-rackdc.properties
without having to reconfigure all the nodes whenever you add/remove nodes from the cluster.When you do switch to GPFS, you should delete
cassandra-topology.properties
on the nodes to prevent any gossip issues in the future as I've explained in this post -- https://community.datastax.com/questions/4621/. Cheers!尝试在此集群的两个节点上运行“nodetool status”和“nodetool describecluster”以识别节点使用的IP。
并尝试通过主机/IP 进行连接。例如:
cqlsh <主机>; <端口> -u <用户> -p <密码>
Try run the "nodetool status" and "nodetool describecluster" on both nodes of this cluster to identify the IP used by nodes.
and try connect passing the host/ip. like:
cqlsh <host> <port> -u <user> -p <password>