단일 노드를 포함하고 각 데이터 센터가 네트워크의 개별 물리적 서버에있는 각 데이터 센터에 단일 복제가있는 cassandra 2 데이터 센터 쌍이 있습니다. 하나의 데이터 센터가 망가질 경우, 다른 하나는 읽기 및 쓰기를 위해 계속 사용할 수 있습니다. 제 3의 서버에서 Java 응용 프로그램을 시작했고, 실행중인 모든 것은 ok입니다. 카산드라에게 읽고 쓰고 있어요.카산드라 복제본 예외 HUnavailableException
다음으로 네트워크에서 두 번째 데이터 센터 서버 인 네트워크 케이블을 연결 해제했습니다. 첫 번째 데이터 센터에 대한 예외없이 응용 프로그램이 계속 실행되기를 기대했지만 그렇지 않았습니다.
다음 예외
응용 프로그램에서 발생하기 시작 :me.prettyprint.hector.api.exceptions.HUnavailableException: : May not be enough replicas present to handle consistency level.
at me.prettyprint.cassandra.service.ExceptionsTranslatorImpl.translate(ExceptionsTranslatorImpl.java:60)
at me.prettyprint.cassandra.service.KeyspaceServiceImpl$9.execute(KeyspaceServiceImpl.java:354)
at me.prettyprint.cassandra.service.KeyspaceServiceImpl$9.execute(KeyspaceServiceImpl.java:343)
at me.prettyprint.cassandra.service.Operation.executeAndSetResult(Operation.java:101)
at me.prettyprint.cassandra.connection.HConnectionManager.operateWithFailover(HConnectionManager.java:232)
at me.prettyprint.cassandra.service.KeyspaceServiceImpl.operateWithFailover(KeyspaceServiceImpl.java:131)
at me.prettyprint.cassandra.service.KeyspaceServiceImpl.getSuperColumn(KeyspaceServiceImpl.java:360)
at me.prettyprint.cassandra.model.thrift.ThriftSuperColumnQuery$1.doInKeyspace(ThriftSuperColumnQuery.java:51)
at me.prettyprint.cassandra.model.thrift.ThriftSuperColumnQuery$1.doInKeyspace(ThriftSuperColumnQuery.java:45)
at me.prettyprint.cassandra.model.KeyspaceOperationCallback.doInKeyspaceAndMeasure(KeyspaceOperationCallback.java:20)
at me.prettyprint.cassandra.model.ExecutingKeyspace.doExecute(ExecutingKeyspace.java:85)
at me.prettyprint.cassandra.model.thrift.ThriftSuperColumnQuery.execute(ThriftSuperColumnQuery.java:44)
내가 2 서버에 네트워크 케이블을 다시 연결되면, 오류가 중지되었습니다.
여기 여기)
1 카산드라 1.0.10에 대한 자세한 내용은을의의는 I 각 인스턴스에 대해 노드 도구 반지를 실행
Keyspace: AdvancedAds:
Replication Strategy: org.apache.cassandra.locator.NetworkTopologyStrategy
Durable Writes: true
Options: [DC2:1, DC1:1]
2) 두 데이터 센터에 카산드라에서 설명하는 다음
./nodetool -h 111.111.111.111 -p 11000 ring
Address DC Rack Status State Load Owns Token
1
111.111.111.111 DC1 RAC1 # <-- usUp Normal 1.07 GB 100.00% 0
111.111.111.222 DC2 RAC1 Up Normal 1.1 GB 0.00% 1
./nodetool -h 111.111.111.222 ring -port 11000
Address DC Rack Status State Load Owns Token
1
111.111.111.111 DC1 RAC1 Up Normal 1.07 GB 100.00% 0
111.111.111.222 DC2 RAC1 # <-- usUp Normal 1.1 GB 0.00% 1
3) cassandra.yaml을 확인했습니다.
the seeds are 111.111.111.111, 111.111.111.222
,
4) 나는이 cassandra-topology.properties
111.111.111.111
# Cassandra Node IP=Data Center:Rack
# datacenter 1
111.111.111.111=DC1:RAC1 # <-- us
# datacenter 2
111.111.111.222=DC2:RAC1
default=DC1:r1
111.111.111.222
# Cassandra Node IP=Data Center:Rack
# datacenter 1
111.111.111.111=DC1:RAC1
# datacenter 2
111.111.111.222=DC2:RAC1 # <-- us
default=DC1:r1
5) 우리는 다음과 같이 consistencyLevel 우리의 자바 응용 프로그램에서 LOCAL_QUORUM 설정 확인 :
나는이 구성이 작동 할 말을 들었다public Keyspace getKeyspace(final String keyspaceName, final String serverAddresses)
{
Keyspace ks = null;
Cluster c = clusterMap.get(serverAddresses);
if (c != null)
{
ConfigurableConsistencyLevel policy = new ConfigurableConsistencyLevel();
policy.setDefaultReadConsistencyLevel(consistencyLevel);
policy.setDefaultWriteConsistencyLevel(consistencyLevel);
// Create Keyspace
ks = HFactory.createKeyspace(keyspaceName, c, policy);
}
return ks;
}
, 어쩌면 내가 뭔가를 놓치고있어. 당신이 두 개의 노드 만 있고 데이터가 실제로 아래로, 일관성이 필요한 경우, 당신은 전체 쓰기 가용성을 달성하지 못할 수있는 노드에 배치 될 경우 어떤 통찰력