Running a replicated Service Locator
Running the Service Locator server in standalone mode is convenient for evaluation, development, and testing. But in production, you should run the Service Locator in replicated mode. A replicated group of servers in the same application is called a quorum, and in replicated mode, all servers in the quorum have copies of the same configuration file. The configuration is similar to the one used in standalone mode, but with a few differences:
tickTime=2000
dataDir=/var/locator
clientPort=2181
maxClientCnxns = 0
initLimit=10
syncLimit=5
server.1=locator_host1:2888:3888
server.2=locator_host2:2888:3888
server.3=locator_host3:2888:3888
-
The new configuration entry, initLimit corresponds to the number of ticks that the initial synchronization phase can take. For initLimit and syncLimit timeouts, the unit of time is specified using tickTime. In this example, the timeout for initLimit is 5 ticks at 2000 milleseconds a tick, or 10 seconds total.
-
The configuration entry syncLimit corresponds to the number of ticks that can pass between sending a request and getting an acknowledgment.
-
The entries of the form server.X list the servers that make up the Service Locator service. When the server starts up, it knows which server it is by looking for the file myid in the data directory. The file myid must be manually created and should contain one line which is the id of the server in ASCII format.
-
Note the two port numbers after each server name: "2888" and "3888". Peers use the former port to connect to other peers. Such a connection is necessary so that peers can communicate, for example, to agree upon the order of updates. More specifically, a Service Locator server uses this port to connect followers to the leader. When a new leader arises, a follower opens a TCP connection to the leader using this port. Because the default leader election also uses TCP, we currently require another port for leader election. This is the second port in the server entry.
Talend ESB uses Apache ZooKeeper as its service locator server. Please see https://cwiki.apache.org/confluence/display/ZOOKEEPER/Index for more information.