ETCD
SELINUX가 비활성화여야함. 각 OS의 SELINUX 비활성화 방법에 따라 비활성화 할 것
- https://docs.aws.amazon.com/linux/al2023/ug/disable-option-selinux.html#disable-selinux
- https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/9/html/using_selinux/changing-selinux-states-and-modes_using-selinux#Enabling_and_Disabling_SELinux-Disabling_SELinux_changing-selinux-states-and-modes
Raft Consensus 알고리즘을 사용함
때문에 ETCD의 최소 구성 노드 수는 3이 되고 안정적인 동작을 위해선 3 이상의 홀수 여야 함
참고 링크
- https://docs.redhat.com/en/documentation/openshift_container_platform/3.11/html/cluster_administration/assembly_replace-etcd-member
- https://docs.redhat.com/en/documentation/openshift_container_platform/3.11/html/cluster_administration/assembly_restore-etcd-quorum
- https://docs.microfocus.com/doc/SMAX/24.4/HASQLPatroni
- https://docs.percona.com/postgresql/13/solutions/high-availability.html
설치
해당 방법은 수동 설치를 기재
EPEL 레포지토리가 활성화 되어 있다면 dnf 같은 패키지 설치가 가능하나 Amazon Linux 2023이라던지 지원하지 않는 경우는 수동 설치를 해야함
-
환경변수지정
-
파일 다운로드 후 압축 해제
-
실행파일 복사
-
OWNER 변경
-
압축해제한 파일 삭제
-
etcd 전용 유저 작성, 디렉토리 설정
설정파일
-
설정파일 작성
vi /etc/etcd/etcd.confname: '<etcd-name>' data-dir: '<etcd-data-directory>' initial-cluster-state: 'new' initial-cluster-token: '<etcd-cluster-token>' initial-cluster: '<etcd-name-1>=http://<host-etcd-1>:2380,<etcd-name-2>=http://<host-etcd-2>:2380,<etcd-name-3>=http://<host-etcd-3>:2380' initial-advertise-peer-urls: 'http://<host-etcd-1>:2380' advertise-client-urls: 'http://<host-etcd-1>:2379' listen-peer-urls: 'http://<host-etcd-1>:2380' listen-client-urls: 'http://<host-etcd-1>:2379,http://localhost:2379' -
파일 OWNER 변경
서비스 설정
-
서비스 파일 작성
-
서비스 설정 및 시작
-
서비스 로그 확인
동작 확인 및 사용 방법
-
상태 확인
etcdctl member list --write-out=table #+------------------+---------+-------+---------------------------+---------------------------+------------+ #| ID | STATUS | NAME | PEER ADDRS | CLIENT ADDRS | IS LEARNER | #+------------------+---------+-------+---------------------------+---------------------------+------------+ #| 986395a1041128fe | started | etcd1 | http://<host-etcd-1>:2380 | http://<host-etcd-1>:2379 | false | #| 3b6832d933ad7704 | started | etcd2 | http://<host-etcd-2>:2380 | http://<host-etcd-2>:2379 | false | #| 61e3f4d804833386 | started | etcd3 | http://<host-etcd-3>:2380 | http://<host-etcd-3>:2379 | false | #+------------------+---------+-------+---------------------------+---------------------------+------------+ -
각 노드 상태 확인 (Leader 확인)
etcdctl --endpoints=http://<host-etcd-1>:2380,http://<host-etcd-2>:2380,http://<host-etcd-3>:2380 endpoint status --write-out=table #+---------------------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+ #| ENDPOINT | ID | VERSION | DB SIZE | IS LEADER | IS LEARNER | RAFT TERM | RAFT INDEX | RAFT APPLIED INDEX | ERRORS | #+---------------------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+ #| http://<host-etcd-1>:2380 | 3b6832d933ad7704 | 3.5.16 | 918 kB | true | false | 19 | 1923 | 1923 | | #| http://<host-etcd-2>:2380 | 61e3f4d804833386 | 3.5.16 | 913 kB | false | false | 19 | 1923 | 1923 | | #| http://<host-etcd-3>:2380 | 986395a1041128fe | 3.5.16 | 909 kB | false | false | 19 | 1923 | 1923 | | #+---------------------------+------------------+---------+---------+-----------+------------+-----------+------------+--------------------+--------+ -
KEY 확인
-
KEY 추가
-
KEY 확인 (각 노드에 동기화가 되었는지 확인)
-
KEY 삭제
멤버 추가
-
「추가할 서버」 etcd 설정 파일 작성
vi /etc/etcd/etcd.confname: '<etcd-name-add>' data-dir: '<etcd-data-directory>' initial-cluster-state: 'existing' initial-cluster-token: '<etcd-cluster-token>' initial-cluster: '<etcd-name-1>=http://<host-etcd-1>:2380,<etcd-name-2>=http://<host-etcd-2>:2380,<etcd-name-3>=http://<host-etcd-3>:2380,<etcd-name-add>=http://<host-etcd-add>:2380' initial-advertise-peer-urls: 'http://<host-etcd-add>:2380' advertise-client-urls: 'http://<host-etcd-add>:2379' listen-peer-urls: 'http://<host-etcd-add>:2380' listen-client-urls: 'http://<host-etcd-add>:2379,http://localhost:2379' -
「Leader 서버」 etcd 멤버 추가
-
「추가할 서버」 etcd 시작
-
「그 외 서버」 etcd 설정 파일 수정 (Leader, Member)
-
「그 외 서버」 (옵션) etcd 재시작
멤버 삭제
-
「Leader 서버」 MEMBER 삭제
-
「그 외 서버」 etcd 설정 파일 수정 (Leader, Member)
-
「그 외 서버」 (옵션) etcd 재시작
백업
-
「Leader 서버」 스냅샷 파일 작성
-
각 노드 설정파일 백업
복원
- 스냅샷 파일 복원