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过程
样例日志:
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 arbiter: Sun May 24 20:56:13.589 [rsHealthPoll] replSet member flop.mongolab.com:54117 is now in state PRIMARY arbiter: Sun May 24 20:57:03.715 [rsHealthPoll] replSet member flop.mongolab.com:54117 is now in state SECONDARY arbiter: Sun May 24 20:57:09.102 [rsHealthPoll] replSet member flip.mongolab.com:53117 is now in state PRIMARY Logs will start streaming when there is replica set activity. Please wait... arbiter: Sun May 24 20:58:03.207 [rsHealthPoll] replSet member flip.mongolab.com:53117 is now in state SECONDARY arbiter: Sun May 24 20:58:13.883 [rsHealthPoll] replSet member flop.mongolab.com:54117 is now in state PRIMARY arbiter: Sun May 24 20:59:03.943 [rsHealthPoll] replSet member flop.mongolab.com:54117 is now in state SECONDARY arbiter: Sun May 24 20:59:09.296 [rsHealthPoll] replSet member flip.mongolab.com:53117 is now in state PRIMARY arbiter: Sun May 24 21:00:07.483 [rsHealthPoll] replSet member flip.mongolab.com:53117 is now in state SECONDARY arbiter: Sun May 24 21:00:16.073 [rsHealthPoll] replSet member flop.mongolab.com:54117 is now in state PRIMARY arbiter: Sun May 24 21:01:04.148 [rsHealthPoll] replSet member flop.mongolab.com:54117 is now in state SECONDARY arbiter: Sun May 24 21:01:09.575 [rsHealthPoll] replSet member flip.mongolab.com:53117 is now in state PRIMARY arbiter: Sun May 24 21:02:03.686 [rsHealthPoll] replSet member flip.mongolab.com:53117 is now in state SECONDARY arbiter: Sun May 24 21:02:14.276 [rsHealthPoll] replSet member flop.mongolab.com:54117 is now in state PRIMARY Logs will start streaming when there is replica set activity. Please wait... arbiter: Sun May 24 21:03:02.330 [rsHealthPoll] replSet member flop.mongolab.com:54117 is now in state SECONDARY arbiter: Sun May 24 21:03:07.781 [rsHealthPoll] replSet member flip.mongolab.com:53117 is now in state PRIMARY arbiter: Sun May 24 21:04:03.927 [rsHealthPoll] replSet member flip.mongolab.com:53117 is now in state SECONDARY arbiter: Sun May 24 21:04:12.457 [rsHealthPoll] replSet member flop.mongolab.com:54117 is now in state PRIMARY arbiter: Sun May 24 21:05:04.583 [rsHealthPoll] replSet member flop.mongolab.com:54117 is now in state SECONDARY arbiter: Sun May 24 21:05:10.095 [rsMgr] replSet I don't see a primary and I can't elect myself arbiter: Sun May 24 21:05:14.100 [rsHealthPoll] replSet member flip.mongolab.com:53117 is now in state PRIMARY arbiter: Sun May 24 21:06:04.193 [rsHealthPoll] replSet member flip.mongolab.com:53117 is now in state SECONDARY arbiter: Sun May 24 21:06:12.718 [rsHealthPoll] replSet member flop.mongolab.com:54117 is now in state PRIMARY arbiter: Sun May 24 21:07:04.892 [rsHealthPoll] replSet member flop.mongolab.com:54117 is now in state SECONDARY arbiter: Sun May 24 21:07:14.399 [rsHealthPoll] replSet member flip.mongolab.com:53117 is now in state PRIMARY arbiter: Sun May 24 21:08:04.480 [rsHealthPoll] replSet member flip.mongolab.com:53117 is now in state SECONDARY