BlueZero (BØ)
Middleware for distributed applications
|
When distributing nodes across multiple machines, you must make sure that:
Nodes by default will try to reach resolver at tcp://localhost:22000, which only works when testing all nodes on the same machine. When the resolver node is on another machine, (for example the machine hostname is resolver-node-host.local) the environment variable B0_RESOLVER must be set to the correct address, e.g.:
prior to launching every node, or in .bashrc or similar.
When B0_RESOLVER is not specified it defaults to "tcp://localhost:22000".
Nodes also need to be able to reach each other node. When a node creates a directly addressed socket, such as b0::ServiceClient or b0::ServiceServer, it will advertise that socket name and address to resolver.
Since there is no reliable way of automatically determining the correct IP address of the node (as there may be more than one), by default the node will use its hostname when specifying the socket TCP address.
This requires that all machines are able to reach each other by their hostnames. This is the case when there is a name resolution service behind, such as a DNS, or Avahi/ZeroConf/Bonjour.
Suppose we have a network with two machines: A and B. Machine A hostname is alice.local, and machine B hostname is bob.local.
If from machine A we are able to reach (ping) machine B by using its hostname bob.local, and vice-versa, from machine B we are able to reach machine A by using its hostname alice.local, there is no additional configuration to set. Otherwise, we need to explicitly tell how a machine is reached from outside (i.e. what's the correct IP or hostname), by setting the B0_HOST_ID environment variable, e.g.:
When B0_HOST_ID is not specified it defaults to the machine hostname.
Suppose we have a network with two machines: A and B.
By default, nodes will use their hostnames when announcing socket addresses. We override this behavior, by setting B0_HOST_ID to the machine IP address.
On machine A we run
to run the resolver node.
On machine A we run
to run the subscriber node.
Note that for this machine we don't need to specify B0_RESOLVER, because the default value (tcp://localhost:22000) is good to reach the resolver socket.
On machine B we run
to run the publisher node.