我在 AWS 上使用 3 个 EC2 实例节点的 cassandra 集群。
每个节点挂载一个 EBS 卷到路径(/usr/lib/cassandra/),因此 cassandra 的数据存储在 EBS 卷中。
所有节点都有一个 dns 指向自己的私有 ip。并且所有 cassandra 配置文件都使用 DNS 而不是私有 ip。
我的问题是:当一个节点被终止时,我会启动另一个 cassandra,并将 EBS 挂载到新启动的实例上,这样数据就不会丢失。但是在启动 cassandra 服务时,cassandra 服务会失败。日志如下:
我不知道为什么它会使用其他节点的ip?
INFO 12:47:36,364 Writing Memtable-schema_keyspaces@1358300025(251/2510 serialized/live bytes, 8 ops)
INFO 12:47:36,367 Enqueuing flush of Memtable-schema_columns@1982787565(91991/919910 serialized/live bytes, 2375 ops)
INFO 12:47:36,367 Enqueuing flush of Memtable-schema_columnfamilies@59370809(38866/388660 serialized/live bytes, 1052 ops)
INFO 12:47:36,385 Completed flushing /var/lib/cassandra/data/system/schema_keyspaces/system-schema_keyspaces-jb-10-Data.db (214 bytes) for commitlog position ReplayPosition(segmentId=1382719654978, position=289)
INFO 12:47:36,391 Writing Memtable-schema_columns@1982787565(91991/919910 serialized/live bytes, 2375 ops)
INFO 12:47:36,627 Completed flushing /var/lib/cassandra/data/system/schema_columns/system-schema_columns-jb-24-Data.db (19358 bytes) for commitlog position ReplayPosition(segmentId=1382719654978, position=289)
INFO 12:47:36,628 Writing Memtable-schema_columnfamilies@59370809(38866/388660 serialized/live bytes, 1052 ops)
INFO 12:47:36,660 Completed flushing /var/lib/cassandra/data/system/schema_columnfamilies/system-schema_columnfamilies-jb-24-Data.db (8750 bytes) for commitlog position ReplayPosition(segmentId=1382719654978, position=289)
INFO 12:47:36,661 Log replay complete, 64 replayed mutations
INFO 12:47:36,746 Compacting [SSTableReader(path='/var/lib/cassandra/data/system/schema_columnfamilies/system-schema_columnfamilies-jb-23-Data.db'), SSTableReader(path='/var/lib/cassandra/data/system/schema_columnfamilies/system-schema_columnfamilies-jb-22-Data.db'), SSTableReader(path='/var/lib/cassandra/data/system/schema_columnfamilies/system-schema_columnfamilies-jb-24-Data.db'), SSTableReader(path='/var/lib/cassandra/data/system/schema_columnfamilies/system-schema_columnfamilies-jb-21-Data.db')]
INFO 12:47:37,584 Compacted 4 sstables to [/var/lib/cassandra/data/system/schema_columnfamilies/system-schema_columnfamilies-jb-25,]. 34,990 bytes to 8,759 (~25% of original) in 809ms = 0.010325MB/s. 16 total rows, 4 unique. Row merge counts were {1:0, 2:0, 3:0, 4:4, }
INFO 12:47:38,411 Cassandra version: 2.0.1
INFO 12:47:38,412 Thrift API version: 19.37.0
INFO 12:47:38,425 CQL supported versions: 2.0.0,3.1.1 (default: 3.1.1)
INFO 12:47:38,485 Loading persisted ring state
ERROR 12:47:38,537 Exception encountered during startup
java.lang.RuntimeException: Unknown host /172.31.9.175 with no default configured
at org.apache.cassandra.locator.PropertyFileSnitch.getEndpointInfo(PropertyFileSnitch.java:90)
at org.apache.cassandra.locator.PropertyFileSnitch.getDatacenter(PropertyFileSnitch.java:113)
at org.apache.cassandra.locator.DynamicEndpointSnitch.getDatacenter(DynamicEndpointSnitch.java:127)
at org.apache.cassandra.locator.TokenMetadata$Topology.addEndpoint(TokenMetadata.java:1049)
at org.apache.cassandra.locator.TokenMetadata.updateNormalTokens(TokenMetadata.java:187)
at org.apache.cassandra.locator.TokenMetadata.updateNormalTokens(TokenMetadata.java:159)
at org.apache.cassandra.service.StorageService.initServer(StorageService.java:470)
at org.apache.cassandra.service.StorageService.initServer(StorageService.java:428)
at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:343)
at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:442)
at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:485)
java.lang.RuntimeException: Unknown host /172.31.9.175 with no default configured
at org.apache.cassandra.locator.PropertyFileSnitch.getEndpointInfo(PropertyFileSnitch.java:90)
at org.apache.cassandra.locator.PropertyFileSnitch.getDatacenter(PropertyFileSnitch.java:113)
at org.apache.cassandra.locator.DynamicEndpointSnitch.getDatacenter(DynamicEndpointSnitch.java:127)
at org.apache.cassandra.locator.TokenMetadata$Topology.addEndpoint(TokenMetadata.java:1049)
at org.apache.cassandra.locator.TokenMetadata.updateNormalTokens(TokenMetadata.java:187)
at org.apache.cassandra.locator.TokenMetadata.updateNormalTokens(TokenMetadata.java:159)
at org.apache.cassandra.service.StorageService.initServer(StorageService.java:470)
at org.apache.cassandra.service.StorageService.initServer(StorageService.java:428)
at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:343)
at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:442)
at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:485)
Exception encountered during startup: Unknown host /172.31.9.175 with no default configured