Fabric8 uses Apache ZooKeeper, which is highly reliable distributed coordination service, as its registry to store the cluster configuration and node registration.
ZooKeeper is designed with consistency and high availability across data centers in mind while also protecting against network splits by using a quorum of ZooKeeper servers. e.g. you may run 3 or 5 ZooKeeper servers and so long as you have quorum running (2 or 3 servers respectively) you are reliable and are not in a network split.
Conceptually Fabric has 2 registries:
There are currently two ways of initializing the fabric registry:
The structure of the registry is a tree like structure similar to a filesystem. Each node of the tree (will be called znode) can hold both data and have children.
Here is how the structure of the registry looks like:
fabric | +----registry (runtime registry) | | | +----containers | | | +----root | +----configs (configuration registry) | +----versions | | | +----1.0 | | | +----profiles | | | +----default | +----containers
Having a single container hosting the registry, doesn't provide high availability. In order to have a highly available registry, we need to add more containers as part of it. The common term used to describe the group of servers that are forming the registry is ensemble. Fabric allows you to dynamically add or remove containers from the ensemble, by using the command line shells in Karaf.
Assuming that we have created a fabric cluster, with a single registry container as described above and that we have already added a couple of containers join the fabric cluster. The list of fabric containers could look like this:
[id] [version] [alive] [profiles] [provision status] root* 1.0 true fabric, fabric-ensemble-0000-1 container1 1.0 true default success container2 1.0 true default success
You could then add container1 and container2 as part of the ensemble using the fabric:ensemble-add command from the shell:
fabric:ensemble-add container1 container2
You can watch the following clip, which demonstrates the above. It actually starts a fresh fabric, install fabric into 2 additional containers in the local network (from scratch using just the shell) and finally adds the containers to the ensemble.
Even though fabric does provide a rich tool set for accessing the registry (both configuration & runtime), working with profiles and managing the containers, there might be cases where someone, needs to access the registry at the zookeeper level. To cover those needs fabric provides a set of commands.
To install the fabric zookeeper commands you need to install the fabric-zookeeper-commands feature.
Please note, that if you want to use that feature inside a managed container, you will have to use the profiles, instead. The commands that are provided are:
In the following video you can see how to install the zookeeper commands and how you can use them to inspect and edit the registry. The example demonstrates how you can use the zookeeper commands to manually assign an extra ip to an existing fabric container.