Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Daily maintenance operation of elasticsearch restful

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

First, index operation

Curl-XPUT http://127.0.0.1:9200/xrf_test_index001-d'{"setting": {"index": {"number_of_shards": 5, "number_of_replication": 1}}'# create a manually specified shard copy

Curl-XPOST http://127.0.0.1:9200/xrf_test_index001/_close # turn off the index

Curl-XPOST http://127.0.0.1:9200/xrf_test_index001/_open # Open the index

Curl-XDELETE http://127.0.0.1:9200/xrf_test_index001 # delete index

Curl-XPUT http://127.0.0.1:9200/xrf_test_index001/_settings-d'{"index": {"number_of_replicas": 1}}'# adjust the number of copies

Curl-XPOST http://127.0.0.1:9200/_aliases-d'{"actions": [{"add": {"index": "xrf_test_index001", "alias": "xrf_test"}}]}'# add index aliases

Curl-XPOST http://127.0.0.1:9200/_aliases-d'{"actions": [{"remove": {"index": "xrf_test_index001", "alias": "xrf_test"}}]}'# Delete aliases

Second, slicing operation

Curl-XPUT http://127.0.0.1:9200/_cluster/settings-d'{"transient": {"cluster.routing.allocation.enable": "none"}'# turn off automatic sharding persistent means permanent

Curl-XPUT http://127.0.0.1:9200/_cluster/settings-d'{"transient": {"cluster.routing.allocation.enable": "all"}'# starts automatic slicing

Curl-XPUT http://127.0.0.1:9200/_cluster/settings-d'{"transient": {"cluster.routing.allocation.cluster_concurrent_rebalance": 5}}'# set the number of sharded balanced threads

Curl-XPUT http://127.0.0.1:9200/_cluster/settings-d'{"transient": {"cluster.routing.allocation.exclude._ip": "1.1.1.1"}}'# excluding machines or nodes, shards on the changed nodes will be adjusted to other nodes, and _ name,_hostname,_ip is supported

Third, node operation

Curl-XPOST http://127.0.0.1:9200/_cluster/nodes/_local/_shutdown?delay=10s # delays shutting down native nodes for 10s, invalid kill $pid after 2.x

Curl-XPOST http://127.0.0.1:9200/_cluster/nodes/nodeId1,nodeId2/_shutdown # shuts down node nodeId1,nodeId2

Curl-XPOST http://127.0.0.1:9200/_cluster/nodes/_master/_shutdown # shuts down the primary node

Fourth, status check

Curl-XGET http://127.0.0.1:9200/_cluster/nodes # gets the list and information of nodes in the cluster

Curl-XGET http://127.0.0.1:9200/_cluster/health # to get cluster information

Curl-XGET http://127.0.0.1:9200/_cluster/state # gets all the information in the cluster (cluster information, node information, mapping information, etc.)

Curl-XGET http://127.0.0.1:9200/_cat/nodes # View the list of cluster nodes

Curl-XGET http://127.0.0.1:9200/_cat/indices # View cluster index list

Curl-XGET http://127.0.0.1:9200/_cat/shards # View the list of cluster shards

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report