Setting up Cluster with a Single Master

left to right direction
actor clientapi1
actor clientapi2

node "Master 1" as M1
node "Worker 1" as W1
node "Worker 2" as W2
node "Worker 3" as W3

M1 --> W1
M1 --> W2
M1 --> W3

clientapi1 ==> M1
clientapi2 ==> M1

Prerequisites

Hint

All worker nodes that will be included in the cluster (will be connected to the same master) must be configured identically (apart from the repository name and label). A worker configuration template file, worker.ttl, is included in the GraphDB EE distribution.

Tip

GraphDB does not impose any requirements on naming the master and the worker repositories that will be used in the same cluster. For production environment, where each master or worker repository is hosted in a separate GraphDB installation, we recommend using a common name as it will facilitate the automated deployment and configuration of the GraphDB cluster. For other setups, we recommend using distinct names for each repository, e.g., master1, master2, worker1, worker2, worker3, and so on. This will help you identify the particular master or worker when you look at the logs or when you manage your repositories through the GraphDB Workbench.

Initial GraphDB nodes list

General procedure

  1. Create and configure Master1.

  2. Create and configure Worker1, Worker2 and Worker3.

  3. If the machine where each repository is installed does not have a GraphDB Workbench deployed, or if you are not using the RDF4J console for initialization, you have to initialize the repository yourself by executing the command:

    curl http://master-ip:7201/repositories/m1/size
    curl http://master-ip:7301/repositories/w1/size
    curl http://master-ip:7302/repositories/w1/size
    curl http://master-ip:7303/repositories/w1/size
    
  4. Link Worker1 to Master1 using the WorkerID SPARQL endpoint URL.

    Jolokia:

    http://master-ip:7201/jolokia/exec/ReplicationCluster:name=ClusterInfo!/m1/addClusterNode/http:!/!/worker-ip:7301!/repositories!/w1/0/true
    

    cURL:

    curl -H 'content-type: application/json' \
      -d "{\"type\":\"exec\",\"mbean\":\"ReplicationCluster:name=ClusterInfo\/m1\",\"operation\":\"addClusterNode\",\"arguments\":[\"http://worker-ip:7301/repositories/w1\",0,true]}" \
      http://master-ip:7201/jolokia/
    
  5. Link the 2nd worker to Master1 using the WorkerID SPARQL endpoint URL.

    Jolokia:

    http://master-ip:7201/jolokia/exec/ReplicationCluster:name=ClusterInfo!/m1/addClusterNode/http:!/!/worker-ip:7302!/repositories!/w1/0/true
    

    cURL:

    curl -H 'content-type: application/json' \
      -d "{\"type\":\"exec\",\"mbean\":\"ReplicationCluster:name=ClusterInfo\/m1\",\"operation\":\"addClusterNode\",\"arguments\":[\"http://worker-ip:7302/repositories/w1\",0,true]}" \
      http://master-ip:7201/jolokia/
    
  6. Link the 3rd worker to Master1 using the WorkerID SPARQL endpoint URL.

    Jolokia:

    http://master-ip:7201/jolokia/exec/ReplicationCluster:name=ClusterInfo!/m1/addClusterNode/http:!/!/worker-ip:7303!/repositories!/w1/0/true
    

    cURL:

    curl -H 'content-type: application/json' \
      -d "{\"type\":\"exec\",\"mbean\":\"ReplicationCluster:name=ClusterInfo\/m1\",\"operation\":\"addClusterNode\",\"arguments\":[\"http://worker-ip:7303/repositories/w1\",0,true]}" \
      http://master-ip:7201/jolokia/
    
  7. Check the workers nodes state using the JMX attribute NodeStatus. The result list should contain all linked nodes and their state should be: ON.

    Jolokia:

    http://master-ip:7201/jolokia/read/ReplicationCluster:name=ClusterInfo!/m1/NodeStatus
    

    cURL:

    curl -H 'content-type: application/json' \
      -d "{\"type\":\"read\",\"mbean\":\"ReplicationCluster:name=ClusterInfo\/m1\",\"attribute\":\"NodeStatus\"}" \
      http://master-ip:7201/jolokia/
    

Note

Use the “!” symbol for escaping characters when necessary in Jolokia requests.

Note

Using basic HTTP authentication may be required for accessing the HTTP-JMX bridge.