elasticsearch 常用命令
查看集群状态:
curl -XGET 'http://localhost:9200/_cluster/health?pretty'
查看所有节点状态:
curl -XGET -s "http://192.168.1.102:9200/_cat/nodes"
curl -XGET "http:192.168.1.102:9200/_node/stats/process"
查看集群在recovery的index
GET */_recovery?active_only=true
当集群分片分配失败后,执行:
POST _cluster/reroute?retry_failed=true
修改分片分配:
curl -XPUT 'http://192.168.1.101:9200/_cluster/settings' -H 'Content-Type: application/json' -d '{"transient":{"cluster.routing.allocation.enable": "none"}}'
Disable shard allocation.
When you shut down a node, the allocation process waits for index.unassigned.node_left.delayed_timeout (by default, one minute) before starting to replicate the shards on that node to other nodes in the cluster, which can involve a lot of I/O. Since the node is shortly going to be restarted, this I/O is unnecessary. You can avoid racing the clock by disabling allocation of replicas before shutting down the node:
curl -X PUT "localhost:9200/_cluster/settings" -H 'Content-Type: application/json' -d'
{"persistent": {"cluster.routing.allocation.enable": "none"}
}
'
当重启节点时,移动分片会产生大量IO,这是没必要的。往往在重启节点的时候,将这个参数改为primaries。
可以是persistent 持久性的(重启后依旧有效),也可以是 transient 临时性的(完全重启集群后失效)。
Allocation和Rebalancing的区别
Shard allocation is about taking unassigned shard copies and finding each of them a node to inhabit.
Rebalancing is about taking assigned shard copies and moving them to different nodes to even out the distribution of shards.
shard分配是指获取未分配的shard副本,并找到它们中的每一个要驻留的节点。
重新平衡是指获取分配的碎片副本并将其移动到不同的节点,以平衡碎片的分布。
cluster.routing.allocation.cluster_concurrent_rebalance
允许同时多少分片平衡数据,默认值为2,当集群状态为green时,当一个节点加入进来,会执行此操作。
cluster.routing.allocation.node_concurrent_recoveries
从yellow到green的过程中,允许多少个分片平衡
创建index:
curl -XPUT 'http://192.168.1.101:9200/mobile_area' -H 'Content-Type: application/json' -d '"mappings":{"type":{"properties":{"name":{"type": "keyword"},"age":{"type": "keyword"}}}}
'
bulk命令
curl -X POST "localhost:9200/_bulk" -H 'Content-Type: application/json' -d'
{ "index" : { "_index" : "test", "_id" : "1" } }
{ "field1" : "value1" }
{ "delete" : { "_index" : "test", "_id" : "2" } }
{ "create" : { "_index" : "test", "_id" : "3" } }
{ "field1" : "value3" }
{ "update" : {"_id" : "1", "_index" : "test"} }
{ "doc" : {"field2" : "value2"} }
'
curl -X POST "http://192.168.159.128:9200/index_name/_index_type/_bulk" -H 'Content-type: application/json' --data-binary @file_name
文件内容:
{"index":{}}
{"name": "tom", "age": "12"}
{"index":{}}
{"name": "jerry", "age": "15"}
使用kibana进行bulk:
POST bzhan/type/_bulk
{ "index" : {}}
{"name": "jack", "age": "12"}
{ "index" : {}}
{"name": "rose", "age": "23"}
修改副本数量
PUT _settings
{"number_of_replicas": 3
}
查看索引列表
curl -XGET 'http://192.168.171.39:9200/_cat/indices?v'
默认情况下,会把所有的列都显示出来:
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
如果只想要列名:
curl -XGET 'http://192.168.171.39:9200/_cat/indices?v&h=index'
这样就只把列名获取出来了。
elasticsearch 常用命令相关推荐
- ElasticSearch常用命令记录
ElasticSearch常用命令记录 < - 个人学习笔记 - > 软件版本:curl -s localhost:9200/?pretty 输出中"version" ...
- elasticsearch常用命令
1.手动分派分片 curl -XPOST 'http://ip:httpport/_cluster/reroute' -d '{"commands": [{"alloca ...
- 个人常用命令集锦 持续更新
OS 1. 立刻关机 halt 2. centos安装yum apt-get install yum 3. 查找文件夹 find / - name 需要查找文件名称 4. vi里面 查找字符串 &qu ...
- docker删除es数据_Docker的常用命令
Docker的常用命令 docker version#显示docker的版本信息 docker info#显示docker的系统信息,包括镜像和容器的数量 docker --help#docker帮助 ...
- checksum linux 命令_linux常用命令总结
一.find命令 作用:查找文件 [root@server ~]# find / -name elasticsearch /var/log/elasticsearch /var/run/elastic ...
- linux查看nbu数据库命令,NBU基本常用命令
Veritas常用命令: 1. 查看当有运行的任务 bpdbjobs –report | grep Active 2. 停止任务 bpdbjobs –cancel PID (包括主任务和子任务) 3. ...
- docker学习 --Compose 容器编排,常用命令等.集成spring。mysql。redis
一切皆容器 处处云原生 有什么用 写好容器之间的编排调用关系 ,一个命令直接使用,相当于spring中的application.xml 例如你可以编排先启动elasticsearch再启动kabbin ...
- Docker常用命令大全(万字详解)
小熊学Java网站:https://javaxiaobear.gitee.io/,每周持续更新干货,建议收藏! 1.帮助类启动命令 启动docker: systemctl start docker 停 ...
- linux常用命令2
目录 一.基本命令 1.1 关机和重启 1.2 帮助命令 二.目录操作命令 2.1 目录切换 cd 2.2 目录查看 ls [-al] 2.3 目录操作[增,删,改,查] 2.3.1 创建目录[增] ...
最新文章
- java 抽象类 命名,java – 抽象类命名约定
- oracle数据磊导入数据,可传输表空间记载
- 2017年9月11日
- Java黑皮书课后题第8章:*8.27(列排序)用下面的方法实现一个二维数组中的列排序。返回新数组,且原数组保持不变。编写一个测试程序,提示用户输入一个3*3的double型矩阵,显示一个排好的矩阵
- 【Android】页面栈
- [转]google protobuf安装与使用
- 【ES】ES 如何在一个机器上同时模拟多个node
- form表单通过checkbox_HTML表单标签基础
- js时间与毫秒互相转换
- [转载] python set大小_python set集合
- 【NLP新闻-2013.06.16】Representative Reviewing
- Nginx限制访问次数和并发数
- 怎么做QQ、微信等消息气泡
- 注册表知识and技巧大全
- html5制作人物动作,骨骼动画制作新利器:快速制作动作人物动画,省时简单!...
- ubuntu10.10下smbd服务配置——实现主机WinXP与虚拟机Ubuntu10.10共享
- oracle图书操作、sql语句查询+授权、视图、索引、表操作
- 西南交大大学生营养早餐优化食谱
- vue 重置vuex数据
- win10打印机服务器属性修改,Win10专业版中如何更改打印机端口
热门文章
- SQL SERVER 2005中如何获取日期(一个月的最后一日、一年的第一日等等)
- dojo Quick Start/dojo入门手册--json
- SpringBoot图文教程9—SpringBoot 导入导出 Excel 「Apache Poi」(亲测)
- Python打断点(亲测)
- redis常见使用场景下PHP实现
- MySQL: Starting MySQL….. ERROR! The server quit without updating PID file解决办法
- Nginx下Go的多种使用方式性能比较
- Bootstrap的轮播图
- Bug本地接口不返回数据 线上返回数据
- Linux的SERVER_NAME 和HTTP_HOST