在单个Ubuntu服务器上设置Cassandra多节点集群 [英] setting up cassandra multi node cluster on a single ubuntu server
问题描述
我有一个Cassandra服务在我的Ubuntu服务器上运行,现在只有一个节点。我想把它变成一个有3个节点的环形集群,以获得所有在同一个服务器上的多节点集群的感觉。按照此链接中的步骤 https://www.youtube.com/watch?v=oHMJrhMtv3c ,我试图创建一个新的集群而不停止已经运行的cassandra服务。但是它抛出了地址由Caused:java.net.BindException:地址已在使用中。所以我试图更改种子ip已经运行cassandra ip地址,并试图在前台运行第二个cassandra服务。这一次它抛出了java.lang.RuntimeException:无法创建thrift套接字到ip端口。请让我知道如何添加节点到同一服务器上已经运行的单节点群集。
I have a Cassandra Service running on my Ubuntu Server with a single node now. I want to make it into a ring cluster with 3 nodes to get a feel of multinode cluster all being on the same server. By following the steps in this link https://www.youtube.com/watch?v=oHMJrhMtv3c, I tried to create a fresh cluster without stopping the already running cassandra service. But it has thrown address Caused by: java.net.BindException: Address already in use. So i tried changing the seeds ip to already running cassandra ip address and tried to run a second cassandra service in the foreground. This time it has thrown java.lang.RuntimeException: Unable to create thrift socket to ip port. Please let me know how to add nodes to a already running single node cluster on the same server.
推荐答案
在同一台Ubuntu计算机上运行多个Cassandra实例,只要它们具有不同的IP地址即可解析为本地主机。整个127.0.0.0/8地址块保留用于回送的目的,所以发送到地址(127.0.0.1到127.255.255.254)的任何数据包都将被环回。
It is very easy to run multiple Cassandra instances on the same Ubuntu machine as long as they have different IP addresses that all resolve to the local host. The entire 127.0.0.0/8 address block is reserved for loopback purposes so any packet sent to addresses (127.0.0.1 through 127.255.255.254) will be looped back.
- 使用
ping
检查地址是否正确解析。 - 将两个
- Use
ping
to check if the addresses resolve properly. - Place two (or more) Cassandra instances into different folders.
编辑 cassandra.yaml
并替换
- Cassandra给定实例特有的位置的各种文件位置。
-
localhost
到我们给该实例的IP地址(如127.0.0.2)。
- 使用
SimpleSeedProvider
的所有其他Cassandra实例添加到种子列表以创建一个集群(如- 种子:127.0.0.2,127.0.0.3
- 不要更改任何端口号,不要帮助和不要求。
- Various file locations to the locations unique to the given instance of Cassandra.
localhost
to the IP address we give to that instance (like 127.0.0.2).- Use
SimpleSeedProvider
and put addresses of all other Cassandra instances to the seed list to make a cluster (like- seeds: "127.0.0.2","127.0.0.3"
- Do not alter any port numbers, not helpful and not required.
编辑 cassandra-env。 sh
,找到 JMX_PORT
属性设置并为Cassandra的每个实例赋予不同的值(不同的端口)。否则由于此端口上的冲突,实例不能一起运行。
Edit cassandra-env.sh
, find where the JMX_PORT
property is set and give it a different value (different port) for every instance of Cassandra. Otherwise instances cannot run together because of the conflicts on this port.
- 使用
./
Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
-- Address Load Tokens Owns (effective) Host ID Rack
UN 127.0.0.1 61.97 KB 256 100.0% 6c04e202-8f24-4f17-b430-0154c1512316 rack1
UN 127.0.0.2 105.68 KB 256 100.0% ca3073ee-451c-4cef-97ee-d312784648bb rack1
这篇关于在单个Ubuntu服务器上设置Cassandra多节点集群的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!