teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

3

キャンセル

2021/09/09 06:07

投稿

tamahimesama_23
tamahimesama_23

スコア31

title CHANGED
File without changes
body CHANGED
@@ -1,166 +1,1 @@
1
- ご覧いただきありがとうございます。
2
-
3
- VirtualBoxでCentOSのサーバーを3つ起動して、Elasticsearchのクラスタ構築を学んでおります。
4
-
5
- 3つのサーバーの個別起動では問題なく動いているのですが、同じく3つのサーバーをクラスタ構築すべく、
6
- `/etc/elasticsearch/elasticsearch.yml`を調整しても、必ず「master_not_discovered_exception」が発生します。
7
-
8
- この解決方法をお聞かだきたくぜひともよろくお願いいたします。
1
+ 大変申し訳ありまんが、情報不足のこの質問はキャンセルてクローズします。
9
-
10
- -------------------
11
-
12
- ## 使用環境(FW/ツールのバージョンなど)
13
- ● Oracle VritualBox 6.1.22
14
- ● ゲストOS = CentOS 7.6
15
- ● VritualBoxのCentOSのホスト = 3つ
16
- (CentOSのホストを1個作ってElasticsearchのインストールと設定後、
17
- Virtualboxのクローンを2つ作りました)
18
-
19
-
20
- -------------------
21
- ### 実現したいこと&前提
22
- ホスト3つのうち、マスタを1つ、スレーブを2つ作るのが目的です。
23
-
24
- ```
25
- 192.168.XX.101:9200 //←マスタ node-1とする XXの実際は、2桁の整数
26
- 192.168.XX.102:9200 //←マスタ node-2とする XXの実際は、2桁の整数
27
- 192.168.XX.103:9200 //←マスタ node-3とする XXの実際は、2桁の整数
28
- ```
29
-
30
- `node-1,2,3`同士で`Pingコマンド`で相互に通信できていることを確認しました
31
-
32
- -------------------
33
-
34
- ## 今回発生している問題・エラーメッセージ
35
-
36
- 3つのサーバーの個別起動では問題なく動いているのを確認しました。
37
-
38
- 同じく3つのサーバーをクラスタ構築すべく、`/etc/elasticsearch/elasticsearch.yml`
39
- を調整しても、必ず「`master_not_discovered_exception`」が発生します。
40
-
41
- 「`GET /_cluster/health`」や「`GET /_cat/nodes`」でクラスタ状態を確認しようとしても、
42
- 1分程度沈黙した後に下記のエラーが発生します。
43
-
44
- このエラーは3つのサーバーともに発生します。
45
-
46
-
47
- ``` shell
48
- $ curl localhost:9200/_cluster/health?pretty
49
- {
50
- "error" : {
51
- "root_cause" : [
52
- {
53
- "type" : "master_not_discovered_exception",
54
- "reason" : null
55
- }
56
- ],
57
- "type" : "master_not_discovered_exception",
58
- "reason" : null
59
- },
60
- "status" : 503
61
- }
62
- ```
63
-
64
-
65
-
66
- -------------------
67
-
68
- ## 該当のソースコード
69
- 以下3サーバーそれぞれの「`/etc/elasticsearch/elasticsearch.yml`」の内容です。
70
- それぞれGrepコマンドで「#(コメント)」が入っていない行を抽出したものです。
71
-
72
- ```
73
- $ grep -v '^#' /etc/elasticsearch/elasticsearch.yml
74
- ```
75
-
76
-
77
- ### `192.168.XX.101`サーバー(マスタ)の elasticsearch.ymlです。
78
-
79
-
80
- ``` shell
81
- cluster.name: my-application
82
- node.name: node-1
83
- path.data: /var/lib/elasticsearch
84
- path.logs: /var/log/elasticsearch
85
- network.host: 0.0.0.0
86
- http.port: 9200
87
-
88
- discovery.seed_hosts:
89
- - "192.168.XX.101"
90
- - "192.168.XX.102"
91
- - "192.168.XX.103"
92
- cluster.initial_master_nodes:
93
- - "192.168.XX.101"
94
- - "192.168.XX.102"
95
- - "192.168.XX.103"
96
-
97
- ```
98
-
99
-
100
- ### `192.168.XX.102`サーバー(スレーブ1)の elasticsearch.ymlです。
101
-
102
- ``` shell
103
- cluster.name: my-application
104
- node.name: node-2
105
- path.data: /var/lib/elasticsearch
106
- path.logs: /var/log/elasticsearch
107
- network.host: 0.0.0.0
108
- http.port: 9200
109
-
110
- discovery.seed_hosts:
111
- - "192.168.XX.101"
112
- - "192.168.XX.102"
113
- - "192.168.XX.103"
114
- cluster.initial_master_nodes:
115
- - "192.168.XX.101"
116
- # - "192.168.XX.102"
117
- # - "192.168.XX.103"
118
-
119
- ```
120
-
121
-
122
- ### `192.168.XX.103`サーバー(スレーブ2)の elasticsearch.ymlです。
123
-
124
- ``` shell
125
- cluster.name: my-application
126
- node.name: node-3
127
- path.data: /var/lib/elasticsearch
128
- path.logs: /var/log/elasticsearch
129
- network.host: 0.0.0.0
130
- http.port: 9200
131
-
132
- discovery.seed_hosts:
133
- - "192.168.XX.101"
134
- - "192.168.XX.102"
135
- - "192.168.XX.103"
136
- cluster.initial_master_nodes:
137
- - "192.168.XX.101"
138
- # - "192.168.XX.102"
139
- # - "192.168.XX.103"
140
-
141
- ```
142
-
143
- -------------------
144
-
145
- ## 試したこと
146
- 3つのサーバーで下記同じ処置を行いました
147
- - 「`systemctl stop elasticsearch`」で、一度elasticsearchを停止
148
- - 「`/var/lib/elasticsearch`」フォルダの下のディレクトリやファイルをすべて消去
149
- - 「`systemctl start elasticsearch`」で再起動
150
-
151
-
152
- -------------------
153
-
154
-
155
- ## 参考にしている資料
156
- ① Elastic Stack 7 : Elasticsearch クラスターを構成する
157
- https://www.server-world.info/query?os=CentOS_7&p=elasticstack7&f=2
158
-
159
- ② Elasticsearchクラスタ環境を構築する
160
- https://qiita.com/mkyz08/items/583c5d731a308fa89723
161
-
162
- ③ Elasticsearchでクラスタを構成してみる(Settings-based seed hosts provider利用)
163
- https://kazuhira-r.hatenablog.com/entry/2019/11/17/234315
164
-
165
-
166
- 以上となります。

2

修正

2021/09/09 06:07

投稿

tamahimesama_23
tamahimesama_23

スコア31

title CHANGED
File without changes
body CHANGED
@@ -7,6 +7,7 @@
7
7
 
8
8
  この解決方法をお聞かせいただきたく、ぜひともよろしくお願いいたします。
9
9
 
10
+ -------------------
10
11
 
11
12
  ## 使用環境(FW/ツールのバージョンなど)
12
13
  ● Oracle VritualBox 6.1.22

1

修正

2021/07/28 17:20

投稿

tamahimesama_23
tamahimesama_23

スコア31

title CHANGED
File without changes
body CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  ## 使用環境(FW/ツールのバージョンなど)
12
12
  ● Oracle VritualBox 6.1.22
13
- ● ゲストOS = CentOS 7.6 (Green Obsidian)
13
+ ● ゲストOS = CentOS 7.6
14
14
  ● VritualBoxのCentOSのホスト = 3つ
15
15
  (CentOSのホストを1個作ってElasticsearchのインストールと設定後、
16
16
  Virtualboxのクローンを2つ作りました)
@@ -146,6 +146,8 @@
146
146
  - 「`systemctl stop elasticsearch`」で、一度elasticsearchを停止
147
147
  - 「`/var/lib/elasticsearch`」フォルダの下のディレクトリやファイルをすべて消去
148
148
  - 「`systemctl start elasticsearch`」で再起動
149
+
150
+
149
151
  -------------------
150
152
 
151
153