我最近設置了一個Cassandra集羣和兩個節點。複製因子設置爲2,並且如果兩個節點都打開,它們似乎都工作正常。 現在我怎樣才能以這樣的方式使用hector,使它至少能夠在至少一個節點上運行?截至目前,我有如下的東西。Cassandra Hector負載均衡
CassandraHostConfigurator cassandraHostConfigurator = new CassandraHostConfigurator(
"localhost:9160,xx.xx.13.22:9160");
cassandraHostConfigurator.setMaxActive(20);
cassandraHostConfigurator.setMaxIdle(5);
cassandraHostConfigurator.setCassandraThriftSocketTimeout(3000);
cassandraHostConfigurator.setMaxWaitTimeWhenExhausted(4000);
Cluster cluster = HFactory.getOrCreateCluster("structspeech",
cassandraHostConfigurator);
Keyspace keyspace = HFactory.createKeyspace("structspeech", cluster);
....
比方說,如果主機xx.xx.13.22下降然後我收到以下消息在我的控制檯和我所有的刀片都失敗,直到該節點出現。
Downed xx.xx.13.22(xx.xx.13.22):9160 host still appears to be down: Unable to open transport to xx.xx.13.22(xx.xx.13.22):9160 , java.net.ConnectException: Connection refused: connect
這是我的密鑰空間是如何定義的
update keyspace structspeech with placement_strategy =
'org.apache.cassandra.locator.SimpleStrategy'
and strategy_options =[{replication_factor:2}];
我相信我失去了一些東西很瑣碎,任何幫助將不勝感激。 謝謝
鏈接真的很有幫助 – Sap