在单个 ubuntu 服务器上设置 cassandra 多节点集群 [英] setting up cassandra multi node cluster on a single ubuntu server

查看:32
本文介绍了在单个 ubuntu 服务器上设置 cassandra 多节点集群的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在有一个 Cassandra 服务在我的 Ubuntu 服务器上运行,只有一个节点.我想把它做成一个有 3 个节点的环形集群,以感受多节点集群都在同一台服务器上.按照此链接中的步骤https://www.youtube.com/watch?v=oHMJrhMtv3c,我尝试在不停止已经运行的 cassandra 服务的情况下创建一个新集群.但是它抛出了地址 引起:java.net.BindException: Address already in use.因此,我尝试将种子 ip 更改为已经在运行的 cassandra ip 地址,并尝试在前台运行第二个 cassandra 服务.这次它抛出了 java.lang.RuntimeException: Unable to create thrift socket to ip port.请告诉我如何将节点添加到同一台服务器上已经运行的单节点集群中.

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 检查地址是否正确解析.
  • 将两个(或更多)Cassandra 实例放在不同的文件夹中.
  • 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 实例的地址放入种子列表中以创建集群(如 -seeds: "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.

  • 使用./cassandra 启动脚本一一启动实例(您可以稍后为此编写简单的 bash 脚本).
  • 使用 ./nodetool status 验证您的拓扑.例如,对于两个节点,输出必须看起来像

  • start the instances one by one using ./cassandra startup script (you can write simple bash script for this later).
  • Verify your topology with ./nodetool status . For the two nodes, for instance, the output must look like

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆