HA relay example


I am referring to the examples given for ha (‘dummy’ folder). The setup came up fine and things are working properly. Now when I want to turn one node as a relay (as explained in section 24.8 of documents), I am not able to create the setup.

  1. Created node0 as master and node1, node2, node3 as slaves (all on same host - with the same ports given in sample)
  2. Moved node3 to none state using ctrl. (later I wanted it to be relay-slave)
  3. Added handling to support relay in ‘ctrl’ and trying to change the state of node2 to ‘relay’ - by calling confd_ha_berelay but I get this error “Failed to bind relay socket for HA” (CONFD_ERR_HA_BIND)


You can’t run a setup with relay slave(s) on a single host, since both the “master master” and the relay slave(s) need to listen on the same TCP port (/confdConfig/ha/port) - the “immediate” slave(s) (whether relay or not) connect to the “master master”, and the “sub-slave(s)” connect to their respective relay slave, all on the same port. And of course there is no real point in having both master and slaves on the same host in any actual HA setup - the ‘dummy’ example does this just to make it simple to run.

By the way, the confd_cmd utility has support also for setting a node as relay slave:

$ confd_cmd -h commands
master <nodename>
  Tell ConfD to become master
slave <nodename> <mastername> <masteraddr> [async]
  Tell ConfD to become slave
  Tell ConfD to exit HA "be_none()"
  Tell ConfD to become relay (when slave)
dead_slave <nodename>
  Tell ConfD that the slave <nodename> is dead
  Get ConfD HA status

(I.e. you need to use slave first, then relay.)

Hi, Thanks for the suggestion

I had multiple interfaces in that host - so I created different confd.conf files (node0, node1 - use one IP and node2, node3 - use another IP)

./confd_cmd -a -c “master node0”
./confd_cmd -a -p 4575 -c “slave node1 node0”
./confd_cmd -a -p 4585 -c “slave node2 node0”
./confd_cmd -a -p 4585 -c “relay node2 node0”
./confd_cmd -a -p 4595 -c “slave node3 node2”

And that worked.

Yes, that will work for a test setup, but with different addresses configured for /confdConfig/ha/ip, failover etc becomes even more complex than it already is for a “normal” relay-slave setup…