Error to start Elasticsearch (Main process, code=exited, status=78/CONFIG)

Viewed 1817

Folks,

I'm running elasticsearch 7.15 on Ubuntu 20.04 and I was getting several errors while trying to start it. Logstash and Kibana was installed, too.

Errors:

ā— elasticsearch.service - Elasticsearch
     Loaded: loaded (/lib/systemd/system/elasticsearch.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Wed 2021-11-10 00:47:30 -03; 10s ago
       Docs: https://www.elastic.co
    Process: 151459 ExecStart=/usr/share/elasticsearch/bin/systemd-entrypoint -p ${PID_DIR}/elasticsearch.pid --quiet (code=exited, status=78)
   Main PID: 151459 (code=exited, status=78)

nov 10 00:47:15 user systemd-entrypoint[151459]: WARNING: A terminally deprecated method in java.lang.System has been called
nov 10 00:47:15 user systemd-entrypoint[151459]: WARNING: System::setSecurityManager has been called by org.elasticsearch.bootstrap.Security (file:/us>
nov 10 00:47:15 user systemd-entrypoint[151459]: WARNING: Please consider reporting this to the maintainers of org.elasticsearch.bootstrap.Security
nov 10 00:47:15 user systemd-entrypoint[151459]: WARNING: System::setSecurityManager will be removed in a future release
nov 10 00:47:29 user systemd-entrypoint[151459]: ERROR: [1] bootstrap checks failed. You must address the points described in the following [1] lines >
nov 10 00:47:29 user systemd-entrypoint[151459]: bootstrap check failure [1] of [1]: initial heap size [4294967296] not equal to maximum heap size [85>
nov 10 00:47:29 user systemd-entrypoint[151459]: ERROR: Elasticsearch did not exit normally - check the logs at /var/log/elasticsearch/node-1.l>
nov 10 00:47:30 user systemd[1]: elasticsearch.service: Main process exited, code=exited, status=78/CONFIG
nov 10 00:47:30 user systemd[1]: elasticsearch.service: Failed with result 'exit-code'.
nov 10 00:47:30 user systemd[1]: Failed to start Elasticsearch.

Following is my original /etc/elasticsearch/elastic.yml:

# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: my-cluster
#
# ------------------------------------ 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 -----------------------------------
#
# By default Elasticsearch is only accessible on localhost. Set a different
# address here to expose this node on the network:
#
network.host: 10.0.0.134
#
# By default Elasticsearch listens for HTTP traffic on the first free port it
# finds starting at 9200. Set a specific HTTP port here:
#
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.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true

Basically, since my file /etc/elasticsearch/elastic.yml was binding my local IP address, which was 10.0.0.134 and is not a localhost, elasticsearch considers I'm working in production mode. It justifies the error status=78. Also, if this is a production deployment, you should set one of these settings. If this is a test deployment only then you can either bind to localhost or else use single-node discovery to avoid the bootstrap checks.

I spent some days troubleshooting and testing different changes to make it working, but had no success.

Source: https://discuss.elastic.co/t/not-starting-elasticsearch-for-some-reason-i-cant-undestand/177092/2

1 Answers

Finally, I could find a solution that worked fine. The following was included at the end of the file /etc/elasticsearch/jvm.options:

# Bootstrap checking 
-Des.enforce.bootstrap.checks=true

Basically, if you run a single node in a production environment, there may be guided to avoid checks (by not bound to the external transport interface, or bound to the external interface type to and find single-node). In this case, you can through the system property es.enforce.bootstrap.checks is set true to enforce a guide check using the advice above. If you are in this situation, it is strongly recommended that you do so, this system can be used to enforce property inspection guide, in a standalone configuration node.

Source: https://titanwolf.org/Network/Articles/Article?AID=758bb4e6-75e0-4cd8-9454-b9d2a4fed892

Related