About Brokers and Peering

A domain must contain at least one broker. Any additional brokers or agents join the domain by securely connecting (peering) into the domain by means of another broker or agent. The brokers communicate by pinging each other to make sure they are still available. Here is a simple example of how a peer network begins:

B1, B2, and B3 are brokers. Each broker is on its own physical host in the domain. The brokers are configured but not started. This means the NuoDB software has been installed and the default.properties file on each host has been edited to have settings that are appropriate for the domain. A1 is an agent that is also on its own machine and also configured but not started. The difference in the configuration of an agent as opposed to a broker is that the broker property in the default.properties file is set to false for an agent.

The settings in the default.properties files indicate the following:

In other words, the setting of the peer property is the same in each of the default.properties files on the three hosts. On each host, the value of the peer property is the hostname and port for the machine on which B1 is running.

If B1 is started first, it becomes the leader broker. The leader broker performs the liveliness checks for the domain peers and determines if another broker (peer) is no longer responding. After B2 and B3 are started, they would peer into the domain through B1.

All brokers have a last known state for the domain, so they can be restarted in any order and will reconnect properly. The initial peer used to connect to the domain no longer matters.

A NuoDB domain can be expanded dynamically by starting additional agents or brokers on new hosts, and peering them into the domain. The incoming broker or agent only needs to connect to any existing brokers in the domain by using the correct values for the domain and domainPassword properties plus an existing broker's address and port. See Creating the Domain and Adding Hosts. Also, a broker can be removed dynamically and gracefully from the domain.

In summary: