Skip navigation links

Package com.tailf.ha

Package for setup and control of High Availability cluster nodes.

See: Description

Package com.tailf.ha Description

Package for setup and control of High Availability cluster nodes.

This package is used to connect to the High Availability (HA) subsystem. Configuration data can then be replicated on several nodes in a cluster.

Example: We set up three nodes in an HA cluster, one as master and the other two as slaves, and afterwards check their state.

 Socket s0 = new Socket("localhost", 4565);
 Socket s1 = new Socket("localhost", 4575);
 Socket s2 = new Socket("localhost", 4585);

 Ha ha0 = new Ha(s0, "clus0");
 Ha ha1 = new Ha(s1, "clus0");
 Ha ha2 = new Ha(s2, "clus0");

 ConfHaNode master =
     new ConfHaNode(new ConfBuf("node0"),
                    new ConfIPv4(InetAddress.getByName("localhost")));


 ha0.beMaster(master.getNodeId());
 ha1.beSlave(new ConfBuf("node1"), master, true);
 ha2.beSlave(new ConfBuf("node2"), master, true);

 HaStatus status0 = ha0.status();
 HaStatus status1 = ha1.status();
 HaStatus status2 = ha2.status();
 
Skip navigation links