13. (C) Recruit Technologies Co., Ltd. All rights reserved.
13
【参考】Masterノードが配布するCluster Stateとは
Clusterの状態や実行中のtask(例:snapshot作成など)の情報となり、クラスタ内の管理対象のノード数が
増加に比例して管理する情報量は増える傾向にある。※100台でも8GBあれば全然足りるレベル
5ノードで19KB程度の大きさ
【参考】 Cluster State
https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-state.html
14. (C) Recruit Technologies Co., Ltd. All rights reserved.
14
AZってa、c、dって3つあるけど、az1、az2、az4というAZ IDを意識してますか??
ちなみにAZ間の伝送遅延って気にしたことありますか?
【AZ-d → AZ-c】
・rtt min/avg/max/mdev = 0.870/1.089/4.994/0.423 ms
【AZ-c → AZ-d】
・rtt min/avg/max/mdev = 0.896/1.147/5.743/0.637 ms【AZ-a → AZ-d】
・rtt min/avg/max/mdev = 1.701/1.879/10.195/0.677 ms
【AZ-d → AZ-a】
・rtt min/avg/max/mdev = 1.696/1.816/4.049/0.258 ms
【AZ-c → AZ-a】
・rtt min/avg/max/mdev = 2.530/2.786/21.981/1.376 ms
【AZ-a → AZ-c】
・rtt min/avg/max/mdev = 2.551/2.681/3.926/0.202 ms
倍以上
15. (C) Recruit Technologies Co., Ltd. All rights reserved.
15
物理的なデータセンターの位置から考えてみる
ご存知の方も多いと思いますが、AWSが運用するデータセンターの位置から考えると...
こういうことなのか...?
16. (C) Recruit Technologies Co., Ltd. All rights reserved.
16
ということで、「可用性・信頼性・拡張性」を考えるとこんな感じになった
Availability zone 1
(apne-az1)
AWS Region @ap-nourtheast-1
Availability zone 2
(apne-az2)
Availability zone 4
(apne-az4)
r5.large
(Master-eligible)
r5.large
(Master-eligible)
r5.large
(Master)
i3.2xlarge
(Data)
i3.2xlarge
(Data)
i3.2xlarge
(Data)
i3.2xlarge
(Data)
Elasticsearch Cluster
1msec2msec
1msec
3msec
Elasticsearch
Kibana
Logstash
【凡例】
Target group
・・・
・・・
P
RR
P
Scale Out
Scale Out
【Masterノード(eligible含む)】
・AZ障害時のクォーラム維持のため、3つのAZに分散配置
【Dataノード】
・AZ障害時のデータ保全のため、Primary ShardとReplica ShardをAZごとに分散配置
(AZ間の伝送遅延の少ないaz1とaz2で配置するのがポイント!!)
17. (C) Recruit Technologies Co., Ltd. All rights reserved.
17
運用性や運用コストも規模が大きいと気になるポイント
ElasticStackの設定変更、バージョンアップやノード追加等の構成変更にもリポジトリへのpushで
AMI
Instance
Event
(event-based)
Rule Topic
CodeBuild
ContainerSysOpe
①git push ②Trigger AMI Build ③Assign AMI task
④Install & Run Packer
⑤Launches temp EC2
⑥OS Config & Hardening
⑦Create a new AMI
⑧Notify AMI Build⑨Triggers CWE Rule
18. (C) Recruit Technologies Co., Ltd. All rights reserved.
18
しかし、ElasticsearchのNodeID重複問題
Elasticsearchはインストール後の初回起動時にUUIDからNode固有のIDを自動的に採番する。
セットアップ完了後のElasticsearchをAMI化して、AMIからデプロイしてもID重複でクラスタに参加できない。
[2019-02-02T20:51:28,290][INFO ][o.e.d.z.ZenDiscovery] [ip-172-31-45-213.ap-northeast-1.compute.internal] failed to send join request to master [{ip-172-
31-23-102.ap-northeast-
1.compute.internal}{qbr7eEEtRvSxBfr04UpZnA}{cWhb4V6QTfeDZ5QTg2cuww}{172.31.23.102}{172.31.23.102:9300}{aws_availability_zone=ap-northeast-
1c, ml.machine_memory=32657526784, ml.max_open_jobs=20, xpack.installed=true, ml.enabled=true}], reason [RemoteTransportException[[ip-172-31-23-
102.ap-northeast-1.compute.internal][172.31.23.102:9300][internal:discovery/zen/join]]; nested: IllegalArgumentException[can't add node {ip-172-31-45-
213.ap-northeast-
1.compute.internal}{6t_7UYxSRSOcVo4LslAi5w}{2AXoOZ35RKGgHfpjAZMo4A}{172.31.45.213}{172.31.45.213:9300}{aws_availability_zone=ap-northeast-1d,
ml.machine_memory=32657526784, ml.max_open_jobs=20, xpack.installed=true, ml.enabled=true}, found existing node {ip-172-31-8-191.ap-northeast-
1.compute.internal}{6t_7UYxSRSOcVo4LslAi5w}{ZQXuCv3oTsa57t7zgUWnEg}{172.31.8.191}{172.31.8.191:9300}{aws_availability_zone=ap-northeast-1a,
ml.machine_memory=32657526784, ml.max_open_jobs=20, xpack.installed=true, ml.enabled=true} with the same id but is a different node instance]; ]
【ID重複時のelasticsearch.logのエラー内容】
【参考】 node.name (node.id採番ルール)
https://www.elastic.co/guide/en/elasticsearch/reference/6.6/node.name.html
上記ログより、3台のElasticsearchノードのIPアドレスとnode.idは以下の通りとなっている。①と③が重複(6t_7Uから始まるID)していて、①をAMI化したものから③を展開している。
① 172.31.8.191 1 {6t_7UYxSRSOcVo4LslAi5w}
② 172.31.23.102 2 {qbr7eEEtRvSxBfr04UpZnA}
③ 172.31.45.213 3 {6t_7UYxSRSOcVo4LslAi5w}
[root@ip-172-31-45-213 ~]# cat /var/lib/elasticsearch/nodes/0/_state/node-xx.st
?lstate:)
node_idU6t_7UYxSRSOcVo4LslAi5w(,%
【node.id 格納場所】