189 8069 5689

elasticsearchrestful日常维护操作

一,索引操作
curl -XPUT http://127.0.0.1:9200/xrf_test_index001  -d '{"setting":{"index":{"number_of_shards":5,"number_of_replication":1}}}'    #创建手动指定分片副本    
curl -XPOST http://127.0.0.1:9200/xrf_test_index001/_close        #关闭索引    
curl -XPOST http://127.0.0.1:9200/xrf_test_index001/_open        #开启索引    
curl -XDELETE http://127.0.0.1:9200/xrf_test_index001            #删除索引
curl -XPUT http://127.0.0.1:9200/xrf_test_index001/_settings -d '{"index":{"number_of_replicas":1}}'    #调整副本数量
curl -XPOST http://127.0.0.1:9200/_aliases -d '{"actions":[{"add":{"index":"xrf_test_index001","alias":"xrf_test"}}]}'    #增加索引别名
curl -XPOST http://127.0.0.1:9200/_aliases -d '{"actions":[{"remove":{"index":"xrf_test_index001","alias":"xrf_test"}}]}' #删除别名
二,分片操作
curl -XPUT http://127.0.0.1:9200/_cluster/settings -d '{"transient":{"cluster.routing.allocation.enable":"none"}}'    #关闭自动分片  persistent 表示永久
curl -XPUT http://127.0.0.1:9200/_cluster/settings -d '{"transient":{"cluster.routing.allocation.enable":"all"}}'    #开起自动分片
curl -XPUT http://127.0.0.1:9200/_cluster/settings -d '{"transient":{"cluster.routing.allocation.cluster_concurrent_rebalance":5}}' #设置分片均衡线程数
curl -XPUT http://127.0.0.1:9200/_cluster/settings -d '{"transient":{"cluster.routing.allocation.exclude._ip":"1.1.1.1"}}' #排除机器或者节点,改节点上的分片将调整到其他节点,支持_name,_hostname,_ip
三,节点操作
curl -XPOST http://127.0.0.1:9200/_cluster/nodes/_local/_shutdown?delay=10s        #延迟10s关闭本机节点,2.x以后无效kill $pid
curl -XPOST http://127.0.0.1:9200/_cluster/nodes/nodeId1,nodeId2/_shutdown        #关闭节点nodeId1,nodeId2
curl -XPOST http://127.0.0.1:9200/_cluster/nodes/_master/_shutdown     #关闭主节点
四,状态查看
curl -XGET http://127.0.0.1:9200/_cluster/nodes     #获得集群中的节点列表和信息
curl -XGET http://127.0.0.1:9200/_cluster/health #获得集群信息
curl -XGET http://127.0.0.1:9200/_cluster/state    #获得集群里的所有信息(集群信息、节点信息、mapping信息等)
curl -XGET http://127.0.0.1:9200/_cat/nodes        #查看集群节点列表
curl -XGET http://127.0.0.1:9200/_cat/indices    #查看集群索引列表
curl -XGET http://127.0.0.1:9200/_cat/shards    #查看集群分片列表

我们提供的服务有:成都网站设计、成都做网站、微信公众号开发、网站优化、网站认证、武鸣ssl等。为1000+企事业单位解决了网站和推广的问题。提供周到的售前咨询和贴心的售后服务,是有科学管理、有技术的武鸣网站制作公司


分享名称:elasticsearchrestful日常维护操作
当前地址:http://cdxtjz.cn/article/pdcdpe.html

其他资讯