ElasticSearchの詳細な説明-ヘッドビルディングesクラスター構成ファイル

Elasticsearch.yml構成ファイルの詳細な説明:

構成名 説明する
cluster.name esのクラスター名を構成します。デフォルトはelasticsearchです。esは同じネットワークセグメントの下にあるesを自動的に検出します。同じネットワークセグメントの下に複数のクラスターがある場合は、この属性を使用して異なるクラスターを区別できます。
node.name デフォルトでは、ノード名は名前リストにランダムに名前を割り当てます。リストはesのjarパッケージのconfigフォルダーにあるname.txtファイルにあり、作成者によって追加された興味深い名前が多数あります。
node.master ノードがマスターとして選出される資格があるかどうかを指定します。デフォルトはtrueであり、esはデフォルトクラスター内のマスターとしての最初のマシンです。このマシンがハングすると、マスターが再選出されます。
node.data ノードがインデックスデータを保存するかどうかを指定します。デフォルトはtrueです。
index.number_of_shards インデックスシャードのデフォルト数を設定します。デフォルトは5です。
index.number_of_replicas インデックスレプリカのデフォルト数を設定します。デフォルトは1レプリカです。
network.bind_host バインドされたIPアドレスを設定します。これはipv4またはipv6で、デフォルトは0.0.0.0です。
network.publish_host このノードと相互作用する他のノードのIPアドレスを設定します。設定されていない場合は、自動的に判断されます。値は実際のIPアドレスである必要があります。
network.host このパラメーターは、bind_hostとpublish_hostの上記の2つのパラメーターを同時に設定するために使用されます。
Transportation.tcp.compress tcp送信中にデータを圧縮するかどうかを設定します。デフォルトはfalseで、圧縮はありません。
Transportation.tcp.port ノード間の相互作用のためにtcpポートを設定します。デフォルトは9300です。
http.port 外部サービスのhttpポートを設定します。デフォルトは9200です。
http.enabled httpプロトコルを使用して外部サービスを提供するかどうかにかかわらず、デフォルトはtrueで、有効になっています。
Discovery.zen.ping.multicast.enabled マルチキャスト検出ノードを開くかどうかを設定します。デフォルトはtrueです。
Discovery.zen.ping.unicast.hosts クラスター内のマスターノードの初期リストを設定します。これを使用して、クラスターに参加する新しいノードを自動的に検出できます。

1.es-node-masterノード

# ======================== Elasticsearch Configuration =========================
# 集群的名字
cluster.name: my-application
# 节点名字
node.name: es-node-master
#指定该节点是否有资格被选举成为master
node.master: true
#ES的监听地址,这样别的机器也可以访问
network.host: 192.168.184.128
# 默认的就好
http.port: 9200
#必须指向主节点的节点名
cluster.initial_master_nodes: ["es-node-master"]
#culster transport port,节点相互通信端口号,默认9300
transport.tcp.port: 9300    
#设置集群中master节点的初始列表,可以通过这些节点来自动发现新加入集群的节点
discovery.zen.ping.unicast.hosts: ["192.168.184.128:9300", "192.168.184.128:9400","192.168.184.128:9500"]
# 增加新的参数,这样head插件可以访问es,解决跨域访问问题(!!!必要)
http.cors.enabled: true
http.cors.allow-origin: "*"
# 集群个节点IP地址,也可以使用els、els.shuaiguoxia.com等名称,需要各节点能够解析
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
#       Before you set out to tweak and tune the configuration, make sure you
#       understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please consult the documentation for further information on configuration options:
# https://www.elastic.co/guide/en/elasticsearch/reference/index.html
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
#cluster.name: my-application
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
#node.name: node-1
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
#path.data: /path/to/data
#
# Path to log files:
#
#path.logs: /path/to/logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
#bootstrap.memory_lock: true
#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
#network.host: 192.168.0.1
#
# Set a custom port for HTTP:
#
#http.port: 9200
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when this node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
#discovery.seed_hosts: ["host1", "host2"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
#cluster.initial_master_nodes: ["node-1", "node-2"]
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
#gateway.recover_after_nodes: 3
#
# For more information, consult the gateway module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true

****

2.es-node-slaver1ノード

****

# ======================== Elasticsearch Configuration =========================
# 集群的名字  必须与其他机器相同
cluster.name: my-application
# 节点名字,必须与其他节点不同
node.name: es-node-slaver1
# 修改一下ES的监听地址,这样别的机器也可以访问
network.host: 192.168.184.128
# 不能和其他的节点相同
http.port: 9201
# !!!!必须指向主节点的节点名
cluster.initial_master_nodes: ["es-node-master"]
#用于互相通信的端口,必须不同,默认主分支master是9300,这里从节点1使用9400
transport.tcp.port: 9400    
#设置集群中master节点的初始列表,可以通过这些节点来自动发现新加入集群的节点
discovery.zen.ping.unicast.hosts: ["192.168.184.128:9300", "192.168.184.128:9400","192.168.184.128:9500"] 
# 增加新的参数,这样head插件可以访问es,解决跨域访问问题(!!!必要)
http.cors.enabled: true
http.cors.allow-origin: "*"
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
#       Before you set out to tweak and tune the configuration, make sure you
#       understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please consult the documentation for further information on configuration options:
# https://www.elastic.co/guide/en/elasticsearch/reference/index.html
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
#cluster.name: my-application
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
#node.name: node-1
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
#path.data: /path/to/data
#
# Path to log files:
#
#path.logs: /path/to/logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
#bootstrap.memory_lock: true
#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
#network.host: 192.168.0.1
#
# Set a custom port for HTTP:
#
#http.port: 9200
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when this node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
#discovery.seed_hosts: ["host1", "host2"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
#cluster.initial_master_nodes: ["node-1", "node-2"]
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
#gateway.recover_after_nodes: 3
#
# For more information, consult the gateway module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true

3.es-node-slaver2ノード

# ======================== Elasticsearch Configuration =========================
# 集群的名字  必须与其他机器相同
cluster.name: my-application
# 节点名字,必须与其他节点不同
node.name: es-node-slave2
# 修改一下ES的监听地址,这样别的机器也可以访问
network.host: 192.168.184.128
# 不能和其他的节点相同
http.port: 9202
# !!!!必须指向主节点的节点名
cluster.initial_master_nodes: ["es-node-master"]
#culster transport port 用于互相通信的端口,必须不同,默认主分支master是9300,这里从节点2使用9500
transport.tcp.port: 9500    
#设置集群中master节点的初始列表,可以通过这些节点来自动发现新加入集群的节点
discovery.zen.ping.unicast.hosts: ["192.168.184.128:9300", "192.168.184.128:9400","192.168.184.128:9500"] 
# 增加新的参数,这样head插件可以访问es,解决跨域访问问题(!!!必要)
http.cors.enabled: true
http.cors.allow-origin: "*"
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
#       Before you set out to tweak and tune the configuration, make sure you
#       understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please consult the documentation for further information on configuration options:
# https://www.elastic.co/guide/en/elasticsearch/reference/index.html
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
#cluster.name: my-application
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
#node.name: node-1
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
#path.data: /path/to/data
#
# Path to log files:
#
#path.logs: /path/to/logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
#bootstrap.memory_lock: true
#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
#network.host: 192.168.0.1
#
# Set a custom port for HTTP:
#
#http.port: 9200
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when this node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
#discovery.seed_hosts: ["host1", "host2"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
#cluster.initial_master_nodes: ["node-1", "node-2"]
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
#gateway.recover_after_nodes: 3
#
# For more information, consult the gateway module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true

注:esクラスターの構築時に、2番目のesサーバー3番目のesサーバーが元の最初のesサーバーをローカルマシンにコピーする場合は、esの下のデータのコンテンツをクリアする必要があります(ノードフォルダーを削除します) 。

おすすめ

転載: blog.csdn.net/weixin_43605266/article/details/114628949