Rancher MongoDB副本集公开主副本

Rancher MongoDB副本集公开主副本,mongodb,rancher,Mongodb,Rancher,我已经安装了Rancher目录中的MongoDB副本集,并且启动良好。接下来要做的合乎逻辑的事情是公开主机,以便我可以配置和使用它。我已经看到,我可以使用负载平衡器公开27017 TCP端口,但这将进行循环,而不是与mongo主机建立关联 Rancher中有没有一种方法可以只暴露主人?考虑使用HAProxy来实现这一点,因为它概述了这种方法: listen mongodb_cluster bind 10.0.0.10:27017 option tcp-check # MongoDB Wir

我已经安装了Rancher目录中的MongoDB副本集,并且启动良好。接下来要做的合乎逻辑的事情是公开主机,以便我可以配置和使用它。我已经看到,我可以使用负载平衡器公开27017 TCP端口,但这将进行循环,而不是与mongo主机建立关联


Rancher中有没有一种方法可以只暴露主人?

考虑使用HAProxy来实现这一点,因为它概述了这种方法:

listen mongodb_cluster
 bind 10.0.0.10:27017
 option tcp-check
 # MongoDB Wire Protocol
 tcp-check send-binary 3a000000 # Message Length (58)
 tcp-check send-binary EEEEEEEE # Request ID (random value)
 tcp-check send-binary 00000000 # Response To (nothing)
 tcp-check send-binary d4070000 # OpCode (Query)
 tcp-check send-binary 00000000 # Query Flags
 tcp-check send-binary 61646d696e2e # fullCollectionName (admin.$cmd)
 tcp-check send-binary 24636d6400 # continued
 tcp-check send-binary 00000000 # NumToSkip
 tcp-check send-binary FFFFFFFF # NumToReturn
 # Start of Document
 tcp-check send-binary 13000000 # Document Length (19)
 tcp-check send-binary 10 # Type (Int32)
 tcp-check send-binary 69736d617374657200 # ismaster:
 tcp-check send-binary 01000000 # Value : 1
 tcp-check send-binary 00 # Term

tcp-check expect binary 69736d61737465720001 #ismaster True

option tcpka
 option tcplog
 server mongo-node-01 10.0.0.11:27017 check inter 2000
 server mongo-node-02 10.0.0.12:27017 check inter 2000

我也不明白。所有mongodb实例都公开在私有网络上,所以我只是收集了它们的IP,并以
mongodb://{privateip1}:27017、{privateip2}:27017、{privateip3}:27017morpheus-dev
的形式输入了一个连接字符串,我认为有更好的方法可以做到这一点是的,这并不理想,因为您将在所有这些主机上使用该端口。我认为最好的办法就是让HAProxy来做这件事。