ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

es常用命令

2022-09-09 10:01:51  阅读:254  来源: 互联网

标签:10.1 http 9200 192.168 cluster 常用命令 curl es


1.查看es错误信息

curl GET 'http://192.168.10.1:9202/_cluster/allocation/explain?pretty'

2.磁盘只读问题处理

1.根据报错内容找到对应node_id
curl GET 'http://192.168.10.1:9202/_cluster/allocation/explain?pretty' |grep "node_id"
2.找到对应ip及磁盘位置 echo "a" > 只读路径
进入/opt/elasticsearch-a/config/elasticsearch.yml //注释相关磁盘
3.过滤es服务
ps -ef |grep elasticsearch-a //有三个,每次kill一个服务,起一个服务,然后再kill下一个服务
kill -9 xxxxx //kill es服务
4.启动es服务
./bin/elasticsearch-a -d
curl -s "http://192.168.10.1:9202/_cluster/health?pretty" //查看服务状态,增加后kill下一个服务
过滤相关为分片
curl -s "http://192.168.10.1:9200/_cat/shards" | grep UNASSIGNED 

3.处理相关分片

总共分四步
1.  curl -X PUT "http://192.168.10.1:9200/_cluster/settings" -H 'Content-Type: application/json' -d '{"persistent":{"cluster.routing.allocation.enable":"none"}}'
2.  curl -X  POST "http://192.168.10.1:9200//_cluster/reroute?retry_failed=true"
3.  curl -X PUT "http://192.168.10.1:9200/_cluster/settings" -H 'Content-Type: application/json' -d '{"persistent":{"cluster.routing.allocation.enable":"all"}}'
4.//手动处理为分片
 curl -X POST "http://192.168.10.1:9200/_cluster/reroute" -H 'Content-Type: application/json' -d '{"commands":[{"allocate_replica":{"index":"bus_adver","shard":0,"node":"fLa2s_1WTUizV6UAPTuW1w"}}]}'
curl -X POST "http://192.168.10.1:9200/_cluster/reroute" -H 'Content-Type: application/json' -d '{"commands":[{"allocate_replica":{"index":"bus_adver","shard":0,"node":"0JX8yOLZTzqGVccsh1UEcQ"}}]}'
如手动处理失败,过滤为分片信息
curl -s "http://192.168.10.1:9200/_cat/shards" | grep UNASSIGNED
删除该未分片信息
curl -X DELETE "http://ip:port/xxxxxxx"
查看服务状态
curl -s "http://192.168.10.1:9202/_cluster/health?pretty"
//状态green结束

标签:10.1,http,9200,192.168,cluster,常用命令,curl,es
来源: https://www.cnblogs.com/whiteY/p/16671726.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有