将 Zookeeper 与 Solr 一起使用,但只有 2 个服务器 [英] Using Zookeeper with Solr but only have 2 servers

查看:23
本文介绍了将 Zookeeper 与 Solr 一起使用,但只有 2 个服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Solr 的新手,正在试验 SolrCloud - 似乎 ZooKeeper 是管理高可用性的最佳方式.

I am new to Solr and am experimenting with SolrCloud - and it seems that ZooKeeper is the best way to manage high availability.

然而,在我们的生产环境中,我们只有两台服务器(主动-主动),我担心 Zookeeper 在两台服务器上并不理想,因为如果其中任何一个出现故障,整个集成都会停止工作.目前的解决方法是在 server1 上运行两个 ZK,在 server2 上运行一个 ZK,这样至少如果 server2 宕机,我们仍然有法定人数(但如果 server1 宕机,游戏结束).

However, in our production environment we only have two servers (active-active) and I am concerned that Zookeeper is not ideal on two servers because if either of them goes down the whole ensemble stops working. The workaround so far is to run two ZKs on server1 and one ZK on server2, so that at least if server2 goes down we still have quorum (but if server1 goes down, game over).

在这种情况下,Solr 的最佳实践/推荐解决方案是什么?它可以在不使用 zookeeper 的情况下在 2 个服务器之间使用 SolrCloud 自动复制/故障转移吗?或者有什么方法可以使用 Zookeeper(或其他工具?)以便它在 2 个服务器上健壮?还是我必须重新使用旧模式复制?

What is the best practice / recommended solution for Solr in this scenario? Can it automatically replicate/fail over with SolrCloud between 2 servers without using zookeeper? Or is there some way to use Zookeeper (or another tool?) so that it is robust over 2 servers? Or do I have to go back to using the legacy-mode replication?

谢谢!

推荐答案

您将需要 2 台以上的服务器.生产 Zookeeper 集成至少需要 3 个实例,并且应该始终是奇数:

You are going to need more than 2 servers. A production Zookeeper ensemble needs at least 3 instances and should always be an odd number:

三个 ZooKeeper 服务器是一个最小推荐大小ensemble,我们还建议它们在不同的机器上运行.

Three ZooKeeper servers is the minimum recommended size for an ensemble, and we also recommend that they run on separate machines.

为了获得可靠的 ZooKeeper 服务,您应该将 ZooKeeper 部署在一个集群称为集合.只要大多数合奏已启动,该服务将可用.因为 Zookeeper 需要一个大多数,最好使用奇数台机器.例如,四台机器ZooKeeper只能处理一个故障机器;如果两台机器出现故障,剩下的两台机器不会构成多数.然而,在五台机器上,ZooKeeper 可以处理两台机器的故障.

For reliable ZooKeeper service, you should deploy ZooKeeper in a cluster known as an ensemble. As long as a majority of the ensemble are up, the service will be available. Because Zookeeper requires a majority, it is best to use an odd number of machines. For example, with four machines ZooKeeper can only handle the failure of a single machine; if two machines fail, the remaining two machines do not constitute a majority. However, with five machines ZooKeeper can handle the failure of two machines.

http://zookeeper.apache.org/doc/r3.1.2/zookeeperAdmin.html

在 1 个服务器上运行 2 个实例并不能真正解决问题,因为失去该服务器会杀死集群.Solr Cloud 需要 Zookeeper - 你无法绕过它.

Running 2 instances on 1 server doesn't really cut it, as losing that server will kill the cluster. Solr Cloud requires Zookeeper - you can't get around it.

设置外部 ZooKeeper 集合

虽然 Solr 与 Apache ZooKeeper 捆绑在一起,但您应该考虑自己不鼓励在生产中使用这个内部 ZooKeeper,因为关闭冗余 Solr 实例也会关闭它的 ZooKeeper 服务器,它可能不是那么多余.因为一个ZooKeeper 集合的法定人数必须超过其服务器的一半在任何给定时间运行,这可能是一个问题.

Although Solr comes bundled with Apache ZooKeeper, you should consider yourself discouraged from using this internal ZooKeeper in production, because shutting down a redundant Solr instance will also shut down its ZooKeeper server, which might not be quite so redundant. Because a ZooKeeper ensemble must have a quorum of more than half its servers running at any given time, this can be a problem.

解决这个问题的办法是设置一个外部的ZooKeeper合奏.

The solution to this problem is to set up an external ZooKeeper ensemble.

https://cwiki.apache.org/confluence/display/solr/Setting+Up+an+External+ZooKeeper+Ensemble

一般来说,尝试在少于 3 个服务器的情况下运行真正的分布式、大规模处理是一个坏主意 - Zookeeper 并不是唯一的,因为它需要至少 3 个服务器才能在服务器出现故障时支持可靠的操作.通常,您需要法定数量的存活服务器 (N/2+1) 才能运行,因此您需要从至少 3 个开始.

Generally speaking trying to run truly distributed, large scale processing with less than 3 servers is a bad idea - Zookeeper is not unique in it's requirement for at least 3 servers to support reliable operation if a server fails. Generally you need a quorum of surviving servers (N/2+1) to function, so you need to start with at least 3.

这篇关于将 Zookeeper 与 Solr 一起使用,但只有 2 个服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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