1. 程式人生 > >elasticsearch es 手動操作分片設定

elasticsearch es 手動操作分片設定

#動態設定es索引副本數量
curl -XPUT 'http://168.7.1.67:9200/log4j-emobilelog/_settings' -d '{
   "number_of_replicas" : 2
}'

#設定es不自動分配分片
curl -XPUT 'http://168.7.1.67:9200/log4j-emobilelog/_settings' -d '{
   "cluster.routing.allocation.disable_allocation" : true
}'

#手動移動分片
curl -XPOST "http://168.7.1.67:9200/_cluster/reroute' -d  '{
   "commands" : [{
		"move" : {
			"index" : "log4j-emobilelog",
			"shard" : 0,
			"from_node" : "es-0",
			"to_node" : "es-3"
		}
	}]
}'

#手動分配分片
curl -XPOST "http://168.7.1.67:9200/_cluster/reroute' -d  '{
   "commands" : [{
		"allocate" : {
			"index" : ".kibana",
			"shard" : 0,
			"node" : "es-2",
		}
	}]
}'