elasticsearch not working if I change elasticsearch.yml? - elasticsearch

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!

Related

How to add new node replica to Elasticsearch is running, without to retart service?

My cluster has a yellow health as it has only one single node, so the replicas remain unasigned simply because no other node is available to contain them.
I'am readed help in homepage:
I try add new node-data to my cluster, but it not appear when i check health's cluster.
This is config new node:
cluster.name: elasticsearch
node.name: node-data-1
node.master: false
node.data: true
node.ingest: false
node.ml: false
http.port: 9201
Old config, i don't edit. It's default.
Can someone explain me which files do I've to edit and what commands do I've to launch in order to create another node in my cluster? Do I've to run two ES instance? How can I do this?
Thanks in advance.
Make sure to remove the /data folder from each Elasticsearch install before executing the nodes. Also, in the nodes that won't be the master set the following property:
cluster.initial_master_nodes: ["machine_running_master"]

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 configuration and settings for nodes

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

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

How to config Single node for Single Cluster (Standalone Cluster) ElasticSearch

I installed elastic search in my local machine, I want to configure it as the only one single node in the cluster(Standalone Server). it means whenever I create a new index, it will only available to my server. It will not be accessible to other's server.
My current scenario these indexes are available to other servers (the servers are formed in a cluster), and they can make any changes to my indexes. But I don't want it.
I went through some other blogs but not getting best solution. So can you please let me know steps for same?
I ve got the answer from http://elasticsearch-users.115913.n3.nabble.com/How-to-isolate-elastic-search-node-from-other-nodes-td3977389.html.
Kimchy : You set the node to local(true), this means it will not discover other nodes using network, only within the same JVM.
in elasticsearch/bin/elasticsearch.yml file
node.local: true # disable network
Updated for ES 7.x
in elasticsearch.yml
network.host: 0.0.0.0
discovery.type: single-node
and make sure you have cluster.initial_master_nodes off
# cluster.initial_master_nodes: ["node-1", "node-2"]
credited to #Chandan.
In elasticsearch.yml
# Note, that for development on a local machine, with small indices, it usually
# makes sense to "disable" the distributed features:
#
index.number_of_shards: 1
index.number_of_replicas: 0
Use the same configuration in your code.
Also to isolate the node use node.local: true or discovery.zen.ping.multicast: false
Here's relevant info for ElasticSearch 5:
According to changelog, to enable local mode on ES 5 you need to add transport.type: local to your elasticsearch.yml instead of node.local: true.
If you intend to run Elasticseach on a Single Node and be able to bind it to public IP, two important settings are:
network.host: <PRIVATE IP OF HOST>
discovery.type: single-node
If you're using a network transport in your code, this won't work, as node.local gives you a LocalTransport only:
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-transport.html#_local_transport
The trick then is to set
discovery.zen.ping.multicast: false
in your elasticsearch.yml which will stop your node looking for any other nodes.
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-discovery-zen.html#multicast
I'm not sure if this prevents other nodes from discovering yours though; I only needed this to affect a group of nodes with the same settings on the same network.
I wanted to do this without having to write/overwrite an elasticsearch.yml in my container. Here it is without a config file
Set an environment variable prior to starting elasticsearch:
discovery.type=single-node
https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html
In the config file, add:
network.host: 0.0.0.0 [in Network settings]
discovery.type: single-node [in Discovery and Cluster formation settings]
This solve your problem:
PUT /_all/_settings
{"index.number_of_replicas":0}
Tested with ES version 5.
All of these didn´t help me (and I sadly didn´t read the answer of bhdrkn). The thing that worked for me was to change elasticsearch´s cluster-name everytime I need to have a separate instance, where new nodes aren´t added automatically via multicast.
Just change cluster.name: {{ elasticsearch.clustername }} in elasticsearch.yml, e.g. via Ansible. This is particulary helpful, when building separate Stages like Dev, QA and Production (which is a standard usecase in enterprise-environments).
And if you´re using logstash to get your data into elasticsearch, don´t forget to put the same cluster-name into the output-section, like:
output {
elasticsearch {
cluster => "{{ elasticsearch.clustername }}"
}
}
Otherwise your "logstash-*"-index will not be build correctly...

Resources