#系统默认的最大打开文件数的限制
vi /etc/security/limits.conf
* - nproc 50240
* - nofile 20480 #65535
* - npro 20480
* - nofile 65535
* - memlock unlimited
#尽量不用交换空间
#设置为1 而不是0 主要是可能出现内存满后会乱杀程序
/etc/sysctl.conf
vm.swappiness = 1
#关闭swap
swapoff /dev/mapper/vg_"hostname"-lv_swap
#调整每个进程最多可以打开的文件数量和上面的vi /etc/security/limits.conf冲突。。但是都行
vi /etc/profile
ulimit -SH unlimited
ulimit -u unlimited
ulimit -i unlimited
ulimit -l unlimited
ulimit -n 204800
#关闭磁盘文件访问时间 不知道怎么弄
#调整es 内存使用
vi elasticsearch\bin\service\elasticsearch.conf
#HEAP_SIZE设置为物理内存的60%左右。。
set.default.ES_HEAP_SIZE= 4620
##分配给es的最小内存 让min == max 建议怎么做,让gc跑起来
set.default.ES_MIN_MEM=4620
##分配给es的最大内存
set.default.ES_MAX_MEM=4620
#replicas 设置为0
vi elasticsearch/config/elasticsearch.
index.number_of_replicas:0
#### 等index弄完么。动态执行下
PUT _all/_settings
{
"index" : {
"number_of_replicas" :1
}
}
###
##配置文件的其他优化
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["172.30.1.71","172.30.1.72","172.30.1.52"]
indices.memory.index_buffer_size: 30%
indices.reovery.max_bytes_per_sec: 10gb
index.merge.policy.max_merged_segment: 10gb
index.merge.scheduler.max_thread_count: 3
index.merge.scheduler.max_merge_count: 6
index.refresh_interval: 30s
index.translog.flush_threshold_size: 5gb
index.translog.flush_threshold_ops: 50000
index.cache.field.type: soft
index.cache.field.max_size: 50000
index.cache.field.expire: 10m
index.fielddata.cache: soft
http://stackoverflow.com/questions/28193076/optimize-elasticsearch-jvm
https://discuss.elastic.co/t/miracle-g1-settings-for-30gb-heaps/25271