ES集群優(yōu)化
具體詳情請看官方文檔建議:https://www.elastic.co/guide/en/elasticsearch/reference/7.5/restart-cluster.html文章來源地址http://www.zghlxwxcb.cn/news/detail-523025.html
1.先把elasticsearch的服務(wù)停掉
systemctl stop elasticsearch
kill -9 進(jìn)程號
2.修改jvm.options配置文件下最大、最小內(nèi)存限制
-Xms26g
-Xmx26g
官方文檔建議是不要超過32g,最好保持在30g以內(nèi),26g最優(yōu)
3.重啟elasticsearch
建議是全部停了之后,一起啟動(dòng)集群
systemctl start elasticsearch
#注意 重啟之前要先把重新分片的配置關(guān)掉,以免數(shù)據(jù)量太大,導(dǎo)致重啟時(shí),集群重新分片,等候時(shí)間長短不確定(有可能等個(gè)好幾天)
4.配置
# 調(diào)整副本數(shù)量
curl -X PUT "localhost:9200/xxx" -H 'Content-Type: application/json' -d'
{
"number_of_replicas": 0
}'
# 調(diào)整分配并發(fā),默認(rèn)2
curl -X PUT "localhost:9200/_cluster/settings" -H 'Content-Type: application/json' -d'
{
"persistent" : {
"indices.recovery.max_concurrent_file_chunks": 10
}
}'
# 調(diào)整分配速度限制, 默認(rèn)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
# 查看恢復(fù)進(jìn)度
http://localhost:9200/_cat/recovery
#查看分片信息
http://localhost:9200/_cat/shards?v
#查看節(jié)點(diǎn)資源情況
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
#查看集群動(dòng)態(tài)配置
http://localhost:9200/_cluster/settings?pretty
#查看副本數(shù)量
http://localhost:9200/_cat/indices?v
ES優(yōu)化
"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"
文章來源:http://www.zghlxwxcb.cn/news/detail-523025.html
到了這里,關(guān)于生產(chǎn)環(huán)境ES集群擴(kuò)容及優(yōu)化的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!