Cassandra config在IP更改后更改为使用主机名称
Cassandra的初始安装是使用IP地址完成的,并且已运行6个月以上。上周末,DevOps将安全性更改为不允许IP地址并重新分配新的IP地址。我修改了所需的文件(cassandra.yaml,cassandra-rackdc.properties等)以包含主机名。问题是nodetool status给出错误,无法连接到'127.0.0.1:7199,并且我在cassandra-env.sh中有JVM_OPTS =“$ JVM_OPTS -Djava.rmi.server.hostname = blah”。任何想法如何进入环境备份?我是否应该浏览相同的文件并用新的IP地址替换主机名?谢谢。Cassandra config在IP更改后更改为使用主机名称
有两个选项可以在Cassandra.yaml中提供监听地址。
- listen_address
- listen_interface
要完全不可知的IP地址或主机名的,使用listen_interface的选择和评论的listen_address。这里是Cassandra.yaml变化所需
# Address or interface to bind to and tell other Cassandra nodes to connect to.
#
#listen_address: xx.xxx.xx.xxx
# Set listen_address OR listen_interface, not both. Interfaces must correspond
# to a single address, IP aliasing is not supported.
listen_interface: eth0
要弄清楚实际listen_interface,发出命令
- 使用ifconfig -a
- 挑选一个显示接口, “UP BROADCAST RUNNING” 。 (在mycase为eth0)
输出应该看起来像
[email protected]:~# ifconfig -a
docker0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
inet addr:xxx.xx.x.x Bcast:0.0.0.0 Mask:255.255.0.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:2 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:152 (152.0 B) TX bytes:0 (0.0 B)
eth0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
inet addr:xx.xxx.xx.xx Bcast:xx.xxx.xx.xx Mask:255.255.0.0
UP BROADCAST RUNNING MULTICAST MTU:9001 Metric:1
RX packets:169552382 errors:0 dropped:0 overruns:0 frame:0
TX packets:185182015 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:88406501352 (88.4 GB) TX bytes:126516101404 (126.5 GB)
lo Link encap:Local Loopback
inet addr:xx.xxx.xx.xx Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:38490371 errors:0 dropped:0 overruns:0 frame:0
TX packets:38490371 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:41155731774 (41.1 GB) TX bytes:41155731774 (41.1 GB)
重新启动卡桑德拉,你应该是好去。 另一个优点是Cassandra.yaml不再需要在节点(假设所有节点都具有相同的网络接口)上有所不同。
非常有帮助。问候。 – dtobes
欢迎来到Stack Overflow。请查看[Tour](https://*.com/tour)和[Asking](https://*.com/help/asking)。 – Shiro
试试'nodetool -h your_new_host status' –