ElasticSearch Synchronization on Cluster Server Setup


(Nitin) #1

I am starting to implement elastic search in my project. The project is J2EE application deployed on Weblogic Clustered environment. Which means my java classes would be present at different locations/nodes in a cluster. If I use Elastic search Java api to put/get data , will it look only for the ES nodes on that particular node or throughout my Weblogic Cluster setup. If only local node , then what should I do to make sure all the logs from my Applications Server nodes are in sync.
Should I go for one single node at a location and use that location in all my classes to put/get data? If yes, then a small code snippet would be helpful.

Regards


(David Pilato) #2

You can imagine launching an elasticsearch node local to every single weblogic instance but with:

node.data: false
node.master: false

in elasticsearch.yml file. You will have a client node.

Then in your application, just use a TransportClient which connects locally to the local elasticsearch node (basically to 127.0.0.1:9300).

All client nodes will write/read to/from your elasticsearch cluster which will run on its own on other machines.

Make sense?


(Nitin) #3

Yes makes sense David.
Just one thing : You say- "in elasticsearch.yml file. You will have a client node."
I understand, I will have to set the IP address and port of ES data cluster.
Which property to be set in yaml to do this?
Forgive my ignorance, I am just a beginner in the area.

Regards


(David Pilato) #4

I meant that you download elasticsearch, unzip, then modify the existing config/elasticsearch.yml file and set in it:

node.data: false
node.master: false

# And probably:
cluster.name: yourclustername
network.host: _eth0_
discovery.zen.ping.unicast.hosts: [ "x.x.x.x:9300", "x.x.x.y:9300", "x.x.x.z:9300" ]

Where x.x.x.* are the IP of your cluster.

Then launch your local node with bin/elasticsearch. It will join the cluster (which is running at x.x.x.*).

Then in your java code, use the transport client as I described.


(Nitin) #5

Got iT.. Will try the same Thanks :+1:


(system) #6