ElasticSearch シリーズ --- [デフォルト以外のポートで構成される Linux オフライン インストール elasticsearch7.8 クラスター]

デフォルト以外のポートで構成される Linux オフライン インストール elasticsearch7.8 クラスター

事前環境設定、ESユーザーの作成、パッケージのダウンロード

参照してください: https://www.cnblogs.com/hujunwei/p/17481718.html

計画

192.168.1.90(A) と 192.168.1.101(B) は 2 つの仮想マシンです。サーバー A にポート (9400, 9401) と (9600, 9601) を使用して 2 つの es インスタンスをデプロイし、サーバー B にポート (9500, 9501) を使用して 1 つの es インスタンスをデプロイすることが計画されています。前者は外部クエリ用のポートで、後者は内部クエリ用のポートです。クラスターの通信ポート。

マスターノード設定ファイル

cluster.name: cluster-es
#节点名称, 每个节点的名称不能重复
node.name: node-1
#ip 地址, 每个节点的地址不能重复
network.host: 0.0.0.0
#是不是有资格主节点
node.master: true
node.data: true
http.port: 9400
# head 插件需要这打开这两个配置
http.cors.allow-origin: "*"
http.cors.enabled: true
http.max_content_length: 200mb
#es7.x 之后新增的配置,初始化一个新的集群时需要此配置来选举 master
transport.tcp.port: 9401
cluster.initial_master_nodes: ["node-1"]
#es7.x 之后新增的配置,节点发现,默认端口9300,可以省略,若修改,请和transport.tcp.port的值保持一致
discovery.seed_hosts: ["192.168.1.90:9401","192.168.1.101:9501","192.168.1.90:9601"]
gateway.recover_after_nodes: 2
network.tcp.keep_alive: true
network.tcp.no_delay: true
transport.tcp.compress: true
#集群内同时启动的数据任务个数,默认是 2 个
cluster.routing.allocation.cluster_concurrent_rebalance: 16
#添加或删除节点及负载均衡时并发恢复的线程个数,默认 4 个
cluster.routing.allocation.node_concurrent_recoveries: 16
#初始化数据恢复时,并发恢复线程的个数,默认 4 个
cluster.routing.allocation.node_initial_primaries_recoveries: 16

スレーブノードのnode-2設定ファイル

cluster.name: cluster-es
#节点名称, 每个节点的名称不能重复
node.name: node-2
#ip 地址, 每个节点的地址不能重复
network.host: 0.0.0.0
#是不是有资格主节点
node.master: true
node.data: true
http.port: 9500
# head 插件需要这打开这两个配置
http.cors.allow-origin: "*"
http.cors.enabled: true
http.max_content_length: 200mb
#es7.x 之后新增的配置,初始化一个新的集群时需要此配置来选举 master
transport.tcp.port: 9501
cluster.initial_master_nodes: ["node-1"]
#es7.x 之后新增的配置,节点发现,默认端口9300,可以省略,若修改,请和transport.tcp.port的值保持一致
discovery.seed_hosts: ["192.168.1.90:9401","192.168.1.101:9501","192.168.1.90:9601"]
gateway.recover_after_nodes: 2
network.tcp.keep_alive: true
network.tcp.no_delay: true
transport.tcp.compress: true
#集群内同时启动的数据任务个数,默认是 2 个
cluster.routing.allocation.cluster_concurrent_rebalance: 16
#添加或删除节点及负载均衡时并发恢复的线程个数,默认 4 个
cluster.routing.allocation.node_concurrent_recoveries: 16
#初始化数据恢复时,并发恢复线程的个数,默认 4 个
cluster.routing.allocation.node_initial_primaries_recoveries: 16

スレーブノードのnode-3設定ファイル

cluster.name: cluster-es
#节点名称, 每个节点的名称不能重复
node.name: node-3
#ip 地址, 每个节点的地址不能重复
network.host: 0.0.0.0
#是不是有资格主节点
node.master: true
node.data: true
http.port: 9600
# head 插件需要这打开这两个配置
http.cors.allow-origin: "*"
http.cors.enabled: true
http.max_content_length: 200mb
#es7.x 之后新增的配置,初始化一个新的集群时需要此配置来选举 master
transport.tcp.port: 9601
cluster.initial_master_nodes: ["node-1"]
#es7.x 之后新增的配置,节点发现,默认端口9300,可以省略,若修改,请和transport.tcp.port的值保持一致
discovery.seed_hosts: ["192.168.1.90:9401","192.168.1.101:9501","192.168.1.90:9601"]
gateway.recover_after_nodes: 2
network.tcp.keep_alive: true
network.tcp.no_delay: true
transport.tcp.compress: true
#集群内同时启动的数据任务个数,默认是 2 个
cluster.routing.allocation.cluster_concurrent_rebalance: 16
#添加或删除节点及负载均衡时并发恢复的线程个数,默认 4 个
cluster.routing.allocation.node_concurrent_recoveries: 16
#初始化数据恢复时,并发恢复线程的个数,默认 4 个
cluster.routing.allocation.node_initial_primaries_recoveries: 16

es起動コマンド

#注意:第一次启动不了的话,再次启动先删除data目录和logs下的日志,再启动
./elasticsearch -d

ブラウザ認証アドレス

http://192.168.1.90:9400/_cat/nodes

次の図は、クラスターが構築されたことを示しています

おすすめ

転載: blog.csdn.net/weixin_44988127/article/details/131428720