2

最近、2 つのノードを持つ Cassandra クラスターをセットアップしました。レプリケーション係数は 2 に設定されており、両方のノードがオンになっている場合、両方ともうまく機能しているようです。少なくとも1つのノードが稼働している限り、ヘクターが機能し続けるようにするにはどうすればよいでしょうか? 今のところ、次のようなものがあります。

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}];

私は非常に些細なことを見逃していると確信しています。どんな助けでも大歓迎です。ありがとう

4

2 に答える 2

1

挿入時にどの整合性レベルを使用していますか? QUORUM または ALL で書き込みを行っている場合、両方のノードが 2 のレプリケーション ファクターで書き込み可能である必要があります (2 ノードのクォーラムは 2 です。これが、典型的な Cassandra クラスターがレプリケーション ファクターに奇数を使用する理由です)。

于 2011-08-02T14:45:51.247 に答える