Elasticsearch configuration and settings for nodes - elasticsearch

I have just installed ElasticSearch 5.0.0. When I run localhost:9200/_cat/nodes?v it gives me ip as 10.57.203.16. But I want localhost as a server. Where should I configure it ?

What if you add the below line to your elasticsearch.yml ,restart the ES and then try querying for the available nodes:
network.host: 127.0.0.1
EDIT:
Try adding a node name in your elasticsearch.yml :
node.name: elastic_test1

Related

How to change Elasticsearch network host

I've install ES on my VM which it has an OS of centos 7. It network.host: bind to the localhost. I can browse via port 9200.
My problem is that I've changed the network host to:0.0.0.0 (So I can get public access from my host PC).
the service started but the port is not listening.
I want to access ES from my host PC.
How can i change the network.host ?
I faced same issue in elasticsearch 7.3.0 version. I resolved by putting following
values in /etc/elasticsearch/elasticsearch.yaml as shown below
network.host: 127.0.0.1
http.host: 0.0.0.0
If you are planning to set network.host other than default(127.0.0.1) then change following details in /etc/elasticsearch/elasticsearch.yml
network.host: 0.0.0.0
discovery.seed_hosts: []
Looking at the Elasticsearch Network Settings documentation, it doesn't appear that 0.0.0.0 is a valid setting for network.host.
Try instead the special value _global_. So the section of your elasticsearch.yaml might look like this:
network:
host: _global_
This should tell Elasticsearch to listen on all network interfaces.
Since the version 7.3 of Elastic Search, it's necessary to put the following line
cluster.initial_master_nodes: node-1
network.host: 0.0.0.0
If your application is running on AWS and Elastic search is running on different host
network.host: YOUR_AWS_PRIVATE_IP
This works for me.

elasticsearch not working if I change elasticsearch.yml?

I'm very new to elasticsearch. I'm trying to change elasticsearch.yml like node.name or node.cluster after this my localhost:9200 does't loads
any idea
Probably you omit space after : in settings.
Wrong settings:
node.name:node1
cluster.name:cluster1
Correct Settings:
node.name: node1
cluster.name: cluster1
Obviously elastic settings is in yml format, and in yml you must watch out spaces and tabs!

How to configure two app server nodes to connect to same elasticsearch cluster?

I have one code base to connect elastic search (localhost:9200) for the full-text-search feature. We deployed this code on two different machines (m1 & m2) under load balancing server. In this case, how to configure ES in 2 different machines to connect ES and index should reflect both sides.
I am using Elasticsearch v 5.1.2
Machine 1
cluster.name: production
node.name: database
Machine 2
cluster.name: production
node.name: app
Above setting worked on ES v 1.7.1
**Question?
What configuration should I do to make it work on ES v5.1.2?
Please help me to solve this issue.
Thanks in advance
I'm assuming these nodes aren't a part of same cluster.
Try http://MACHINE_1_IP:9200/_cat/nodes?v and check if all nodes are listed as part of cluster.
If they are not - just a quick guess, have you looked at network.host setting ? It binds to local loop by default ( That maybe something introduced in 2 + )
This can be solved by using network-module setting (ref).
Update the elasticsearch.yml on both app server by keeping same cluster name and different node name
EX :
Server_1
update the elasticseach.yml
cluster.name: Production
node.name: APP
network.host: [server_1_IP, _local_]
discovery.zen.ping.unicast.hosts: [server_1_IP, server_2_IP]
On Server_2
update the elasticseach.yml
cluster.name: Production
node.name: DB
network.host: [server_2_IP, _local_]
discovery.zen.ping.unicast.hosts: [server_1_IP, server_2_IP]

Elasticsearch Cluster set up problems

I am building a cluster with elasticsearch. I download the elasticsearch file as a zip file and unzip it in the /opt file. And these are the two IPs I am using for trial, 172.16.30.51 and 172.16.30.52.
I have come across with some problems. I have tried to amend the host files and add server IP.
sudo vi /etc/hosts
172.16.30.51 elasticnode01
172.16.30.52 elasticnode02
Also, in Server elasticnode01 :
cd /opt/elasticsearch
vi config/elasticsearch.yml
I amend the following code.
cluster.name: mycluster
node.name: "elasticnode01"
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["elasticnode02"]
In Server elasticnode02 :
cd /opt/elasticsearch
vi config/elasticsearch.yml
I amend the following code.
cluster.name: mycluster
node.name: "elasticnode02"
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["elasticnode01"]
Then finally I run the command
bin/elasticsearch &
It seems fine but as soon as I run
curl 'localhost:9200/_cat/nodes?v'
It returns
host ip heap.percent ram.percent load node.role master name
127.0.0.1 127.0.0.1 4 39 0.20 d * elasticnode01
Would anyone mind telling me what is the problem? Thanks.
Since ES 2.0, the ES server binds to localhost by default, so they won't be able to discover each other.
You need to configure network.host on both servers, like this:
On elasticnode01:
network.host: elasticnode01
On elasticnode02:
network.host: elasticnode02

Elastic search not accessible remotely

I am trying to access Elastic Search remotely, but getting connection error.
When I curl localhost:9200 in the remote server, I get the desired output. But remotely server_address:9200 is not accessible.
Any suggestions?
In elasticsearch.yml file modify/add network.host setting as below.
network.host: 0.0.0.0
and then restart your elasticsearch server.
Change (/etc/elasticsearch/elasticsearch.yml)network_host IP to your server private IP address.Then the ES can be access with same network range.
network.host: "192.168.xx.xx"
http.port: 9200
Edit your elasticsearch.yml file.
network.host: server_ip
http.port: 9200
transport.tcp.port: 9300

Resources