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地址替换主机名吗?谢谢。
答案 0 :(得分:0)
在Cassandra.yaml中提供监听地址有两种选择。
要完全不知道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,请发出命令
输出应该看起来像
root@ip-xx-xxx-x-xxx:~# 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,你应该好好去。 另一个优势是Cassandra.yaml不再需要在您的节点上有所不同(假设所有节点都具有相同的网络接口)。