User Community Service Desk Downloads
If you can't find the product or version you're looking for, visit support.ataccama.com/downloads

MDM-Zookeeper Interaction

This topic provides detailed information on how MDM interacts with Zookeeper.

In this article, active mode/node = RW mode/node, passive mode/node = RO mode/node.

The MDM Znode Structure on Zookeeper

Below is the description of znodes that mdm creates on the Zookeeper filesystem. These are created in the location specified in the High Availability Component with the zookeeperPath property.

MDM-Zookeeper znodes

/forceNewLeader

  • Contains the name of the node that has been manually set to be the leader and switch to the active mode.

  • All nodes are watching /forceNewLeader for changes.

  • Whenever there is a change, all nodes other than the manually selected (proposed) leader, reconnect to Zookeeper. As the result, the current active node loses leadership and starts switching to the passive mode.

/election

  • Used to select who will be the leader (uses the Curator implementation of Zookeeper’s "Leader Election" recipe).

  • After connecting to Zookeeper, all nodes writes their information here to participate in leader election.

  • All nodes are notified when something changes (any node connects or disconnects).

  • Any node can get a list of other nodes and the name of the current leader node.

/currentActive

  • Contains the name of the node in the active mode.

  • Whenever a new leader is elected, it starts watching /currentActive (it will contain previous leader’s name or nothing).

  • When the former leader finishes switching to the passive mode, it deletes its name from this node.

  • The new leader is notified about the deletion and starts switching to the active mode, after which it writes its name here.

/mode/<clientName>

  • Contains statuses of all nodes connected to Zookeeper on Admin Console or via REST API.

  • The node statuses are ACTIVE, PASSIVE, SWITCHING_TO_ACTIVE, SWITCHING_TO_PASSIVE.

  • <clientName> znodes are ephemeral (they are deleted when the node disconnects from Zookeeper).

Overview of Scenarios

A New MDM Node Connects to Zookeeper

Here is what happens when a new MDM node connects to Zookeeper.

  1. MDM connects to Zookeeper in the RO mode.

  2. MDM registers itself in /election.

  3. If it becomes a leader, it checks if there is another RW instance registered in the /currentActive znode.

    • If there is, it waits at most for maxActiveToPassiveSwitchingTime, switches to the RW mode and registers itself to /currentActive.

    • If there is no previous RW instance registered (which usually means this is the first MDM instance registered), it will switches to the RW mode immediately.

A New Active MDM Node is Set Manually

Here is what happens when a user changes set a new active MDM manually (via a REST call).

Premise: only the client leader can become or is the active MDM.

  1. The name of the upcoming new active node is written to /forceNewLeader.

  2. All other nodes are notified about the change in /forceNewLeader, after which they disconnect and reconnect to Zookeeper. This way the upcoming new active MDM node will be elected leader (first connected)

  3. Switching:

    • The active node starts switching from the active to passive mode.

    • The one who has been set as the new leader, waits until the old leader switches to passive at most maxActivetoPassiveSwitchingTime, after which step 6 happens.

  4. When the upcoming new active MDM has been set leader, it starts listening to /currentActive, which is how it will find about what happens in the next step.

  5. After switching to the passive node, the old active MDM deletes itself from /currentActive.

  6. The new leader is notified about the change in /currentActive and starts switching to the Active mode.

Current Active MDM Node is Disconnected

Here is what happens when the active MDM loses connection with Zookeeper.

  1. Zookeeper selects a new leader (the MDM node that has been connected to Zookeeper the longer).

  2. The MDM node that has been set as the new leader waits until the old leader switches to the passive mode at most maxActivetoPassiveSwitchingTime.

  3. The old active MDM will switch to the passive mode at most after revokeLeadershiponDisconnectTimeout. If MDM is performing a write operation, which cannot be finished during the timeout, the operation is canceled, and the new active MDM will restart it.

Was this page useful?