Ask is moving to Stack Overflow and! Please use the "opendaylight" tag on either of these sites. This site is now in Read-Only mode

Revision history [back]

click to hide/show revision 1
initial version

DeJuan it's possible to do this but I'm afraid to suggest how because a formal API and documentation for this does not exist.

The long answer

By default you cannot control which cluster node becomes the leader of the Shard as we simply use Raft algorithm to determine the leader. Raft uses an election mechanism to determine the leader.

The only way to workaround Raft is to disable the election mechanism. To do that we came up with something called a RaftPolicy, this policy determines if elections should happen or not. Which policy is used is determined by configuration which is done in org.opendaylight.controller.cluster.datastore.cfg. You would need to set the RaftPolicy to DisableElectionsRaftPolicy.

Once the policy is set and you restart the nodes in the cluster you will notice that all the shard replica's will remain in the Follower state. You can now use JMX to switch the Shard states to Leader from the ShardManager MBean. If you use Jolokia you could then do the switching of behaviors using REST.

Again I would not recommend doing any of these things in production unless you have a very good way to externalize the election mechanism because if you get it wrong you will lose data.

There are a lot of specifics I am leaving out in this answer because I am not sure I want people using this. If you really must and are willing to experiment with an unpublished API/mechanism let me know and I will provide further details.