6.4.3 elasticsearch配置

elasticsearch配置文件

关键的配置文件就俩,简单的一笔:

  • /etc/elasticsearch/elasticsearch.yml

  • /etc/elasticsearch/jvm.options

另外还有个日志配置文件:

  • /etc/elasticsearch/log4j2.properties

elasticsearch.yml

关键参数说明:

  • node.masternode.data参数组合决定了es在集群中的角色

  • cluster.name集群名称, 所有节点使用相同名称

  • node.name集群内部唯一,目前是使用short主机名作为node.name

  • node.attr.rack打标签,用于allocation,达到冷热数据分离的功能

  • path.data数据目录,支持指定多个

  • path.repo用于snapshot对应的仓库位置

  • discovery.zen.ping.unicast.hosts基于单播的自动发现配置,可以配置多个,也可以直接使用负载均衡暴露统一的地址,这里使用后者,es服务发现的域名为essd-pexample01cn.svc.example.net

  • discovery.zen.minimum_master_nodes最小的存活master节点数量

master节点

cluster.name: dota

node.name: elk-example01cn-p001
node.max_local_storage_nodes: 1
node.master: true
node.data: true
node.attr.rack: hot

network.host: 10.40.9.79,127.0.0.1
http.port: 9200
transport.tcp.port: 9300

path.data:
 - /data/elasticsearch/data
 - /data/elasticsearch/data-ext01
path.logs: /data/elasticsearch/logs
path.repo: /data/ossfs

discovery.zen.minimum_master_nodes: 3

discovery.zen.ping.unicast.hosts: [essd-pexample01cn.svc.example.net]

data节点

cluster.name: dota

node.name: elk-example01cn-p006
node.max_local_storage_nodes: 1
node.master: false
node.data: true
node.attr.rack: warm

http.enabled: false
network.host: 10.40.9.103,127.0.0.1
transport.tcp.port: 9300

path.data:
 - /data/elasticsearch/data
 - /data/elasticsearch/data-ext01
 - /data/elasticsearch/data-ext02
path.logs: /data/elasticsearch/logs
path.repo: /data/ossfs

discovery.zen.minimum_master_nodes: 3

discovery.zen.ping.unicast.hosts: [essd-pexample01cn.svc.example.net]

nodata节点

cluster.name: dota

node.name: elk-example01cn-p009
node.max_local_storage_nodes: 1
node.master: false
node.data: false

network.host: 10.40.9.116,127.0.0.1
http.port: 9200
transport.tcp.port: 9300

path.data: /data/elasticsearch/data
path.repo: /data/ossfs
path.logs: /data/elasticsearch/logs

discovery.zen.minimum_master_nodes: 3

discovery.zen.ping.unicast.hosts: [essd-pexample01cn.svc.example.net]

最后更新于