集群状态

集群状态

简单的集群管理

(1)快速检查集群的健康状态

ES提供一种cat api 可以查看ES中各种各样的数据

GET /_cat/health?v
                                           节点总数
epoch      timestamp  cluster       status node.total node.data shards pri relo init unassign pending_tasks max_task_wait_time active_shards_percent 
1512394355  21:32:35  elasticsearch yellow          1         1      1   1    0    0        1          0                  -                 50.0%

如何快速了解集群的监控状况?green 、yellow、red green: 每个索引的primary shard 和replica shard 都是active状态的 yellow: 每个索引的primary shard都是active状态,但部分replica shard处于非active状态(即不可用) red:不是所有索引的primary shard都是active状态,部分索引数据丢失。

我们现在就一个笔记本电脑,就启动了一个es进程,相当于就只有一个node。现在es进程中有一个index,就是kibana自己内置建立的index。 由于默认的ES配置是给每个index分配5个primary shard和5个replica shard,而且primary shard和replica shard不能在同一台机器上(为了容错)。 现在kibana自己建立的index是1个primary shard和1个replica shard。当前就一个node,所以只有1个primary shard被分配了和启动了,但是一个replica shard没有第二台机器去启动。 做一个小实验(再解压一个ES,再启动改ES):此时只要启动第二个es进程,就会在es集群中有2个node,然后那1个replica shard就会自动分配过去,然后cluster status就会变成green状态。

(2)查看集群中有哪些索引?

GET /_cat/indices?v
health status index   uuid                   pri rep docs.count docs.deleted store.size pri.store.size
yellow open   .kibana qaHIS5VeReWFG7vTLYBQbQ   1   1    1      0      3.1kb     3.1kb

(3)简单的索引操作

创建索引

PUT /test_index?pretty

查询状态

GET _cat/indices?v
health status index      uuid                   pri rep docs.count docs.deleted store.size pri.store.size
yellow open   .kibana    qaHIS5VeReWFG7vTLYBQbQ   1   1          1            0      3.1kb          3.1kb
yellow open   test_index -FxZcYc9TNqYRZcYYViY6Q   5   1          0            0       650b           650b

删除索引

DELETE /test_index?pretty

查询状态

GET _cat/indices?v
health status index   uuid                   pri rep docs.count docs.deleted store.size pri.store.size
yellow open   .kibana qaHIS5VeReWFG7vTLYBQbQ   1   1          1            0      3.1kb          3.1kb

转载于:https://my.oschina.net/grittan/blog/3018019

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值