Unable to access elastic search over network

Hi, I am trying to update elasticsearch.yml file to access elasticsearch over network. but when ever i can configurations and restart services it gives an error.
Here are my configuration
in YML file
network.host = localhost changed to network.host= x.x.x.x
after this configuration restarting elasticsearch.service failed and I am only able to access elasticsearch over local host.
P.S: I have installed elasticsearch, kibana and logstash on single machine.

Try to use discovery.type: single-node if your cluster is 1 node
Check it here , ES use some bootsrap checks when you try to bind to an IP adresse, it force production checks ...

Welcome to our community! :smiley:

It'd help if you shared the error you are seeing from the logs. Please format your code/logs/config using the </> button, or markdown style back ticks. It helps to make things easy to read which helps us help you :slight_smile:

elasticsearch.service - Elasticsearch
   Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Wed 2020-07-15 19:26:22 PKT; 46min ago
     Docs: https://www.elastic.co
  Process: 986 ExecStart=/usr/share/elasticsearch/bin/systemd-entrypoint -p ${PID_DIR}/elasticsearch.pid --quiet (code=exited, status=1/F
 Main PID: 986 (code=exited, status=1/FAILURE)

جولائی 15 19:26:22 elk-elk systemd-entrypoint[986]:         at org.yaml.snakeyaml.scanner.ScannerImpl.needMoreTokens(ScannerImpl.java:2
جولائی 15 19:26:22 elk-elk systemd-entrypoint[986]:         at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:226)
جولائی 15 19:26:22 elk-elk systemd-entrypoint[986]:         at org.yaml.snakeyaml.parser.ParserImpl$ParseBlockMappingKey.produce(Parser
جولائی 15 19:26:22 elk-elk systemd-entrypoint[986]:         at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:158)
جولائی 15 19:26:22 elk-elk systemd-entrypoint[986]:         at org.yaml.snakeyaml.parser.ParserImpl.getEvent(ParserImpl.java:168)
جولائی 15 19:26:22 elk-elk systemd-entrypoint[986]:         at com.fasterxml.jackson.dataformat.yaml.YAMLParser.nextToken(YAMLParser.ja
جولائی 15 19:26:22 elk-elk systemd-entrypoint[986]:         ... 14 more
جولائی 15 19:26:22 elk-elk systemd[1]: elasticsearch.service: Main process exited, code=exited, status=1/FAILURE
جولائی 15 19:26:22 elk-elk systemd[1]: elasticsearch.service: Failed with result 'exit-code'.
جولائی 15 19:26:22 elk-elk systemd[1]: Failed to start Elasticsearch.
lines 1-17/17 (END)

did you add discovery.type: single-node to your elasticsearch.yml ?

yes i tried this but still same error

can you share your elasticsearch.yml


# NOTE: Elasticsearch comes with reasonable defaults for most settings.
#       Before you set out to tweak and tune the configuration, make sure you
#       understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please consult the documentation for further information on configuration options:
# https://www.elastic.co/guide/en/elasticsearch/reference/index.html
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: Name
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
#node.name: node-1
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
path.data: /var/lib/elasticsearch
#
# Path to log files:
#
path.logs: /var/log/elasticsearch
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
#bootstrap.memory_lock: true
#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: localhost
#
# Set a custom port for HTTP:
#
#http.port: 9200
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when this node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
#discovery.seed_hosts: ["host1", "host2"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
#cluster.initial_master_nodes: ["node-1", "node-2"]
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
#gateway.recover_after_nodes: 3
#
# For more information, consult the gateway module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true

Resolved this issue.

Please share the solution in the thread, it might help someone in future :slight_smile:

So, here is what i did,
there is a line which is commented

discovery.seed_hosts: ["host1","host2"]

here I entered IP of my host and 0.0.0.0
and in network.host I entered 0.0.0.0
after this configuration when i restarted service it started and elasticsearch is accessible over network

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.