2017-05-31 137 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,否則你就有可能得到一個裂腦情況。這比糟糕的連接更可能。