elasticsearch:添加副本的步骤? [英] elasticsearch: Steps to add replica?

查看:145
本文介绍了elasticsearch:添加副本的步骤?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在生产中只有一台ES服务器.

We have a single ES server, in production.

我们现在想在另一个DC中添加一个副本,以进行热/热备用故障转移.

We would now like to add a replica, in another DC, as a warm/hot spare fail over.

我知道如何在mongo,redis等上执行此操作,但是似乎找不到有关如何在ES上执行操作的文档.(ES文档似乎假设系统都在同一子网中,等等)

I know how to do this on mongo, redis, etc, but cannot seem to find the docs on how to do it to ES. (ES docs seem to assume the systems are all on same subnet, etc)

推荐答案

Elasticsearch以云的形式存在,这意味着,如果您有副本,则它们的行为类似于主-主模式.如果一台服务器关闭,其他服务器将自动接管.在为文档建立索引时,它也在返回之前在副本中建立索引,从而保持数据的一致性.

Elasticsearch exists as a cloud, means if you have replicas they act sort of a master-master mode. If one server is down other will automatically take over. When indexing a documents it indexes in the replica also before returning thereby maintaining consistency of data.

集群可以有零个或多个副本,可以使用以下更新设置api在运行时对其进行配置

A cluster can have zero or more replicas and it can be configured runtime using the update settings api as below

curl -XPUT 'localhost:9200/your_index/_settings' -d '
{
    "index" : {
        "number_of_replicas" : 1
    }
}'

仅当有足够多的节点在运行时才会创建副本(碎片的副本永远不会在与主副本相同的节点中存在).如果无法分配副本,则群集将进入黄色状态.

The replicas will be created only if there is enough nodes running(replica of a shard will never exist in the same node as it's primary). Your cluster will go into yellow state if the replicas could not be assigned.

在新的DC中,启动一个具有相同集群名称的新Elasticsearch节点.如果您使用的是默认配置,则无需进行任何更改,只需要使节点使用相同的群集名称以彼此发现即可,否则可能需要在网络配置中进行更改.

In your new DC start a new elasticsearch node having same cluster name. If you are using default configurations you need not do any changes except making same cluster name for the nodes to discover each other else changes may be required to do in the network configuration.

警告:建议不要在单独的DC中为同一群集创建副本或elasticsearch节点,因为网络延迟会影响性能.此外,它可能会影响群集的稳定性.

caution: it is not recommended to have a replica or elasticsearch nodes for same cluster in separate DC as network latency can impact the performance. Moreover it may affect the cluster stability.

如果打算在单独的DC中备份数据,则可以考虑使用

If you intend have a backup of data in a separate DC, you may consider using the snapshot

这篇关于elasticsearch:添加副本的步骤?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆