文章目录
一、 es 1
1.关闭集群的动态分片:(动态分片开启状态如果节点宕机了,会导致集群重新分配数据进行数据转移,会导致节点直接大量传输数据)
curl -XPUT ‘http://10.3.14.154:9200/_cluster/settings?pretty’ -d ‘{“transient”:{“cluster.routing.allocation.disable_allocation”: true}}’
curl -XPUT 'http://10.3.14.154:9200/_cluster/settings?pretty' -d '{"transient":{"cluster.routing.allocation.disable_allocation": true}}'
{
"error" : "Content-Type header [application/x-www-form-urlencoded] is not supported",
"status" : 406
}
2. 查看进程和杀死进程
- 重启前,进入到业务账号很重要。见过死的谁都害怕
ps -ef | grep elas
kill -9 12955
3.重启 服务
cd ~/bin
./elasticsearch -d
4.确认进程是否启动
ps -ef | grep elasticsearch
5.开启集群的动态分片:
curl -XPUT ‘http://10.3.14.155:9200/_cluster/settings?pretty’ -d ‘{“transient”:{“cluster.routing.allocation.disable_allocation”: false}}’
{
“error” : “Content-Type header [application/x-www-form-urlencoded] is not supported”,
“status” : 406
}
6.检查集群的健康状态
curl 10.3.14.154:9200/_cluster/health?pretty
{
“cluster_name” : “elasticsearch”,
“status” : “yellow”,
“timed_out” : false,
“number_of_nodes” : 3,
“number_of_data_nodes” : 3,
“active_primary_shards” : 5,
“active_shards” : 8,
“relocating_shards” : 0,
“initializing_shards” : 2,
“unassigned_shards” : 0,
“delayed_unassigned_shards” : 0,
“number_of_pending_tasks” : 1,
“number_of_in_flight_fetch” : 0,
“task_max_waiting_in_queue_millis” : 0,
“active_shards_percent_as_number” : 80.0
}
https://shihlei.iteye.com/blog/2418651
7、es 状态查看的脚本
curl '10.3.14.161:9200/_cat/health?'
curl '10.3.14.161:9200/_cat/health?v'
curl -sXGET http://10.3.14.161:9200/_cluster/health/?pretty