Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to setup Elasticsearch client nodes?

I have couple of Elasticsearch questions regarding client node:

  1. Can I say: any nodes as long as they are opening HTTP port, I can treat them as "client" nodes, because we can do search/index through this node.

  2. Actually we treat the node as client node when the cluster=false and data=false, if I set up 10 client nodes, do I need to route in my client side, I mean if I specify clientOne:9200 in my code as ES portal, then would clientOne forward other HTTP requests to other client nodes, otherwise, clientOne would be under very high pressure. i.e do they communicate with each other between client nodes?

  3. When I specify client nodes in ES cluster, should I close other nodes' HTTP port? Because we can only query client nodes.

  4. Do you think it's necessary to set up both data node and client node in the same machine, or just setup data node acts as client node as well, anyways it's in the same machine?

  5. If the ES cluster would be heavily/frequently indexed while less searched, then I don't have to set up client node, because client node good for gathering data, right please?

  6. For general search/index purpose should I use http port or tcp port, what's the difference in clients perspective please?

like image 330
Jack Avatar asked Nov 18 '15 20:11

Jack


People also ask

What is client node in Elasticsearch?

Any node which is neither a master ( node. master is set to false) nor data ( node. data is set to false) becomes the client node. Being the client node, it behaves as a load balancer that routes the requests and search to the right nodes.

How do I create a node in Elasticsearch?

To enroll new nodes in your cluster, create an enrollment token with the elasticsearch-create-enrollment-token tool on any existing node in your cluster. You can then start a new node with the --enrollment-token parameter so that it joins an existing cluster.

How do I connect to Elasticsearch client?

There are two ways to connect to your Elasticsearch cluster: Through the RESTful API or through the Java transport client. Both ways use an endpoint URL that includes a port, such as https://ec47fc4d2c53414e1307e85726d4b9bb.us-east-1.aws.found.io:9243 .

What is client node?

Client Nodes refer to virtual or physical servers. Lab Management distinguishes between the virtual and the physical in these instances: Virtual machines can be migrated from one physical machine to another through the Lab Management Web User Interface.


1 Answers

  1. Yes, you can send queries via http to any node that has port 9200 open.

  2. With node.data: false and node.master: false, you get a "client node". These are useful for offloading indexing and search traffic from your data nodes. If you have 10 of them, you would want to put a load balancer in front of them.

  3. Closing the data node's http port (http.enabled: false) would keep them from serving client requests (probably good), though it would also prevent you from curl'ing them directly for stats, etc.

  4. Client nodes are useful (see #2), so I wouldn't route traffic directly to your data nodes. Whether you run both a client and data node on the same piece of hardware would be dependent on the config of that machine (do you have sufficient RAM, etc).

  5. Client node are also useful for indexing, because they know which data node should receive the data for storage. If you sent an indexing request to a random data node instead, the odds would be high that it would have to redirect that request to another node. That's a waste of time and resources, if you can create client nodes.

  6. Having your clients join the cluster might give them access to more information about the cluster, but using http gives them a more generic "black box" interface. With http, you also don't have to keep your clients at the same version as your ES nodes.

Hope that helps.

like image 164
Alain Collins Avatar answered Sep 25 '22 07:09

Alain Collins