ElasticSearchは、コールドアーキテクチャとホットアーキテクチャのクラスターを構築します(5ユニット)
準備および構成ファイル
5つのESインストールパッケージを準備します(Linux環境)
1.ES9300:
#es会自动发现在同一网段下的es,所有节点都要填他
cluster.name: test
#节点名称,要唯一
node.name: test01
node.master: true
node.data: true
#节点的ip,填了这个也可以使用外网访问
network.host: 192.168.135.237
http.port: 9201
transport.tcp.port: 9301
#集群的ip+端口
discovery.zen.ping.unicast.hosts: ["192.168.135.237:9301","192.168.135.237:9302", "192.168.135.237:9303","192.168.135.237:9304","192.168.135.237:9305"]
discovery.zen.minimum_master_nodes: 1
node.attr.temperature: hot
2.ES9301:
#es会自动发现在同一网段下的es,所有节点都要填他
cluster.name: test
#节点名称,要唯一
node.name: test02
node.master: false
node.data: true
#节点的ip,填了这个也可以使用外网访问
network.host: 192.168.135.237
http.port: 9202
transport.tcp.port: 9302
#集群的ip+端口
discovery.zen.ping.unicast.hosts: ["192.168.135.237:9301","192.168.135.237:9302", "192.168.135.237:9303","192.168.135.237:9304","192.168.135.237:9305"]
discovery.zen.minimum_master_nodes: 1
node.attr.temperature: warm
3.ES9302:
#es会自动发现在同一网段下的es,所有节点都要填他
cluster.name: test
#节点名称,要唯一
node.name: test03
node.master: false
node.data: true
#节点的ip,填了这个也可以使用外网访问
network.host: 192.168.135.237
http.port: 9203
transport.tcp.port: 9303
#集群的ip+端口
discovery.zen.ping.unicast.hosts: ["192.168.135.237:9301","192.168.135.237:9302", "192.168.135.237:9303","192.168.135.237:9304","192.168.135.237:9305"]
discovery.zen.minimum_master_nodes: 1
node.attr.temperature: warm
4.ES9303:
#es会自动发现在同一网段下的es,所有节点都要填他
cluster.name: test
#节点名称,要唯一
node.name: test04
node.master: false
node.data: true
#节点的ip,填了这个也可以使用外网访问
network.host: 192.168.135.237
http.port: 9204
transport.tcp.port: 9304
#集群的ip+端口
discovery.zen.ping.unicast.hosts: ["192.168.135.237:9301","192.168.135.237:9302", "192.168.135.237:9303","192.168.135.237:9304","192.168.135.237:9305"]
discovery.zen.minimum_master_nodes: 1
node.attr.temperature: hot
5.ES9304
#es会自动发现在同一网段下的es,所有节点都要填他
cluster.name: test
#节点名称,要唯一
node.name: test05
node.master: false
node.data: true
#节点的ip,填了这个也可以使用外网访问
network.host: 192.168.135.237
http.port: 9205
transport.tcp.port: 9305
#集群的ip+端口
discovery.zen.ping.unicast.hosts: ["192.168.135.237:9301","192.168.135.237:9302", "192.168.135.237:9303","192.168.135.237:9304","192.168.135.237:9305"]
discovery.zen.minimum_master_nodes: 1
node.attr.temperature: hot
全体的な構成の概要:
ホットジャンクション:test01,04,05
コールドジャンクション:test02,03
クラスタースクリプトの開始と停止
起動スクリプト
以前のパスを独自のインストールパスに置き換えるだけです。これがバックグラウンドスタートアップです
#!/bin/bash
/opt/local_software/elasticsearch/es9300/bin/elasticsearch -d -p pid
/opt/local_software/elasticsearch/es9301/bin/elasticsearch -d -p pid
/opt/local_software/elasticsearch/es9302/bin/elasticsearch -d -p pid
/opt/local_software/elasticsearch/es9303/bin/elasticsearch -d -p pid
/opt/local_software/elasticsearch/es9304/bin/elasticsearch -d -p pid
スクリプトを停止します
#!/bin/bash
ps -aux | grep elasticsearch | grep -v grep | awk '{print $2}' | xargs kill -9
クラスタステータスを確認する
1.アドレスバーに入力します。
http://192.168.135.237:9201/_cat/health?v
以下を表示でき
ます。2。kibanaを入力します(kibanaはクラスター構成をサポートしていません。マスターノードtest01に
構成するだけです):kibanaを構成するには、2つの項目を変更するだけで、他の項目を変更する必要はありません。
server.host: "192.168.135.237"
# Enables you to specify a path to mount Kibana at if you are running behind a proxy. This only affects
# the URLs generated by Kibana, your proxy is expected to remove the basePath value before forwarding requests
# to Kibana. This setting cannot end in a slash.
#server.basePath: ""
# The maximum payload size in bytes for incoming server requests.
#server.maxPayloadBytes: 1048576
# The Kibana server's name. This is used for display purposes.
#server.name: "your-hostname"
# The URL of the Elasticsearch instance to use for all your queries.
elasticsearch.url: "http://192.168.135.237:9201"
ページにアクセス:
http://192.168.135.237:5601/
開発ツールモジュールに入る
GET _cat/nodeattrs?v&h=node,attr,value&s=attr:desc
検証が完了しました
。クラスターのテストについては、次の記事を確認してください。
コールドセパレーションとホットセパレーションの原理と実際の戦闘