Configuring Elasticsearch Cluster
Before you start, ensure that the Elasticsearch is not started after API Gateway installation.
To configure an Elasticsearch cluster 1. If you have started API Gateway before setting up the Elasticsearch cluster configuration, perform the following steps before proceeding to the configuration step:
Log off and exit from
API Gateway.
Delete the nodes folder from the
SAG_root\InternalDataStore\data folder.
Make the necessary cluster configuration and start
API Gateway.
Start Elasticsearch.
A node is created in the Elasticsearch cluster.
2. Open elasticsearch.yml from SAG_root/InternalDataStore/config/elasticsearch.yml in any node that you want to cluster.
The following configuration is a sample of how the configuration appears initially.
cluster.name:"SAG_EventDataStore"
node.name: node1
path.logs: SAG_root\InternalDataStore/logs
network.host:0.0.0.0
http.port:9240
discovery.seed_hosts: ["node1:9340"]
transport.tcp.port:9340
path.repo:['SAG_root\InternalDataStore/archives']
cluster.initial_master_nodes:["node1"]
discovery.seed_hosts. You provide a list of nodes to the Elasticsearch that it should try to contact. Once the node contacts a member of the unicast list, it receives a full cluster state that lists all nodes in the cluster. It then proceeds to contact the master and join the cluster.
path.repo. This is the location where the Elasticsearch writes the snapshots to. Hence, it is important to have a location that is accessible to all the nodes. This is a common location for all the Elasticsearch nodes in the cluster and acts as a shared folder so that all the Elasticsearch nodes can access the same location.
cluster.initial_master_nodes. This parameter must be set so that when you start a cluster for the first time cluster bootstrapping is performed. The parameter must contain the names of the master-eligible nodes in the initial cluster and must be defined on every master-eligible node in the cluster. This setting helps prevent split-brain, the existence of two masters in a single cluster.
3. Provide the name of the cluster in the cluster.name property.
Nodes with same cluster names form a cluster. That is, if there are three nodes in the cluster, the value in the cluster.name property must be same across all three nodes. In other words, Elasticsearch forms a cluster with nodes that have the same cluster.name.
For example,
cluster.name:"SAG_EventDataStore"
4. Provide the names of all participating nodes, as seen in the node.name property, and the ports they use, as seen in the http.port property, in the discovery.seed_hosts property in the following format:
host_name:port_name
If there are three nodes in the cluster, the value in the discovery.seed_hosts property is as shown in this example:
discovery.seed_hosts: ["node1:9340","node2:9340","node3":"9340"]
The names of all nodes appear in the cluster.initial_master_nodes property. The node name displayed in this property is same as seen in the node.name property.
Sample configuration of a node is as follows:
cluster.name:"SAG_EventDataStore"
node.name: node1
path.logs: SAG_root\InternalDataStore/logs
network.host:0.0.0.0
http.port:9240
discovery.seed_hosts: ["hostname1:9340","hostname2:9340","hostname3:9340"]
transport.tcp.port:9340
path.repo:['SAG_root\InternalDataStore/archives']
cluster.initial_master_nodes:["node1","node2","node3"]
The specified nodes are clustered.