-
Notifications
You must be signed in to change notification settings - Fork 0
FEATURE: Add 'zookeeper start|stop|stat' command to manage zk ensemble #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
์ถ๊ฐ์ ์ธ ์ฝ๋ฉํธ์ด์ ์ง๋ฌธ์ผ๋ก, ํ์ฌ ๊ตฌํ์ผ๋ก๋ ์๊ฒฉ ์๋ฒ์์ ํด๋น ์์ธ์ ์ดํด๋ณธ ๊ฒฐ๊ณผ, ํด๋ฌ์คํฐ๋ก ์ค์ ๋ ํ๊ฒฝ์์๋ myid ํ์ผ ๋ถ์ฌ๋ ์ด์ |
zookeeper init์์ ์๋ ์์ ๋ง ์ํํ๋ฉด ๋ ๊ฒ ๊ฐ์ต๋๋ค.
๊ธฐ์กด์ arcus.sh์์
์ด์ ์ |
namsic
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ํ๊ฒฝ๋ณ์ ๊ด๋ จ ๋์์ ๋จผ์ ์ ๋ฆฌํ๊ณ ๊ทธ ๊ธฐ์ค์ ๋ง์ถฐ ๋๋จธ์ง PR์ ๋ค์ ๋ณด๋ ๊ฒ์ด ์ข๊ฒ ์ต๋๋ค.
cmd/zookeeper/start.go
Outdated
| zkAddress := os.Getenv("ZK_ADDR") | ||
| ip := strings.Split(zkAddress, ":")[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ZK_ADDR์ด ํ ๊ฐ ์๋ฒ์ ๋ํ ์ฃผ์๋ง ๊ฐ๋๋ค๋ ๊ฒ์ ๋ช
ํํ ๋๋ฌ๋ด์ผ ํฉ๋๋ค.
ZK_ADDR ์ด๋ฉด ์บ์ ์๋ฒ์ -z ์ธ์๋ก ์ ๋ฌํ๋ ์ฃผ์๋ฅผ ์๋ฏธํ๋ ๊ฒ์ผ๋ก ๋ฐ์๋ค์ฌ์ง ์ ์๊ณ ,
์ด ๊ฐ์ ,๋ก ์ฐ๊ฒฐ๋ ์๋ฒ ๋ชฉ๋ก์ด๊ฑฐ๋, ์ฌ๋ฌ ์๋ฒ๋ค์ ๋ฌถ์ ๋๋ฉ์ธ(zkservers.example.com:2181)์ผ ์ ์์ต๋๋ค.
cmd/zookeeper/start.go
Outdated
| client, err := internal.NewSSHClient(ip) | ||
| if err != nil { | ||
| fmt.Fprintln(os.Stderr, err) | ||
| os.Exit(1) | ||
| } | ||
| session, err := client.NewSession() | ||
| if err != nil { | ||
| fmt.Fprintln(os.Stderr, err) | ||
| os.Exit(1) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SSHClient ์์ฑํ๊ณ Session ์์ด ์ฌ์ฉํ๋ ๊ฒฝ์ฐ๊ฐ ์๋์?
์๋ค๋ฉด ์ธ์
์์ฑ๊น์ง internal์์ ์ฒ๋ฆฌํ๋ ๊ฒ์ด ๋ซ๊ฒ ์ต๋๋ค.
์ถ๊ฐ๋ก, ์์ฑํ client๋ session์ closeํ์ง ์์๋ ๋๋์?
cmd/zookeeper/stat.go
Outdated
| command := fmt.Sprintf(zookeeperStatCommandTemplate, port) | ||
| client, err := internal.NewSSHClient(ip) | ||
| if err != nil { | ||
| fmt.Fprintln(os.Stderr, err) | ||
| os.Exit(1) | ||
| } | ||
| session, err := client.NewSession() | ||
| if err != nil { | ||
| fmt.Fprintln(os.Stderr, err) | ||
| os.Exit(1) | ||
| } | ||
| output, err := session.Output(command) | ||
| if err != nil { | ||
| fmt.Fprintln(os.Stderr, err) | ||
| os.Exit(1) | ||
| } | ||
| fmt.Println(string(output)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- ssh๋ก ์ฐ๊ฒฐํ์ฌ localhost๋ก ๋ค์ ์์ฒญ์ ๋ณด๋ด๋ ๊ฒ์ด ์๋๋ผ,
ip:port๋ก ๋ฐ๋ก stat ๋ช ๋ น์ ๋ณด๋ด๋ฉด ๋ฉ๋๋ค. - ์บ์ ์ฅ๋น์
nc๊ฐ ์ค์น๋์ด ์์ง ์์ ๊ฒฝ์ฐ๊ฐ ๋ค์ ์์ต๋๋ค.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๊ฐ zk์๋ฒ ์ฃผ์์ tcp ์ฐ๊ฒฐ์ ๋งบ๊ณ , stat๋ช
๋ น์ ์์ฒญํ๊ฒ ์ต๋๋ค.
|
ํ์ฌ memcached์ zookeeper( ์์ ๋ ์ฝ๋์์๋ |
f54ccc4 to
5c91642
Compare
|
์ ์ด์์์ ์ ์ธํ ์ธํฐํ์ด์ค๋ก ์ค๊ณ๊ฐ ๋ณ๊ฒฝ๋์์ต๋๋ค. ์ด์ ๋ช ๋ นํ ์ธํฐํ์ด์ค์ ๊ดํ PR์ด๋ฏ๋ก ํด๋น PR์ ๋ซ๊ฒ ์ต๋๋ค. |
๐ Related Issue
โจ๏ธ What I did
์ด์
arcus.sh์zookeeper a | stop | stat๊ธฐ๋ฅ์ arcus-cli์์๋ ๋์ํ๋๋ก ํฉ๋๋ค.3๊ฐ์ง ๋ช ๋ น ๋ชจ๋ ํ๊ฒฝ๋ณ์(
ZK_PATH)๋ฅผ ํตํด zookeeper์ ๊ฒฝ๋ก๋ฅผ ๊ฒฐ์ ํ๋๋ก ํฉ๋๋ค.zookeeper startZK_ADDR)์ zookeeper ์๋ฒ๋ฅผ ๊ตฌ๋ํฉ๋๋ค.zkServer.sh start๋ช ๋ น์ ์ํํฉ๋๋ค.zookeeper stopZK_ADDR)์ zookeeper ์๋ฒ๋ฅผ ์ค์งํฉ๋๋ค.zkServer.sh stop๋ช ๋ น์ ์ํํฉ๋๋ค.zookeeper statZK_ADDR)์ zookeeper ์ํ๋ฅผ ์กฐํํฉ๋๋ค.echo stat | nc localhost <port>๋ช ๋ น์ ์ํํฉ๋๋ค.