LoginSignup
7
7

More than 5 years have passed since last update.

Consul 0.2.1から0.3.1へのバージョンアップ

Last updated at Posted at 2014-07-22

Consul-0.3では大きくパフォーマンスが向上しているとのことなので、(参考: About Consul ~In Depth~) 手元の 0.2.1 クラスタを 0.3.1 に上げるための事前検証。

公式のドキュメントによれば… Upgrading Consul - Consul

  • サーバ群を全て新しいバージョンに更新して停止、再起動
  • その後クライアント(agent node)も同様に新バージョンに更新

で完了するとのことです。

まず、サーバ3台、クライアント1台の環境を用意して KVS に値を入れておきます。(consul4 がクライアント)

[consul4]$ consul members
consul4  192.168.0.14:8301  alive  role=node,dc=dc1,vsn=1,vsn_min=1,vsn_max=1
consul1  192.168.0.11:8301  alive  role=consul,dc=dc1,vsn=1,vsn_min=1,vsn_max=1,port=8300,bootstrap=1
consul3  192.168.0.13:8301  alive  role=consul,dc=dc1,vsn=1,vsn_min=1,vsn_max=1,port=8300
consul2  192.168.0.12:8301  alive  role=consul,dc=dc1,vsn=1,vsn_min=1,vsn_max=1,port=8300

[consul4]$ curl -X PUT --data-binary "foobar" localhost:8500/v1/kv/foo
true
[consul4]$ curl localhost:8500/v1/kv/foo
[{"CreateIndex":19,"ModifyIndex":24,"Key":"foo","Flags":0,"Value":"Zm9vYmFy"}]

consul1をバージョンアップ(停止後、バイナリ入れ替え)して起動

[consul4]$ consul members
consul4  192.168.0.14:8301  alive  role=node,dc=dc1,vsn=1,vsn_min=1,vsn_max=1
consul1  192.168.0.11:8301  alive  role=consul,dc=dc1,vsn=2,vsn_min=1,vsn_max=2,build=0.3.1:,port=8300
consul2  192.168.0.12:8301  alive  role=consul,dc=dc1,vsn=1,vsn_min=1,vsn_max=1,port=8300
consul3  192.168.0.13:8301  alive  role=consul,dc=dc1,vsn=1,vsn_min=1,vsn_max=1,port=8300

順番に、consul2, 3 もバージョンアップして再起動

[consul4]$ consul members
consul4  192.168.0.14:8301  alive  role=node,dc=dc1,vsn=1,vsn_min=1,vsn_max=1
consul1  192.168.0.11:8301  alive  role=consul,dc=dc1,vsn=2,vsn_min=1,vsn_max=2,build=0.3.1:,port=8300
consul2  192.168.0.12:8301  alive  role=consul,dc=dc1,vsn=2,vsn_min=1,vsn_max=2,build=0.3.1:,port=8300
consul3  192.168.0.13:8301  alive  port=8300,role=consul,dc=dc1,vsn=2,vsn_min=1,vsn_max=2,build=0.3.1:

最後に consul4 をバージョンアップして再起動

[consul4]$ consul members
Node     Address            Status  Type    Build  Protocol
consul4  192.168.0.14:8301  alive   client  0.3.1  2
consul1  192.168.0.11:8301  alive   server  0.3.1  2
consul2  192.168.0.12:8301  alive   server  0.3.1  2
consul3  192.168.0.13:8301  alive   server  0.3.1  2

consul members の出力結果が変わりましたが、これで全て更新完了。

サーバを入れ替えつつKVSの値を継続的に取得してモニタリングしたところ、leaderがいなくなって新leaderが選出されるタイミングで1,2秒程度取得できない (rpc error: No cluster leader) 現象は出るものの、データを失うことなくローリングアップデートできました。

7
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
7