0


ElasticSearch ES 安全完整的重启步骤

文章目录

ES安全完整的重启步骤

命令行curl方式

  • 关闭集群自动均衡、禁止集群写入
#关闭集群自动均衡curl-XPUT"http://集群任意IP:9200/_cluster/settings?pretty"-H'Content-Type:application/json'-d'{
  "persistent" :{
      "cluster.routing.rebalance.enable": "none"
   },
     "transient" :{
      "cluster.routing.rebalance.enable": "none"
   }
}'#检查集群自动均衡是否关闭curl-XGET"http://集群任意IP:9200/_cluster/settings?pretty"#禁止集群写入curl-XPUT"http://集群任意IP:9200/_cluster/settings?pretty"-H'Content-Type:application/json'-d'
{
  "persistent" :{
      "cluster.blocks.read_only" : "true"
   },
     "transient" :{
      "cluster.blocks.read_only" : "true"
   }
}'#检查集群写入是否已经关闭curl-XGET"http://集群任意IP:9200/_cluster/settings?pretty"
  • 重启es集群
#停es服务sship-C'ps -ef|grep  org.elasticsearch.bootstrap.Elasticsearch|grep -v grep|awk '{print \$2}'|xargs kill -9'#启动es服务sship-C'su - es -c "cd /home/es/software/elasticsearch/bin;sh elasticsearch -d"'
  • 打开集群自动均衡、开启集群写入
--先打开写入,再打开自动均衡
#打开集群写入curl-XPUT"http://集群任意IP:9200/_cluster/settings?pretty"-H'Content-Type:application/json'-d'{"persistent" :{"cluster.blocks.read_only" : "false"}}'curl-XPUT"http://集群任意IP:9200/_cluster/settings?pretty"-H'Content-Type:application/json'-d'{"transient" :{"cluster.blocks.read_only" : "false"}}'#检查集群写入是否已经打开curl-XGET"http://集群任意IP:9200/_cluster/settings?pretty"#打开集群自动均衡curl-XPUT"http://集群任意IP:9200/_cluster/settings?pretty"-H'Content-Type:application/json'-d'{"persistent" :{"cluster.routing.rebalance.enable": "all"}}'curl-XPUT"http://集群任意IP:9200/_cluster/settings?pretty"-H'Content-Type:application/json'-d'{"transient" :{"cluster.routing.rebalance.enable": "all"}}'#检查集群自动均衡是否打开curl-XGET"http://集群任意IP:9200/_cluster/settings?pretty"

Kibana执行

  • 关闭集群自动均衡、禁止集群写入
#关闭集群自动均衡
PUT /_cluster/settings  启动时候,禁自动均衡
{"persistent":{"cluster.routing.rebalance.enable":"none"},
  "transient":{"cluster.routing.rebalance.enable":"none"}}#检查集群自动均衡是否关闭
GET /_cluster/settings?pretty
 
#禁止集群写入
PUT /_cluster/settings  //启动时候,禁写
{"persistent":{"cluster.blocks.read_only":true},
  "transient":{"cluster.blocks.read_only":true}}#检查集群写入是否已经关闭
GET /_cluster/settings?pretty
  • 重启es集群
#停es服务sship-C'ps -ef|grep  org.elasticsearch.bootstrap.Elasticsearch|grep -v grep|awk '{print \$2}'|xargs kill -9'#启动es服务sship-C'su - es -c "cd /home/es/software/elasticsearch/bin;sh elasticsearch -d"'
  • 打开集群自动均衡、开启集群写入
--先打开写入,再打开自动均衡
#打开集群写入
PUT /_cluster/settings
{"persistent":{"cluster.blocks.read_only":false}}
PUT /_cluster/settings
{"transient":{"cluster.blocks.read_only":false}}#检查集群写入是否已经打开
GET /_cat/shards?v&pretty&s=ip:desc
 
#打开集群自动均衡
PUT /_cluster/settings
{"persistent":{"cluster.routing.rebalance.enable":"ALL"},
  "transient":{"cluster.routing.rebalance.enable":"ALL"}}#检查集群自动均衡是否打开
GET /_cluster/settings?pretty

本文转载自: https://blog.csdn.net/zhangshenghang/article/details/128664112
版权归原作者 jast_zsh 所有, 如有侵权,请联系我们删除。

“ElasticSearch ES 安全完整的重启步骤”的评论:

还没有评论