나는 kubernetes 1.7 documentation에서 묘사 된 것처럼, 구글 카산드라 이미지로 쿠베넷에 리던던트 스테이트 풀 세트를 설정하려고 시도 해왔다.카산드라 스테이트 풀 세트 in kubernetes
image used에 따르면 이는 일관성 수준이 1 인 상태 저장 세트입니다. 테스트 예제에서는 하나의 데이터 센터에서만 상태 저장 세트에 3 개의 복제본을 설정 했으므로 복제 계수가 3 인 SimpleStrategy 복제를 사용하고 있습니다. 나는 cassandra-0, cassandra-1, cassandra-2를 씨앗으로 정의 했으므로 모두 씨앗입니다.
나는 키 스페이스와 테이블을 만들었습니다
"create keyspace if not exists testing with replication = { 'class' : 'SimpleStrategy', 'replication_factor' : 3 }"
"create table testing.test (id uuid primary key, name text, age int, properties map<text,text>, nickames set<text>, goals_year map<int,int>, current_wages float, clubs_season tuple<text,int>);"
나는 cqlsh 바이너리를 사용하여, 다른 관련이없는 포드에서 데이터를 삽입하여 테스트입니다, 그리고 그래서, 데이터가 모든 컨테이너에 끝납니다 볼 수 있습니다 복제가 성공했습니다. 모든 포드에 nodetool 상태와 함께 제공 :
Datacenter: DC1-K8Demo
======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
-- Address Load Tokens Owns (effective) Host ID Rack
UN 10.16.0.161 71.04 KiB 32 100.0% 4ad4e1d3-f984-4f0c-a349-2008a40b7f0a Rack1-K8Demo
UN 10.16.0.162 71.05 KiB 32 100.0% fffca143-7ee8-4749-925d-7619f5ca0e79 Rack1-K8Demo
UN 10.16.2.24 71.03 KiB 32 100.0% 975a5394-45e4-4234-9a97-89c3b39baf3d Rack1-K8Demo
... 모든 카산드라 포드는 이전에 생성 된 테이블에서 동일한 데이터를 가지고 :
id | age | clubs_season | current_wages | goals_year | name | nickames | properties
--------------------------------------+-----+--------------+---------------+------------+----------+----------+--------------------------------------------------
b6d6f230-c0f5-11e7-98e0-e9450c2870ca | 26 | null | null | null | jonathan | null | {'goodlooking': 'yes', 'thinkshesthebest': 'no'}
5fd02b70-c0f8-11e7-8e29-3f611e0d5e94 | 26 | null | null | null | jonathan | null | {'goodlooking': 'yes', 'thinkshesthebest': 'no'}
5da86970-c0f8-11e7-8e29-3f611e0d5e94 | 26 | null | null | null | jonathan | null | {'goodlooking': 'yes', 'thinkshesthebest': 'no'}
을하지만 그때 내가 그 DB를 복제 중 하나를 삭제 (! 감사는 Kubernetes) 포드 (카산드라-0), 새로운 포드는 다시 새로운 카산드라-0을 예상대로 최대 온천, 나는 모든 포드가 3 그 중 하나 개의 행을 잃은 것을 지금 참조 :
id | age | clubs_season | current_wages | goals_year | name | nickames | properties
--------------------------------------+-----+--------------+---------------+------------+----------+----------+--------------------------------------------------
5fd02b70-c0f8-11e7-8e29-3f611e0d5e94 | 26 | null | null | null | jonathan | null | {'goodlooking': 'yes', 'thinkshesthebest': 'no'}
5da86970-c0f8-11e7-8e29-3f611e0d5e94 | 26 | null | null | null | jonathan | null | {'goodlooking': 'yes', 'thinkshesthebest': 'no'}
...
Datacenter: DC1-K8Demo
======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
-- Address Load Tokens Owns (effective) Host ID Rack
UN 10.16.0.161 71.04 KiB 32 81.7% 4ad4e1d3-f984-4f0c-a349-2008a40b7f0a Rack1-K8Demo
UN 10.16.0.162 71.05 KiB 32 78.4% fffca143-7ee8-4749-925d-7619f5ca0e79 Rack1-K8Demo
DN 10.16.2.24 71.03 KiB 32 70.0% 975a5394-45e4-4234-9a97-89c3b39baf3d Rack1-K8Demo
UN 10.16.2.28 85.49 KiB 32 69.9% 3fbed771-b539-4a44-99ec-d27c3d590f18 Rack1-K8Demo
... 카산드라 링 모든 카산드라 포드에있는이 3 개 행이 여전히 새로 만든 포드에 모든 데이터를 복제하고, 안 : d 개 nodetool 상태는 지금 함께 온다?
...이 경험은 github에 설명되어 있습니다.
... 누군가이 경험을 시도 했습니까?이 테스트 컨텍스트에서 잘못된 것일 수 있습니까?
슈퍼 덕분에 사전
이 외에도. Kubernetes에서 이것을 수행하는 가장 좋은 방법은 노드를 제거한 PreStop 후크를 추가하는 것입니다. 더 많은 정보는 여기에 있습니다 : https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/ –
지금까지 해답을 가져 주셔서 감사합니다. 그러나 시뮬레이션하고 싶은 상황이 우발적 인 실패 였음을 분명히해야합니다. 특정 노드. 저는 카산드라가이 특정한 상황을 충족 시켜줄 것이라는 생각을 가지고 있습니다. –
@Horia, 감사합니다. 거기서 읽었습니다.'nodetool removenode'는 토큰 할당을 다시 설정하고 죽은 것을 대체하는 새 노드에 데이터를 복제합니다. 여전히 명확한 테스트 시나리오에서 작업하고 있지만 이것이 많은 도움이되었습니다. –