首页  

elasticsearch5.0的重要配置     所属分类 elasticsearch 浏览量 1163
根据原文翻译整理
https://www.elastic.co/guide/en/elasticsearch/reference/5.0/important-settings.html

ES只需要很少的配置,投入生产使用时,有些重要的配置需要手工设置

path.data 
path.logs
cluster.name
node.name
bootstrap.memory_lock
network.host
discovery.zen.ping.unicast.hosts
discovery.zen.minimum_master_nodes


 the data and logs directories are sub-folders of $ES_HOME. 
 If these important folders are left in their default locations, 
 there is a high risk of them being deleted while upgrading Elasticsearch to a new version.
 
 如果这些重要的文件夹被保留在默认位置,升级到新版本时,它们被删除的风险很高。
 
 生产环境中,最好修改 data 和 log 目录
 
 The path.data settings can be set to multiple paths, 
 in which case all paths will be used to store data ,
 although the files belonging to a single shard will all be stored on the same data path
 
 数据目录可以设置多个,同一分片的文件会存储在同一个目录下
 
 
 path:
  data:
    - /mnt/elasticsearch_1
    - /mnt/elasticsearch_2
    - /mnt/elasticsearch_3
    

A node can only join a cluster when it shares its cluster.name with all the other nodes in the cluster. 
The default name is elasticsearch, but you should change it to an appropriate name which describes the purpose of the cluster.

cluster.name 集群名字默认为 elasticsearch
确保给节点设置正确的  cluster.name,否则会加入错误的集群

node.name

By default, Elasticsearch will take the 7 first character of the randomly generated uuid used as the node id. 
Note that the node id is persisted and does not change 
when a node restarts and therefore the default node name will also not change.

默认情况下,使用随机生成的uuid的前7个字符作为节点id。

node.name: prod-data-2

The node.name can also be set to the server’s HOSTNAME as follows:

node.name: ${HOSTNAME}

It is vitally important to the health of your node that none of the JVM is ever swapped out to disk. 
One way of achieving that is set the bootstrap.memory_lock setting to true

避免内存交换,保持节点健康很重要 ,可以设置 bootstrap.memory_lock  为  true 


By default, Elasticsearch binds to loopback addresses only — e.g. 127.0.0.1 and [::1]. 
This is sufficient to run a single development node on a server.

默认只绑定到环回地址 
如果不配置 network.host
 只能通过 127.0.0.1 访问

In order to communicate and to form a cluster with nodes on other servers, your node will need to bind to a non-loopback address.

network.host: 192.168.1.10

As soon you provide a custom setting for network.host, 
Elasticsearch assumes that you are moving from development mode to production mode, 
and upgrades a number of system startup checks from warnings to exceptions. 

配置 network.host 之后 ,会进入生产模式 ,将许多系统启动检查从警告升级到异常。

注意开发模式和生产模式的区别 


Out of the box, without any network configuration, 
Elasticsearch will bind to the available loopback addresses 
and will scan ports 9300 to 9305 to try to connect to other nodes running on the same server. 
This provides an auto-clustering experience without having to do any configuration.


在没有任何网络配置的情况下,ES将立即绑定到可用的环回地址,
并扫描端口9300到9305,以尝试连接到运行在同一服务器上的其他节点。这提供了一种无需进行任何配置的自动集群体验。

Out of the box  开箱即用


When the moment comes to form a cluster with nodes on other servers, 
you have to provide a seed list of other nodes in the cluster that are likely to be live and contactable. 

当需要和其他服务器上的节点组成集群时,需要提供种子节点列表
discovery.zen.ping.unicast.hosts:
   - 192.168.1.10:9300
   - 192.168.1.11 
   - seeds.mydomain.com
   
The port will default to transport.profiles.default.port and fallback to transport.tcp.port if not specified.

transport.tcp.port



To prevent data loss, it is vital to configure the discovery.zen.minimum_master_nodes setting 
so that each master-eligible node knows the minimum number of master-eligible nodes that must be visible in order to form a cluster.

Without this setting, a cluster that suffers a network failure is at risk of 
having the cluster split into two independent clusters — a split brain — which will lead to data loss. 
A more detailed explanation is provided in Avoiding split brain with minimum_master_nodes.

To avoid a split brain, this setting should be set to a quorum of master-eligible nodes:
(master_eligible_nodes / 2) + 1


In other words, if there are three master-eligible nodes, then minimum master nodes should be set to (3 / 2) + 1 or 2:
discovery.zen.minimum_master_nodes: 2


为了防止数据丢失,配置 discovery.zen.minimum_master_nodes 非常重要。
每个拥有主节点资格的节点 需要知道 要形成集群 可用的 拥有主节点资格节点的最小数量。
候选主节点   集群中候选主节点数的最小数量 
如果没有此设置,遭受网络故障的集群将面临风险  集群分成裂两个独立的集群  脑裂 将导致数据丢失。

Avoiding split brain with minimum_master_nodes
https://www.elastic.co/guide/en/elasticsearch/reference/5.0/modules-node.html#split-brain

上一篇     下一篇
elasticsearch5.0使用RPM包安装

elasticsearch5.0安装

elasticsearch5.0配置

elasticsearch5.0启动检查

elasticsearch5.0重要系统配置

elasticsearch5.0API约定