Adding a follower node

You can add a follower node to the cluster after the leader node has been started, by specifying the --follower flag for the follower Dgraph process.

Before starting a Dgraph process that will serve as a follower node, ensure that the leader node has been started, and the Cluster Coordinator service is running on the leader node. Note the host name and port of your Cluster Coordinator service, so that you can specify them when starting the Dgraph process as the follower node.

The Dgraph flag --follower <node_name> specifies the follower node, where <node_name> is the name of the follower node. This name must be unique across the cluster. The name must also be a valid directory name (characters such as slashes (/) are not allowed).

Important: If you start a node without this flag, the Cluster Coordinator assumes this is the leader node. Since there can be only one leader node in the cluster, it is important to start just one node without the --follower flag. In fact, the Dgraph process will not start if it is asked to be the leader node when a leader node already exists.

Note that for follower nodes, you do not need to use the create-ds command to create the follower data store. Instead, you use the attach-ds command with a unique data store name, and use the same data files location as the leader node.

To attach the data store and start the Dgraph process as a follower node:

  1. Go to the directory Oracle\Endeca\Server<version>\endeca-cmd.
  2. Attach the data store on the node with the endeca-cmd command tool as in the following example, specifying a unique name of the follower node in the --follower flag for the Dgraph process:
    endeca-cmd attach-ds MyDataStore2 
    --ws-port 5557 
    --data-files z:\shared_MyDataStore\MyDataStore 
    --args 
     --follower FollowerNode1 
     --coordinator_port 2181
     --coordinator_host My_cluster_coordinator_server.com
     --log c:\MyDataStore\dgraph2.log 
     --out c:\MyDataStore\dgraph2.out
    In this example:
    • MyDataStore2 is the name of this Endeca data store (which will be a follower).
    • 5557 is the Dgraph process port. This is the port of the follower node.
    • z:\shared_MyDataStore\MyDataStore is the location of the existing data files for the leader data store, which resides on a shared file system. All follower nodes in your cluster must point to the same location of the data files on a shared file system and have read access to them.
    • The lines after the --args flag represent the flags that you are specifying for the Dgraph process hosted on this Oracle Endeca Server for your data store.
    • FollowerNode1 is the name of the follower node.
    • The --coordinator_host and --coordinator_port reference the host name and port of the Cluster Coordinator service. This service uses the host name of the leader node, and the port 2181 (unless you configure the Cluster Coordinator to use another port).
    • Specifying the locations of the log and output files is optional.

    The node FollowerNode1 is now known to the Cluster Coordinator as a follower node — when changes occur to the data files stored on a shared disk, the Cluster Coordinator notifies this node to start using the new version of the data files.

  3. Proceed by adding additional follower nodes if needed.
    For each follower node:
    • Specify (in the attach-ds command) a different name for the both the Endeca data store and the argument to the --follower flag.
    • Reference the host name and port of the Cluster Coordinator service.
    • Ensure that the location of the leader node's data files is referenced in the same way on a shared file system as for other nodes in the cluster.
    Note: Since there is one Cluster Coordinator service running on the leader node, you can add more than one follower node, all referencing the same Cluster Coordinator service host name and port.

If a follower node fails, the cluster continues to run. Once you identify a follower node failure, restart the follower node with the same name and the node will join the cluster.