ES集群优化
具体详情请看官方文档建议:https://www.elastic.co/guide/en/elasticsearch/reference/7.5/restart-cluster.html文章来源地址https://www.toymoban.com/news/detail-523025.html
1.先把elasticsearch的服务停掉
systemctl stop elasticsearch
kill -9 进程号
2.修改jvm.options配置文件下最大、最小内存限制
-Xms26g
-Xmx26g
官方文档建议是不要超过32g,最好保持在30g以内,26g最优
3.重启elasticsearch
建议是全部停了之后,一起启动集群
systemctl start elasticsearch
#注意 重启之前要先把重新分片的配置关掉,以免数据量太大,导致重启时,集群重新分片,等候时间长短不确定(有可能等个好几天)
4.配置
# 调整副本数量
curl -X PUT "localhost:9200/xxx" -H 'Content-Type: application/json' -d'
{
"number_of_replicas": 0
}'
# 调整分配并发,默认2
curl -X PUT "localhost:9200/_cluster/settings" -H 'Content-Type: application/json' -d'
{
"persistent" : {
"indices.recovery.max_concurrent_file_chunks": 10
}
}'
# 调整分配速度限制, 默认40mb
curl -X PUT "localhost:9200/_cluster/settings" -H 'Content-Type: application/json' -d'
{
"persistent" : {
"indices.recovery.max_bytes_per_sec" : "2048mb"
}
}'
#注意 集群起来后,要把配置还原
5.可供使用的查询地址
# 查看集群信息
http://localhost:9200/_cat/health?v
# 查看恢复进度
http://localhost:9200/_cat/recovery
#查看分片信息
http://localhost:9200/_cat/shards?v
#查看节点资源情况
http://localhost:9200/_cat/nodes?v&h=host,heap.current,heap.percent,heap.max,ram.max,disk.avail,node.role
#查看索引信息
http://localhost:9200/_cat/indices?v
#查看集群动态配置
http://localhost:9200/_cluster/settings?pretty
#查看副本数量
http://localhost:9200/_cat/indices?v
ES优化
"index.refresh_interval": "60s",
"index.translog.flush_threshold_size": "500mb",
"index.translog.durability": "async",
"index.merge.scheduler.max_thread_count": "1",
"index.merge.policy.max_merge_at_once": "10",
"index.merge.policy.max_merged_segment": "10gb",
"index.merge.policy.segments_per_tier": "50",
"index.merge.policy.floor_segment": "50mb",
"index.number_of_replicas": "0"
文章来源:https://www.toymoban.com/news/detail-523025.html
到了这里,关于生产环境ES集群扩容及优化的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!