Skip to content

Conversation

@singsangssong
Copy link
Contributor

๐Ÿ”— Related Issue

โŒจ๏ธ What I did

  • ์ด์ „ arcus.sh์˜ memcached start | stop | list ๊ธฐ๋Šฅ์„ arcus-cli์—์„œ๋„ ๋™์ž‘ํ•˜๋„๋ก ํ•ฉ๋‹ˆ๋‹ค.

  • memcached start <serviceCode> [ip:port..]

    • serviceCode์— ๋“ฑ๋ก๋œ ์„œ๋ฒ„๋ฅผ ๊ตฌ๋™์‹œํ‚ต๋‹ˆ๋‹ค.
    • ๊ตฌ๋™์˜ต์…˜์€ /arcus/cache_list/<serviceCode>znode์— ์ €์žฅ๋œ, ์ „์—ญ ์˜ต์…˜์œผ๋กœ ์ˆ˜ํ–‰ํ•ฉ๋‹ˆ๋‹ค.
    • ip:port๋ฅผ ์ž…๋ ฅํ•œ๋‹ค๋ฉด, serviceCode๋‚ด์˜ ์ž…๋ ฅํ•œ ip:port ์„œ๋ฒ„๋งŒ ๊ตฌ๋™์‹œํ‚ต๋‹ˆ๋‹ค.
    • ip:port๋ฅผ ์ž…๋ ฅํ•˜์ง€ ์•Š๋Š”๋‹ค๋ฉด, serviceCode๋‚ด์˜ ๋ชจ๋“  ์„œ๋ฒ„๋ฅผ ๊ตฌ๋™์‹œํ‚ต๋‹ˆ๋‹ค.
  • memcached stop <serviceCode> [ip:port...]

    • serviceCode์— ๋“ฑ๋ก๋œ ์„œ๋ฒ„๋ฅผ ์ค‘์ง€์‹œํ‚ต๋‹ˆ๋‹ค.
    • ์„œ๋ฒ„ ๊ตฌ๋™์‹œ -P์˜ต์…˜์„ ํ†ตํ•ด pid๋ฅผ ๋ฏธ๋ฆฌ ์ €์žฅํ•˜๊ณ , ํ•ด๋‹น pid๋ฅผ ํ†ตํ•ด ํ”„๋กœ์„ธ์Šค๋ฅผ ์ข…๋ฃŒํ•ฉ๋‹ˆ๋‹ค.
    • ip:port๋ฅผ ์ž…๋ ฅํ•œ๋‹ค๋ฉด, serviceCode๋‚ด์˜ ์ž…๋ ฅํ•œ ip:port ์„œ๋ฒ„๋งŒ ์ค‘์ง€์‹œํ‚ต๋‹ˆ๋‹ค.
    • ip:port๋ฅผ ์ž…๋ ฅํ•˜์ง€ ์•Š๋Š”๋‹ค๋ฉด, serviceCode๋‚ด์˜ ๋ชจ๋“  ์„œ๋ฒ„๋ฅผ ์ค‘์ง€์‹œํ‚ต๋‹ˆ๋‹ค.
  • memcached list <serviceCode>

    • serviceCode์˜ ์„œ๋ฒ„ ๋ฆฌ์ŠคํŠธ๋ฅผ ์ถœ๋ ฅํ•ฉ๋‹ˆ๋‹ค.
    • serviceCode์˜ ๊ฐ ์„œ๋ฒ„ ip:port์™€ online์—ฌ๋ถ€๋ฅผ ๋ณด์—ฌ์ฃผ๊ณ , ๋งˆ์ง€๋ง‰์—๋Š” ์ด ์„œ๋ฒ„ ์ˆ˜์™€ online, offline์˜ ์ˆ˜๋ฅผ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค.
  • memcached listall

    • arcus zk๋‚ด์— ์žˆ๋Š” ๋ชจ๋“  ์„œ๋ฒ„ ๋ฆฌ์ŠคํŠธ๋ฅผ ์ถœ๋ ฅํ•ฉ๋‹ˆ๋‹ค.
    • ์ถœ๋ ฅ์€ serviceCode๋‹จ์œ„๋กœ ์ถœ๋ ฅํ•˜๋ฉฐ, serviceCode ์ด๋ฆ„, status(์„œ๋ฒ„๊ฐ€ ๋ชจ๋‘ ๊บผ์ ธ์žˆ์œผ๋ฉด DOWN, ์•„๋‹ˆ๋ฉด OK), total(์ด ์„œ๋ฒ„์ˆ˜), online, offline์„ ์ถœ๋ ฅํ•ฉ๋‹ˆ๋‹ค.

Copy link
Member

@namsic namsic left a comment

Choose a reason for hiding this comment

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

์ผ๋ถ€ ๋ฆฌ๋ทฐ
์กฐํšŒ ๋ช…๋ น์˜ ์ถœ๋ ฅ ๊ฒฐ๊ณผ ์˜ˆ์‹œ๋ฅผ PR ์„ค๋ช…์— ์ถ”๊ฐ€ํ•ด์ค„ ์ˆ˜ ์žˆ๋‚˜์š”?

Comment on lines 32 to 35
if len(serviceCodeServers) == 0 {
fmt.Printf("No servers found for service code '%s'.\n", serviceCode)
os.Exit(1)
}
Copy link
Member

Choose a reason for hiding this comment

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

acl list์™€ ๋งˆ์ฐฌ๊ฐ€์ง€๋กœ
์•„๋ž˜ Total ๋ณด์—ฌ์ฃผ๊ณ  ์žˆ์œผ๋ฏ€๋กœ ๋ณ„๋„๋กœ ์ฒ˜๋ฆฌํ•˜์ง€ ์•Š์•„๋„ ๋  ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

Comment on lines 29 to 37
serviceCodes, _, err := zkConn.Children(path.Join(internal.ArcusCacheListPath))
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}

var statuses []serviceStatus
for _, sc := range serviceCodes {
serviceCodeServers, _ := getServiceCodeServers(zkConn, sc)
Copy link
Member

Choose a reason for hiding this comment

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

cache_server_mapping์€ ์„œ๋น„์Šค์ฝ”๋“œ ๋‹จ์œ„๋กœ ๋””๋ ‰ํ† ๋ฆฌ๊ฐ€ ๋ถ„๋ฆฌ๋˜์–ด ์žˆ์ง€ ์•Š์œผ๋ฏ€๋กœ,
์–ด๋–ค ์„œ๋น„์Šค์ฝ”๋“œ๋ฅผ ์กฐํšŒํ•˜๋”๋ผ๋„ /arcus/cache_server_mapping์˜ ๋ชจ๋“  children์„ ํƒ์ƒ‰ํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.

ํ˜„์žฌ ๊ตฌํ˜„์—์„œ ์„œ๋น„์Šค์ฝ”๋“œ๊ฐ€ ๋งŽ์œผ๋ฉด ๊ฐ™์€ znode๋ฅผ ์„œ๋น„์Šค์ฝ”๋“œ ์ˆ˜๋งŒํผ ์ค‘๋ณต ์กฐํšŒํ•˜๊ณ , ZK์— ๋งŽ์€ ์—ฐ์‚ฐ์ด ๋ณด๋‚ด์ง€๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.

cache_server_mapping์„ ํƒ์ƒ‰ํ•˜๋ฉด์„œ map[string][]string ํ˜•ํƒœ์˜ ์„œ๋น„์Šค์ฝ”๋“œ + ๋…ธ๋“œ ๋ชฉ๋ก์„ ๋งŒ๋“ค์–ด ๋‘๋ฉด,
์—ฌ๋Ÿฌ ์„œ๋น„์Šค์ฝ”๋“œ์— ๋Œ€ํ•œ ์ •๋ณด ์กฐํšŒ ์‹œ ์žฌ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Comment on lines +66 to +88
command := fmt.Sprintf(memcachedStartCommandTemplate,
memcachedPath, memcachedPath, memcachedPath, memcachedPath, memcachedPath,
port, string(globalConfig), os.Getenv("ZK_ADDR"))

ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
defer cancel()
errChan := make(chan error, 1)
go func() {
errChan <- session.Run(command)
}()
select {
case err := <-errChan:
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
case <-ctx.Done():
continue
}
Copy link
Member

Choose a reason for hiding this comment

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

nohup ๋Œ€์‹  timeout ์‚ฌ์šฉํ•˜๊ธฐ๋กœ ํ•˜์˜€๋‚˜์š”?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

๋‘ ๋ฐฉ์•ˆ ๋ชจ๋‘ ๋ฌด๋ฐฉํ•˜๋‹ค๊ณ  ํ•˜์…”์„œ, ๊ธฐ์กด ๋ ˆ๊ฑฐ์‹œ์ฝ”๋“œ ๊ตฌํ˜„์„ ๊ทธ๋Œ€๋กœ ์œ ์ง€ํ•˜๊ณ ์ž timeout์œผ๋กœ ๊ตฌํ˜„ํ–ˆ์Šต๋‹ˆ๋‹ค.

@singsangssong
Copy link
Contributor Author

singsangssong commented Sep 19, 2025

list์™€ listall์˜ ์ถœ๋ ฅ๊ฒฐ๊ณผ์ž…๋‹ˆ๋‹ค.

ZK_ADDR="127.0.0.1:2181" ARCUS_PATH="~/arcus" USER="songseonghun" ./arcus-cli memcached list test              
  - 127.0.0.1:11211       offline
  - 10.0.0.1:11211        offline

Total: 2, Online: 0, Offline: 2


ZK_ADDR="127.0.0.1:2181" ARCUS_PATH="~/arcus" USER="songseonghun" ./arcus-cli memcached listall                
SERVICE CODE              STATUS       TOTAL    ONLINE   OFFLINE 
----------------------------------------------------------------------
test                      DOWN         2        0        2       

Comment on lines 46 to 51
status := "OK"
if len(serviceCodeServers) > 0 {
if onlineCnt == 0 {
status = "DOWN"
}
}
Copy link
Member

Choose a reason for hiding this comment

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

online / offline ์ •๋ณด์™€ ์ค‘๋ณต์ด๋ฏ€๋กœ, ๋ณ„๋„๋กœ ์ œ๊ณตํ•  ํ•„์š” ์—†์–ด ๋ณด์ž…๋‹ˆ๋‹ค.

์„œ๋ฒ„๊ฐ€ ๋ชจ๋‘ ๋–จ์–ด์ง„ ๊ฒฝ์šฐ์—๋งŒ DOWN์ด๊ณ  ๊ทธ ์™ธ์—๋Š” OK ์ฒ˜๋ฆฌํ•˜๊ณ  ์žˆ๋Š”๋ฐ,
์ด๋Ÿฌํ•œ ๊ตฌ๋ถ„ ๊ธฐ์ค€๋„ ๋ณ„๋„ ์„ค๋ช… ์—†์ด๋Š” ์ง๊ด€์ ์œผ๋กœ ํŒŒ์•…ํ•˜๊ธฐ ์–ด๋ ต์Šต๋‹ˆ๋‹ค.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

status๋ถ€๋ถ„์€ ์ œ๊ฑฐํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค. listall๋ช…๋ น์‹œ ์•„๋ž˜์™€ ๊ฐ™์ด ์‘๋‹ตํ•˜๋„๋ก ์ˆ˜์ •ํ–ˆ์Šต๋‹ˆ๋‹ค.

SERVICE CODE              TOTAL    ONLINE   OFFLINE 
------------------------------------------------------------
test                      2        0        2       

@singsangssong singsangssong force-pushed the task/memcached2 branch 2 times, most recently from 5f3b94f to 0585acb Compare September 23, 2025 05:14
@singsangssong
Copy link
Contributor Author

singsangssong commented Sep 23, 2025

memcached ์ถœ๋ ฅ

๊ธฐ์กด์— ๋‹จ์ผ serviceCode์˜ memcached ์„œ๋ฒ„๋ฅผ ์ถœ๋ ฅํ•˜๋Š” list๋ช…๋ น๊ณผ arcus zk๋‚ด์˜ ๋ชจ๋“  ์„œ๋ฒ„ ๋ฆฌ์ŠคํŠธ๋ฅผ ์ถœ๋ ฅํ•˜๋Š” listall๋ช…๋ น์„ ํ•ฉ์นฉ๋‹ˆ๋‹ค.

  • list [serviceCode] ๋ช…๋ น์œผ๋กœ ์ˆ˜ํ–‰ํ•˜๋ฉฐ, ์ธ์ž๊ฐ€ ์—†์„๊ฒฝ์šฐ์—๋Š” ๊ธฐ์กด listall์ฒ˜๋Ÿผ ๋™์ž‘ํ•˜๊ณ , ์ธ์ž๊ฐ€ ์žˆ์„ ๊ฒฝ์šฐ์—๋Š” ๋‹จ์ผ serviceCode๋ฅผ ์ถœ๋ ฅํ•˜๊ณ , ๊ทธ ์•„๋ž˜์— listall ๊ฒฐ๊ณผ๋ฅผ ์ถœ๋ ฅํ•ด์ค๋‹ˆ๋‹ค.

์ถœ๋ ฅ๊ฒฐ๊ณผ์˜ ์˜ˆ์‹œ๋Š” ์•„๋ž˜์™€ ๊ฐ™์Šต๋‹ˆ๋‹ค. ๊ธฐ๋ณธ์ ์œผ๋กœ ์ „์ฒด ๊ฒฐ๊ณผ์— ๊ด€ํ•ด์„œ ์ถœ๋ ฅํ•ด์ฃผ๊ณ , serviceCode ๋ช…๋ น ์ธ์ž๊ฐ€ ์žˆ๋‹ค๋ฉด ํ•ด๋‹น serviceCode์— ๋Œ€ํ•œ ๊ฒฐ๊ณผ๋ฅผ ์ถ”๊ฐ€๋กœ ์ถœ๋ ฅํ•ด์ค๋‹ˆ๋‹ค.

  • memcached list ์ถœ๋ ฅ ๊ฒฐ๊ณผ
$ ZK_ADDR="127.0.0.1:2181" ARCUS_PATH="~/arcus" ./arcus-cli memcached list 
SERVICE CODE              TOTAL    ONLINE   OFFLINE 
------------------------------------------------------------
test                      2        0        2       
  • memcached list [serviceCode] ์ถœ๋ ฅ ๊ฒฐ๊ณผ
$ ZK_ADDR="127.0.0.1:2181" ARCUS_PATH="~/arcus" ./arcus-cli memcached list test                     
Servers in service code 'test':
  - 127.0.0.1:11211       offline
  - 10.0.0.1:11211        offline

SERVICE CODE              TOTAL    ONLINE   OFFLINE 
------------------------------------------------------------
test                      2        0        2       

Copy link
Member

@namsic namsic left a comment

Choose a reason for hiding this comment

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

์šฐ์„  ์ด๋Œ€๋กœ ๋ฐ˜์˜ํ•˜๊ณ , ๋‚˜์ค‘์— ์ผ๋ถ€ ๊ตฌํ˜„ ๋ฆฌํŒฉํ† ๋ง ํ•ด๋‘๊ฒ ์Šต๋‹ˆ๋‹ค.

@namsic namsic merged commit 9f23d9b into develop Sep 23, 2025
1 check passed
@singsangssong singsangssong deleted the task/memcached2 branch September 23, 2025 05:42
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