2017-05-31 98 views
0

设置2节点群集。一个节点(数据库)运行在我们的主生产服务器上,另一个节点运行在我们的仓库中。与仓库的连接非常糟糕。群集配置Couchdb 2.0

您会建议什么配置以确保文档始终可用于本地服务器?

我发现文档混淆。

http://docs.couchdb.org/en/2.0.0/cluster/theory.html

[cluster] 
q=8 
r=2 
w=2 
n=3 
q - The number of shards. 
r - The number of copies of a document with the same revision that 
have to be read before CouchDB returns with a 200 and the document. If 
there is only one copy of the document accessible, then that is 
returned with 200. 
w - The number of nodes that need to save a document before a write is 
returned with 201. If the nodes saving the document is <w but >0, 202 
is returned. 
n - The number of copies there is of every document. Replicas. 

从这个我想我的配置应该是

q=8 - To allow up to 8 nodes, not that we plan to but no harm? 
r=1 - Only need to read the local copy? 
w=1 - Only need to write to the local copy? 
n=2 - Should this just be the number of nodes so you can always go 
down to one node? So if I had 4 nodes n=4? 

而且我相信这些CONFIGS必须是之前设置你创建数据库,因为这是当分片发生。我还应该注意哪些其他问题?如将数据库连接到集群的配置

我试图在本地设置此配置,并且在服务器出现故障时无法读取数据库问题。

所有帮助表示感谢,非常感谢。

瑞安

+1

由于您的数据库不在同一地点,因此您可能最好使用两个单节点实例进行复制,而不是将它们作为群集进行复制。 –

+0

关于群集的好处是任何创建的表/数据库都会自动复制,而不必进行设置。你说得对,这可能是更好的方法。经验是我需要它后我会得到的:) –

+1

是的,我不是很熟悉新的集群功能,因为我是旧式复制,所以我首先会达到的:P –

回答

0

我想你应该有3个节点最小由于QUOROM,否则你就有可能得到一个裂脑情况。这比糟糕的连接更可能。