Skip to content

FEATURE: Add cluster start, stop, delete, list, status commands - #47

Merged
oliviarla merged 1 commit into
developfrom
f1v3/cluster-commands
Aug 5, 2026
Merged

FEATURE: Add cluster start, stop, delete, list, status commands#47
oliviarla merged 1 commit into
developfrom
f1v3/cluster-commands

Conversation

@f1v3-dev

Copy link
Copy Markdown
Collaborator

🔗 Related Issue

⌨️ What I did

Arcus Cluster 관리를 위한 명령어 (start, stop, delete, list, status)를 추가합니다.

  • arcusctl cluster start <servicecode> [--node <address>] [--group <group-name>]
  • arcusctl cluster stop <servicecode> [--node <address>] [--group <group-name>]
  • arcusctl cluster delete <servicecode>
  • arcusctl cluster list
  • arcusctl cluster status <servicecode>

특이사항

start/stopedition 기반으로 아래와 같이 동작합니다.

  • community: --node 단위로 구동/중지 가능
  • enterprise: --group 단위로 구동/중지 가능
    • 구동 순서: master → slave
    • 중지 순서: slave → master

테스트 방법

SSH 설정 + ZooKeeper 구동 상태 전제 (MacOS: 설정 - 일반 - 공유 - 원격 로그인 활성화)

test-cluster-topology.yaml

servicecode: test-community
path: /tmp/arcusctl-test/arcus-memcached
zookeeper: 127.0.0.1:3181,127.0.0.1:3182,127.0.0.1:3183

servers:
  - address: 127.0.0.1:33533
  - address: 127.0.0.1:33534
  - address: 127.0.0.1:33535

global_config:
  options: "-t 4 -c 1024 -m 64"

command

go build

./arcusctl cluster deploy 1.16.1 test-cluster-topology.yaml
./arcusctl cluster start test-community
./arcusctl cluster status test-community
./arcusctl cluster list
./arcusctl cluster stop test-community
./arcusctl cluster delete test-community

@f1v3-dev
f1v3-dev requested review from namsic and oliviarla July 31, 2026 07:21
@f1v3-dev f1v3-dev self-assigned this Jul 31, 2026

@oliviarla oliviarla left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

리뷰 완료입니다.

Comment thread internal/cluster/stop.go
Comment thread internal/cluster/delete.go Outdated
return err
}

for host := range groupByHost(topo.Servers) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

다른 클러스터에서 동일한 버전의 파일을 기반으로 arcus memcached 서버가 구동되어 있으면 어떻게 처리하게 되나요?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@namsic
cluster delete 명령에 수정사항이 있어 확인해주시면 감사하겠습니다.

기존에는 같은 path + version 을 공유하는 클러스터가 있을 때, 삭제 수행 시 다른 클러스터의 설치 디렉토리까지 삭제를 하는 문제가 있었습니다.

이를 해결하기 위해 삭제 동작을 아래와 같이 변경하였습니다.

  1. 기본 delete 는 디렉토리 삭제를 하지 않음

    • ZNode와 내부 메타데이터만 제거하고, 설치 디렉토리는 유지
    • 따라서 같은 경로를 공유하는 클러스터가 존재하더라도 문제가 되지 않음
  2. 디렉토리까지 지우기 위해서는 --purge 옵션 사용

    • 명령어: arcusctl cluster delete <servicecode> --purge
    • 내부 저장소(~/.arcusctl)의 다른 클러스터들의 meta, topology 순회
    • 그 중 동일한 path + version 을 사용하는 클러스터가 있으면 디렉토리 삭제를 건너뜀
    • 공유하는 클러스터가 없을 때만 디렉토리 삭제 진행

프로세스 확인 기준으로 했을 경우에 stop만 하고 아직 삭제하지 않은 다른 클러스터는 감지하지 못해, 공유하고있는 디렉토리를 삭제할 수 있어 메타데이터 기반 검사로 구현하였습니다.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

path + version + host까지 확인하기도 가능할 것 같은데, path + version만 확인하신 이유가 있나요?

(현재 purge 요청이 들어온 클러스터의 path+version+host 조합이 겹치는 다른 클러스터가 존재하는 경우 purge 실패하는 동작을 의미합니다.)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

다시 확인해봤는데 host 를 검증하지 않아 오탐 케이스가 있어서 host 도 확인하는 방식으로 변경했습니다.

Comment thread internal/cluster/start.go Outdated
Comment thread internal/cluster/start.go
Comment thread internal/cluster/znode.go
Comment thread internal/topology/cluster.go Outdated
@linear-code

linear-code Bot commented Aug 4, 2026

Copy link
Copy Markdown

APL-2

@f1v3-dev
f1v3-dev force-pushed the f1v3/cluster-commands branch from 023d4a5 to 670adbf Compare August 4, 2026 09:45

@oliviarla oliviarla left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

리뷰 완료입니다.

Comment thread internal/topology/cluster.go Outdated
Comment thread internal/cluster/delete.go Outdated
return err
}

for host := range groupByHost(topo.Servers) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

path + version + host까지 확인하기도 가능할 것 같은데, path + version만 확인하신 이유가 있나요?

(현재 purge 요청이 들어온 클러스터의 path+version+host 조합이 겹치는 다른 클러스터가 존재하는 경우 purge 실패하는 동작을 의미합니다.)

@f1v3-dev
f1v3-dev force-pushed the f1v3/cluster-commands branch from 670adbf to f919048 Compare August 5, 2026 03:17
@f1v3-dev
f1v3-dev requested a review from oliviarla August 5, 2026 03:17

@oliviarla oliviarla left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다 👍👍

@oliviarla
oliviarla merged commit 6a57039 into develop Aug 5, 2026
1 check passed
@f1v3-dev
f1v3-dev deleted the f1v3/cluster-commands branch August 5, 2026 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants