GridDB using Fixed List or Multicast Clustering

Introduction

What’s the difference between running GridDB in FIXED_LIST mode vs. Multicast mode?
This guide explains how to set up your GridDB server for FIXED_LIST mode (multicast mode is the default option). This guide will also be useful as reference on how to switch your server back to MULTICAST, if needed. We have also linked references to similar or useful articles for extra reading should your curiosity get the better of you. Beyond learning how to switch to FIXED_LIST, you will also learn how to test your server to make sure it works properly. This article assumes that you have already installed GridDB. If you have not yet installed GridDB, please do that first. You can read some loose instructions in our Raspberry Pi blog, and of course you can download GridDB from GitHub.
Here’s a brief overview before we get to the meat of the guide:
Multicast:  Multicast is easy and efficient, but isn’t supported by most public clouds or VPNs.
Fixed List:  Fixed List works on public clouds and VPNs, but is difficult to set up. Fixed List requires defining the specified nodes inside the config file.

1 – Switch your Server to FIXED_LIST mode

To begin, first change your cluster properties

$  vim $GS_HOME/conf/gs_cluster.json

In the "cluster" brackets, Remove "notificationAddress" and "notificationPort" where:

"cluster":{
    "clusterName":"yourClusterName",
    "replicationNum":2,
    "notificationAddress":"239.0.0.1",
    "notificationPort":20000,
    "notificationInterval":"5s",
    "heartbeatInterval":"5s",
    "loadbalanceCheckInterval":"180s"
},

After you change it, it should look like this:

"cluster":{
    "clusterName":"yourClusterName",
    "replicationNum":2,
    "notificationInterval":"5s",
    "heartbeatInterval":"5s",
    "loadbalanceCheckInterval":"180s"
},

Change "yourClusterName" to your name of choice.
At the end of cluster, add:

"notificationMember": [
           {
           "cluster": {"address":"xx.x.x.x", "port":10010},
           "sync": {"address":"xx.x.x.x", "port":10020},
           "system": {"address":"xx.x.x.x", "port":10040},
           "transaction": {"address":"xx.x.x.x", "port":10001}
           }
],

It should now look like this:

"cluster":{
    "clusterName":"yourClusterName",
    "replicationNum":2,
    "notificationInterval":"5s",
    "heartbeatInterval":"5s",
    "loadbalanceCheckInterval":"180s"
    "notificationMember": [
           {
           "cluster": {"address":"xx.x.x.x", "port":10010},
           "sync": {"address":"xx.x.x.x", "port":10020},
           "system": {"address":"xx.x.x.x", "port":10040},
           "transaction": {"address":"xx.x.x.x", "port":10001}
           }
   ],
},

Where the "xx.x.x.x" is replaced with your actual IP addresses.

  • Note: If you want to add more than one node, so as to store more data, then you need only to add another notificationMember, with a slightly different IP address. (I.E. "xx.x.x.y")

Change your mode from "MULTICAST" to "FIXED_LIST"

$  vim /var/lib/gridstore/admin/conf/repository.json

Find the section “clusters”, and change the mode to "FIXED_LIST". I.e.

"clusters" : [
            {
            "name" : "yourClusterName",
            "mode" : "MULTICAST",
            ...
            }
],

Change these two lines to:

"clusters" : [
            {
            "name" : "your_new_clustername",
            "mode" : "FIXED_LIST",
            ...
            }
],

Now save and exit, i.e. :wq

2 – Test your Server to make sure it is in the correct mode

Start up GridDB

$  sudo su - gsadm

Restart your cluster and use gs_stat to show multicast is working.
Check the specific area "cluster"
Your gs_stat should display something like this, for cluster. Look for the nodeStatus and notificationMode. notificationMode should now be changed to FIXED_LIST.

...
"cluster": {
     ...
      "nodeStatus": "ACTIVE",
      "notificationMode": "FIXED_LIST",
     ...
},
...

Exit out of the GridDB mode

3 – Test Sample1.java to make sure that your Client Server can connect to your Server

Go to your Client Server. Open the editor for Sample1.java

$  cd gridstoreDB/gsSample
$  vim Sample1.java

In public class Sample1, under public static void main(String [] args) throws GSException, change the following lines:

props.setProperty("notificationAddress", args[0]);
props.setProperty("notificationPort", args[1]);
props.setProperty("clusterName", args[2]);
props.setProperty("user", args[3]);
props.setProperty("password", args[4]);

To:

props.setProperty("notificationMember", args[0]);
props.setProperty("clusterName", args[1]);
props.setProperty("user", args[2]);
props.setProperty("password", args[3]);

Save and exit (i.e. using :wq)
Compile your java file

$  javac Sample1.java

Run your java file

$  java Sample1 xx.x.x.x:10001 your_clusterName your_username your_password

This should give you the expected output, as defined in Sample1.java:
Expected Console Output:

Person: name=name02 status=false count=2 lob=[65, 66, 67, 68, 69, 70, 71, 72, 73, 74]
  • Note: This is printed from the System.out.println(...) just above col.commit(); near the end of Sample1.java.

 
If the samples are able to be properly run, then your GridDB server has been confirmed running on FIXED_LIST mode. Now your GridDB server can be utilized on one of the many public cloud providers.
—Resources Used—

 

If you have any questions about the blog, please create a Stack Overflow post here https://stackoverflow.com/questions/ask?tags=griddb .
Make sure that you use the “griddb” tag so our engineers can quickly reply to your questions.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.