我们从 cassandra 集群 (1.0.10) 中得到了奇怪的行为。
我们正在运行一个 3 节点集群。
如果我在未设置复制因子的情况下创建键空间,则在尝试输入数据时会出错:
[default@unknown] create keyspace foo;
ae639ba0-d4b8-11e1-0000-424d3d43a8df
Waiting for schema agreement...
Warning: unreachable nodes 10.227.65.172, 10.51.62.63... schemas agree across the cluster
[default@unknown] use foo;
Authenticated to keyspace: foo
[default@foo] create column family User with comparator = UTF8Type;
b4608180-d4b8-11e1-0000-424d3d43a8df
Waiting for schema agreement...
Warning: unreachable nodes 10.227.65.172, 10.51.62.63... schemas agree across the cluster
[default@foo] update column family User with
... column_metadata =
... [
... {column_name: first, validation_class: UTF8Type},
... {column_name: last, validation_class: UTF8Type},
... {column_name: age, validation_class: UTF8Type, index_type: KEYS}
... ];
b70562c0-d4b8-11e1-0000-424d3d43a8df
Waiting for schema agreement...
Warning: unreachable nodes 10.227.65.172, 10.51.62.63... schemas agree across the cluster
[default@foo] set User['jsmith']['first'] = 'John';
null
UnavailableException()
at org.apache.cassandra.thrift.Cassandra$insert_result.read(Cassandra.java:15206)
at org.apache.cassandra.thrift.Cassandra$Client.recv_insert(Cassandra.java:858)
at org.apache.cassandra.thrift.Cassandra$Client.insert(Cassandra.java:830)
at org.apache.cassandra.cli.CliClient.executeSet(CliClient.java:901)
at org.apache.cassandra.cli.CliClient.executeCLIStatement(CliClient.java:218)
at org.apache.cassandra.cli.CliMain.processStatementInteractive(CliMain.java:220)
at org.apache.cassandra.cli.CliMain.main(CliMain.java:348)
(无法到达节点的问题应该不是这里所说的问题)
但是,如果我创建键空间并指定复制因子(1、2 或 3),那么它可以正常工作。
如果在没有指定复制因子的情况下创建集群存在问题,那么不应该在创建时抛出异常吗?如果您未在多节点集群上指定复制因子,预期的行为是什么?