MongoDB replica set演示和实验服务

mongolab提供了一个flip-flop 正反器的replica set复制集演示,其通过一个真实的replica set来演示自动的failover。 该真实环境包括三个节点:replica member “flip”和”flop”。每60秒,primary将会自己让自己不可用”step-down”,之后集群将failover到另一个节点上,60秒后再反转回来。

 

URL: http://mongolab.org/flip-flop/

 

同时mongolab还提供了一个可视化的replica set  的election过程

Screen Shot 2015-05-25 at 12.07.29 PM

 

样例日志:

Logs will start streaming when there is replica set activity. Please wait...

arbiter: Sun May 24 20:43:03.373 [rsHealthPoll] replSet member flop.mongolab.com:54117 is now in state SECONDARY
arbiter: Sun May 24 20:43:07.386 [rsHealthPoll] replSet member flip.mongolab.com:53117 is now in state PRIMARY
arbiter: Sun May 24 20:44:03.460 [rsHealthPoll] replSet member flip.mongolab.com:53117 is now in state SECONDARY
arbiter: Sun May 24 20:44:09.545 [rsHealthPoll] replSet member flop.mongolab.com:54117 is now in state PRIMARY
arbiter: Sun May 24 20:45:03.641 [rsHealthPoll] replSet member flop.mongolab.com:54117 is now in state SECONDARY
arbiter: Sun May 24 20:45:13.669 [rsHealthPoll] replSet member flip.mongolab.com:53117 is now in state PRIMARY
arbiter: Sun May 24 20:46:01.764 [rsHealthPoll] DBClientCursor::init call() failed
arbiter: Sun May 24 20:46:01.804 [rsHealthPoll] replSet info flip.mongolab.com:53117 is down (or slow to respond): DBClientBase::findN: transport error: flip.mongolab.com:53117 ns: local.$cmd query: { getnonce: 1 }
arbiter: Sun May 24 20:46:01.805 [rsHealthPoll] replSet member flip.mongolab.com:53117 is now in state DOWN
arbiter: Sun May 24 20:46:03.815 [rsHealthPoll] replSet member flip.mongolab.com:53117 is up
arbiter: Sun May 24 20:46:03.816 [rsHealthPoll] replSet member flip.mongolab.com:53117 is now in state SECONDARY
arbiter: Sun May 24 20:46:07.774 [rsHealthPoll] replSet member flop.mongolab.com:54117 is now in state PRIMARY
arbiter: Sun May 24 20:47:03.863 [rsHealthPoll] replSet member flop.mongolab.com:54117 is now in state SECONDARY
Sun May 24 20:47:03.863 [rsMgr] replSet I don't see a primary and I can't elect myself
arbiter: Sun May 24 20:47:13.910 [rsHealthPoll] replSet member flip.mongolab.com:53117 is now in state PRIMARY
arbiter: Sun May 24 20:48:03.990 [rsHealthPoll] replSet member flip.mongolab.com:53117 is now in state SECONDARY
arbiter: Sun May 24 20:48:07.992 [rsHealthPoll] replSet member flop.mongolab.com:54117 is now in state PRIMARY
arbiter: Sun May 24 20:49:04.080 [rsHealthPoll] replSet member flop.mongolab.com:54117 is now in state SECONDARY
arbiter: Sun May 24 20:49:14.141 [rsHealthPoll] replSet member flip.mongolab.com:53117 is now in state PRIMARY
arbiter: Sun May 24 20:50:04.252 [rsHealthPoll] replSet member flip.mongolab.com:53117 is now in state SECONDARY
arbiter: Sun May 24 20:50:14.265 [rsHealthPoll] replSet member flop.mongolab.com:54117 is now in state PRIMARY
arbiter: Sun May 24 20:51:04.350 [rsHealthPoll] replSet member flop.mongolab.com:54117 is now in state SECONDARY
arbiter: Sun May 24 20:51:14.456 [rsHealthPoll] replSet member flip.mongolab.com:53117 is now in state PRIMARY
arbiter: Sun May 24 20:52:04.569 [rsHealthPoll] replSet member flip.mongolab.com:53117 is now in state SECONDARY
arbiter: Sun May 24 20:52:08.573 [rsHealthPoll] replSet member flop.mongolab.com:54117 is now in state PRIMARY
arbiter: Sun May 24 20:53:02.660 [rsHealthPoll] replSet member flop.mongolab.com:54117 is now in state SECONDARY
arbiter: Sun May 24 20:53:08.675 [rsHealthPoll] replSet member flip.mongolab.com:53117 is now in state PRIMARY
arbiter: Sun May 24 20:54:02.839 [rsHealthPoll] replSet member flip.mongolab.com:53117 is now in state SECONDARY
arbiter: Sun May 24 20:54:12.951 [rsHealthPoll] replSet member flop.mongolab.com:54117 is now in state PRIMARY
arbiter: Sun May 24 20:55:03.255 [rsHealthPoll] replSet member flop.mongolab.com:54117 is now in state SECONDARY
arbiter: Sun May 24 20:55:08.948 [rsHealthPoll] replSet member flip.mongolab.com:53117 is now in state PRIMARY
arbiter: Sun May 24 20:56:03.017 [rsHealthPoll] replSet member flip.mongolab.com:53117 is now in state SECONDARY
arbiter: Sun May 24 20:56:09.024 [rsMgr] replSet I don't see a primary and I can't elect myself


 

 

flip-flop 的初衷是为了可视化演示复制集的election过程,让开发者能更清楚了解这一过程,以便能写出更好的客户端连接代码。同时mongolab还给出了一个连接URL:

mongodb://testdbuser:testdbpass@flip.mongolab.com:53117,flop.mongolab.com:54117/testdb

Comment

*

沪ICP备14014813号-2

沪公网安备 31010802001379号