bootstrap.memory_lock: false # centos 6版本内核不支持
bootstrap.system_call_filter: false
indices.store.throttle.type: merge #merge调优
indices.store.throttle.max_bytes_per_sec: 50m
index.merge.scheduler.max_thread_count: 1
index.merge.policy.max_merged_segment: 15gb
index.refresh_interval: -1
index.translog.flush_threshold_ops: 100000 #tranlog达到多少条进行数据平衡,默认为5000
index.translog.flush_threshold_size: 512m
threadpool.bulk.type: fixed
threadpool.bulk.size: 12 #12核机器,核心数
threadpool.bulk.queue_size: 1000
threadpool.index.type: fixed
threadpool.index.size: 12 #12核机器,核心数
threadpool.index.queue_size: 1000
threadpool.get.type: fixed
threadpool.get.size: 12 #12核机器,核心数
threadpool.get.queue_size: 1000
threadpool.search.type: fixed
threadpool.search.size: 24 #12核机器,核心数2倍
threadpool.search.queue_size: 500
index.indexing.slowlog.threshold.index.warn: 10s
index.indexing.slowlog.threshold.index.info: 5s
index.indexing.slowlog.threshold.index.debug: 2s
index.indexing.slowlog.threshold.index.trace: 500ms
index.search.slowlog.threshold.fetch.warn: 1s
index.search.slowlog.threshold.fetch.info: 800ms
index.search.slowlog.threshold.fetch.debug: 500ms
index.search.slowlog.threshold.fetch.trace: 200ms
另外的一些配置中项如下:
cluster.name: yz-search #集群名称
node.name: yz-search94 #当前节点名称
index.number_of_shards: 4 #每个index的shards数,这个根据磁盘数量等去算,默认5
index.number_of_replicas: 0 #要不要复制分片
index.refresh_interval: 60s #刷新时间
path.logs: /data1/LogData/logs #日志存放地点
network.host: 10.39.40.94 #绑定ip地址
http.port: 9200 #http管理端口
discovery.zen.ping.unicast.hosts: ["10.39.40.94:9300","10.39.40.95:9300","10.39.40.96:9300","10.39.40.97:9300"] #用来发现集群存在的es主机
discovery.zen.minimum_master_nodes: 2 #最少有几个主机就可以进行master选举
b、heap数的设置,官方说是不能超过30G,我们64G的内存,设置是25G,GC方式采用G1
c、常用es的集群管理命令,当然只是看信息的可以浏览器里直接输入查看
curl http://10.39.40.94:9200/_cat/nodes?v #节点概况
curl http://10.39.40.94:9200/_cat/shards?v #查看shards的信息
curl http://10.39.40.94:9200/_cat/indices?v #查看索引信息,如果新推的日志,可以看这个确认是否索引成功
curl -X DELETE "http://10.39.40.94:9200/索引名称" #删除指定历史索引,速度很快
对于我们线上的日志,默认保存7天,每天晚上清除一次,清除的脚本如下:
#!/bin/bash
DATES=`date +%Y.%m.%d -d'-7 day'`
curl -X DELETE
ES升级5.2.1详见:ELK之ES2.4.1双实例平滑升级至5.2.1问题解决及supervisor管理记
五、展现(kibana)