1. Docker와 사전준비
공홈에는 메모리 제한이 2기가 인데, 그걸로는 부족하다.
그래서 각각 4기가로 잡았다.
실제로 K8S에서도 노드당 4기가 정도는 잡아먹는다.
docker-compose.yml
seed노드와 일반노드 따로따로 볼륨설정을 했다.
version: '2.4'
services:
seed_node:
image: "docker.io/strapdata/elassandra:6.8.4.3"
environment:
- "JVM_OPTS=-Dcassandra.custom_query_handler_class=org.elassandra.index.ElasticQueryHandler"
- "MAX_HEAP_SIZE=1200m"
- "HEAP_NEWSIZE=300m"
- "CASSANDRA_CGROUP_MEMORY_LIMIT=true"
- "DEBUG=true"
cap_add:
- IPC_LOCK
ulimits:
memlock: -1
mem_limit: 4096m
ports:
- "9042:9042"
- "9200:9200"
volumes:
- ./volume_data_seed_node:/var/lib/cassandra
node:
image: "docker.io/strapdata/elassandra:6.8.4.3"
environment:
- "JVM_OPTS=-Dcassandra.custom_query_handler_class=org.elassandra.index.ElasticQueryHandler"
- "MAX_HEAP_SIZE=1200m"
- "HEAP_NEWSIZE=300m"
- "CASSANDRA_CGROUP_MEMORY_LIMIT=true"
- "CASSANDRA_SEEDS=seed_node"
- "DEBUG=true"
links:
- seed_node
cap_add:
- IPC_LOCK
ulimits:
memlock: -1
mem_limit: 4096m
volumes:
- ./volume_data_node:/var/lib/cassandra
kibana:
image: docker.elastic.co/kibana/kibana-oss:6.8.4
environment:
- "ELASTICSEARCH_URL=http://seed_node:9200"
ports:
- "5601:5601"
mem_limit: 500m
띄우고 확인
docker-compose up -d
docker ps로 확인후 컨테이너 cqlsh 실행
docker exec -it 컨테이터명 cqlsh
# 이렇게 나와야함
cqlsh>
노드 상태 확인
docker exec -i 컨테이너명 nodetool status
이런식으로 나온다.
DC1이라는 데이터센터에 r1이라는 하나의 랙 안에 노드가 2개 있는건데 사용율이 61.0과 39.0이라는 뜻
- DC1이 소문자인지 대문자인지 확인 해놔야 한다.(접속할때 대소문자에 따라서 안됐던 기억이.. 정확하지는 않지만..)
Datacenter: DC1
===============
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
-- Address Load Tokens Owns (effective) Host ID Rack
UN 172.19.0.3 215.43 KiB 8 61.0% de3873dc-0995-4236-b233-f5d5543713f0 r1
UN 172.19.0.4 180.42 KiB 8 39.0% fb11cebe-7632-41a2-af6d-5ec116f11306 r1
M1 / M2 Silicon 일경우
version: '2.4'
services:
seed_node:
image: "docker.io/strapdata/elassandra:6.8.4.3"
restart: always
platform: linux/amd64
environment:
- "JVM_OPTS=-Dcassandra.custom_query_handler_class=org.elassandra.index.ElasticQueryHandler"
- "MAX_HEAP_SIZE=1200m"
- "HEAP_NEWSIZE=300m"
- "CASSANDRA_CGROUP_MEMORY_LIMIT=true"
- "DEBUG=true"
cap_add:
- IPC_LOCK
ulimits:
memlock: -1
mem_limit: 4096m
ports:
- "9042:9042"
- "9200:9200"
volumes:
- ./volume_data_seed_node:/var/lib/cassandra
node:
image: "docker.io/strapdata/elassandra:6.8.4.3"
restart: always
platform: linux/amd64
environment:
- "JVM_OPTS=-Dcassandra.custom_query_handler_class=org.elassandra.index.ElasticQueryHandler"
- "MAX_HEAP_SIZE=1200m"
- "HEAP_NEWSIZE=300m"
- "CASSANDRA_CGROUP_MEMORY_LIMIT=true"
- "CASSANDRA_SEEDS=seed_node"
- "DEBUG=true"
links:
- seed_node
cap_add:
- IPC_LOCK
ulimits:
memlock: -1
mem_limit: 4096m
volumes:
- ./volume_data_node:/var/lib/cassandra
kibana:
image: docker.elastic.co/kibana/kibana-oss:6.8.4
restart: always
platform: linux/amd64
environment:
- "ELASTICSEARCH_URL=http://seed_node:9200"
ports:
- "5601:5601"
mem_limit: 500m