---------------------------------- 集群设置 -----------------------------------
集群名称:
cluster.name: es-prod
节点类型
master和data同时配置会产生一些奇异的效果:
1) 当master为false,而data为true时,会对该节点产生严重负荷;
2) 当master为true,而data为false时,该节点作为一个协调者;
3) 当master为false,data也为false时,该节点就变成了一个负载均衡器
node.master: true
node.data: true
------------------------------------ 节点设置 ------------------------------------
节点名称
node.name: master-133
----------------------------------- 索引、日志文件存放目录 ------------------------------------
索引文件存储目录(用逗号分隔来指定多个目录)
path.data: /data/elasticsearch/data
日志文件存储目录
path.logs: /data/elasticsearch/logs
数据导入
path.repo: /mnt/cephfs/esbak
----------------------------------- 内存设置 --------------------------------------------------
锁定ES指定的内存
bootstrap.mlockall: true
bootstrap.memory_lock: true
---------------------------------- 网络设置 -----------------------------------
绑定IP地址,主要用于内部集群访问
network.bind_host: 0.0.0.0
绑定IP地址,主要为外部调用方提供访问地址,该IP需要具备访问调用方IP段和访问集群内部IP段的权限
network.publish_host: 10.85.7.133
设置端口号,( 默认 http.publish_port 等于 http.port )
http.port: 9200
是否支持跨域访问资源
http.cors.enabled: true
允许访问资源的类型
http.cors.allow-origin: "*"
允许HTTP请求的方法类型
http.cors.allow-methods: OPTIONS,HEAD,GET,POST,PUT,DELETE
允许HTTP请求头返回类型
http.cors.allow-headers: X-Requested-With,Content-Type,Content-Length
Access-Control-Allow-Credentials 请求头信息是否返回
http.cors.allow-credentials: false
是否输出错误请求的详细信息
http.detailed_errors.enabled: true
支持HTTP访问API 总开关
http.enabled: true
--------------------------------- 自动发现机制设置 ----------------------------------
为了加入集群,当前节点必须知道集群中的其它节点地址(通常在这里设置所有master节点的候选者IP地址)
discovery.zen.ping.unicast.hosts: ["10.85.7.133:9300"]
防止脑裂丢失数据,master节点候选者必须超过半数存活 (master_eligible_nodes / 2) + 1)
discovery.zen.minimum_master_nodes: 1
---------------------------------- Transport 设置 -----------------------------------
设置端口号,用于不同节点之间的通信
transport.tcp.port: 9300
客户端Socket连接超时时间
transport.tcp.connect_timeout: 30s
客户端保持连接的检查时间
transport.ping_schedule: 3s
tcp 通信内容是否压缩
transport.tcp.compress: true
indices.memory.index_buffer_size: 10%
indices.memory.max_index_buffer_size: 2gb
数据缓冲区初始化大小
indices.memory.min_index_buffer_size: 512mb
------------------------------search-cache----------------------------------------------------------------------------------------------
节点查询缓存,可以被所有分片共享,type采用的方式是LRU方式.即:当缓存达到了某个临界值之后,es会将最近没有使用的数据清除出cache.使让新的数据进入es.
indices.queries.cache.size: 20%
节点级别的请求缓存,只要索引分片不变,每次访问后返回的结果是一致的,默认1%
indices.requests.cache.size: 5%
indices.requests.cache.expire: 30m
用于fielddata缓存的内存数量,主要用于当使用排序,faceting操作时,elasticsearch会将一些热点数据加载到heap内存中来提供给客户端访问
indices.fielddata.cache.size: 30%