ES权威指南[官方文档学习笔记]-24 Add failover

es:http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/_add_failover.html

下一篇:http://my.oschina.net/qiangzigege/blog/264185

内容:

只有一个节点运行,意味着你有单一故障点:没有冗余备份。
只需要启动另外一个节点。一个新的节点将自动加入集群只要有同样的集群名字,可以互相交互。

此时,我们启动第二个节点,所有的主从分片都正确分配了。
第2个节点已经加入集群,并且三个从分片已经分配给第2个节点,意味着我们可以失去任何一个节点并且数据都是完好无缺的。

那么一个文档要增加,怎样的过程呢?
先根据分片策略,存储在一个主分片里,然后并行复制到对应的从分片,保证我们的文档可以从主分片或者任何一个从分片里查询到。

当前查询集群健康:绿色。
意味着6个分片(3主3从)都是OK的。

{
   "cluster_name":          "elasticsearch",
   "status":                "green", 
   "timed_out":             false,
   "number_of_nodes":       2,
   "number_of_data_nodes":  2,
   "active_primary_shards": 3,
   "active_shards":         6,
   "relocating_shards":     0,
   "initializing_shards":   0,
   "unassigned_shards":     0
}

集群良好!

为了大家理解更深刻:

这里把前后放在一起:

XXX@UBUNTU ~$ curl http://localhost:9200/_cluster/health?pretty
{
  "cluster_name" : "elasticsearch",
  "status" : "yellow",
  "timed_out" : false,
  "number_of_nodes" : 1,
  "number_of_data_nodes" : 1,
  "active_primary_shards" : 10,
  "active_shards" : 10,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 10
}
XXX@UBUNTU ~$ curl http://localhost:9200/_cluster/health?pretty
{
  "cluster_name" : "elasticsearch",
  "status" : "green",
  "timed_out" : false,
  "number_of_nodes" : 2,
  "number_of_data_nodes" : 2,
  "active_primary_shards" : 10,
  "active_shards" : 20,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 0
}


 

转载于:https://my.oschina.net/qiangzigege/blog/264161

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值