[root@ns3160182 ~]# journalctl -u elasticsearch
— Logs begin at Sat 2021—02—13 16:48:02 CET, end at Sat 2021—03—06 11:12:02 CET. —
Mar 06 11:10:01 ns3160182.ip—151—106—34.eu systemd[1]: Starting Elasticsearch...
Mar 06 11:10:24 ns3160182.ip—151—106—34.eu systemd—entrypoint[10234]: fatal error in thread [main], exiting
Mar 06 11:10:24 ns3160182.ip—151—106—34.eu systemd—entrypoint[10234]: java.lang.NoClassDefFoundError: Could not initialize class com.sun.jna.Native
Mar 06 11:10:24 ns3160182.ip—151—106—34.eu systemd—entrypoint[10234]: at org.elasticsearch.systemd.Libsystemd.lambda$static$0(Libsystemd.java:34)
Mar 06 11:10:24 ns3160182.ip—151—106—34.eu systemd—entrypoint[10234]: at java.base/java.security.AccessController.doPrivileged(AccessController.java:312)
Mar 06 11:10:24 ns3160182.ip—151—106—34.eu systemd—entrypoint[10234]: at org.elasticsearch.systemd.Libsystemd.<clinit>(Libsystemd.java:33)
Mar 06 11:10:24 ns3160182.ip—151—106—34.eu systemd—entrypoint[10234]: at org.elasticsearch.systemd.SystemdPlugin.sd_notify(SystemdPlugin.java:126)
Mar 06 11:10:24 ns3160182.ip—151—106—34.eu systemd—entrypoint[10234]: at org.elasticsearch.systemd.SystemdPlugin.onNodeStarted(SystemdPlugin.java:137)
Mar 06 11:10:24 ns3160182.ip—151—106—34.eu systemd—entrypoint[10234]: at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
Mar 06 11:10:24 ns3160182.ip—151—106—34.eu systemd—entrypoint[10234]: at org.elasticsearch.node.Node.start(Node.java:902)
Mar 06 11:10:24 ns3160182.ip—151—106—34.eu systemd—entrypoint[10234]: at org.elasticsearch.bootstrap.Bootstrap.start(Bootstrap.java:317)
Mar 06 11:10:24 ns3160182.ip—151—106—34.eu systemd—entrypoint[10234]: at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:402)
Mar 06 11:10:24 ns3160182.ip—151—106—34.eu systemd—entrypoint[10234]: at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:170)
Mar 06 11:10:24 ns3160182.ip—151—106—34.eu systemd—entrypoint[10234]: at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:161)
Mar 06 11:10:24 ns3160182.ip—151—106—34.eu systemd—entrypoint[10234]: at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86)
Mar 06 11:10:24 ns3160182.ip—151—106—34.eu systemd—entrypoint[10234]: at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:127)
Mar 06 11:10:24 ns3160182.ip—151—106—34.eu systemd—entrypoint[10234]: at org.elasticsearch.cli.Command.main(Command.java:90)
Mar 06 11:10:24 ns3160182.ip—151—106—34.eu systemd—entrypoint[10234]: at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:126)
Mar 06 11:10:24 ns3160182.ip—151—106—34.eu systemd—entrypoint[10234]: at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92)
Mar 06 11:10:24 ns3160182.ip—151—106—34.eu systemd[1]: elasticsearch.service: main process exited, code=exited, status=1/FAILURE
Mar 06 11:10:24 ns3160182.ip—151—106—34.eu systemd[1]: Failed to start Elasticsearch.
Mar 06 11:10:24 ns3160182.ip—151—106—34.eu systemd[1]: Unit elasticsearch.service entered failed state.
Mar 06 11:10:24 ns3160182.ip—151—106—34.eu systemd[1]: elasticsearch.service failed.
[root@ns3160182 ~]#
Here’s how I solved
Firstly, Open /etc/elasticsearch/elasticsearch.yml
in your nano editor using the command below:
sudo nano /etc/elasticsearch/elasticsearch.yml
Your network settings should be:
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 127.0.0.1
#
# Set a custom port for HTTP:
#
http.port: 9200
In order for Elasticsearch to allow connections from localhost, and to also listen on port 9200
.
Next, run the code below to determine the cause of the error:
journalctl -xe
Error 1
There is insufficient memory for the Java Runtime Environment to continue
Solution
As a JVM application, the Elasticsearch main server process only utilizes memory devoted to the JVM. The required memory may depend on the JVM used (32- or 64-bit). The memory used by JVM usually consists of:
- heap space (configured via
-Xms
and-Xmx
) - metaspace (limited by the amount of available native memory)
- internal JVM (usually tens of Mb)
- OS-dependent memory features like memory-mapped files.
Elasticsearch mostly depends on the heap memory, and this setting manually by passing the -Xms
and -Xmx
(heap space) option to the JVM running the Elasticsearch server.
Solution
Open /etc/elasticsearch/jvm.options
in your nano editor using the command below:
sudo nano /etc/elasticsearch/jvm.options
First, un-comment the value of Xmx
and Xms
Next, modify the value of -Xms
and -Xmx
to no more than 50% of your physical RAM. The value for these settings depends on the amount of RAM available on your server and Elasticsearch requires memory for purposes other than the JVM heap and it is important to leave space for this.
Minimum requirements: If your physical RAM is <= 1 GB
Then, your settings should be:
# Xms represents the initial size of total heap space
# Xmx represents the maximum size of total heap space
-Xms128m
-Xmx128m
OR
# Xms represents the initial size of total heap space
# Xmx represents the maximum size of total heap space
-Xms256m
-Xmx256m
Medium requirements: If your physical RAM is >= 2 GB but <= 4 GB
Then, your settings should be:
# Xms represents the initial size of total heap space
# Xmx represents the maximum size of total heap space
-Xms512m
-Xmx512m
OR
# Xms represents the initial size of total heap space
# Xmx represents the maximum size of total heap space
-Xms750m
-Xmx750m
Large requirements: If your physical RAM is >= 4 GB but <= 8 GB
Then, your settings should be:
# Xms represents the initial size of total heap space
# Xmx represents the maximum size of total heap space
-Xms1024m
-Xmx1024m
OR
# Xms represents the initial size of total heap space
# Xmx represents the maximum size of total heap space
-Xms2048m
-Xmx2048m
Note: If your physical RAM is >= 8 GB you can decide how much heap space you want to allocate to Elasticsearch. You can allocate -Xms2048m
and -Xmx2048m
OR -Xms4g
and -Xmx4g
or even higher for better performance based on your available resources.
Error 2
Initial heap size not equal to the maximum heap size
Solution
Ensure the value of -Xms
and Xmx
are equal. That is, say, you are using the minimum requirements since your physical RAM is <= 1 GB, instead of this:
# Xms represents the initial size of total heap space
# Xmx represents the maximum size of total heap space
-Xms128m
-Xmx256m
it should be this:
# Xms represents the initial size of total heap space
# Xmx represents the maximum size of total heap space
-Xms128m
-Xmx128m
OR this:
# Xms represents the initial size of total heap space
# Xmx represents the maximum size of total heap space
-Xms256m
-Xmx256m
Error 3
the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
Solution
Open /etc/elasticsearch/elasticsearch.yml
in your nano editor using the command below:
sudo nano /etc/elasticsearch/elasticsearch.yml
Your discovery settings should be:
# 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: []
Once all the errors are fixed run the command below to start and confirm the status of Elasticsearch:
sudo systemctl start elasticsearch
sudo systemctl status elasticsearch
That’s all.
I hope this helps
-
#1
in order to install magento 2.4 i need to install elasticsearch 7.x in whm cpanel
but I get errors and the service does not start.
I followed this guide:
How To Install & Run Elasticsearch
Introduction Please bear in mind that this guide only explains how to install Elasticsearch Version: 6.8.12. Additionally, there is no information regarding the provision and configuration of Elas…
support.cpanel.net
but I have this error:
Code:
[email protected] ~]# vim /etc/sysconfig/elasticsearch
[[email protected] ~]# systemctl daemon-reload
[[email protected] ~]# systemctl cat elasticsearch --no-pager | grep -Eiv "(^#.*|^$)" | grep -i TMPDIR
[[email protected] ~]# cat /etc/systemd/system/elasticsearch.service.d/tmp_dir
cat: /etc/systemd/system/elasticsearch.service.d/tmp_dir: No such file or directory
[[email protected] ~]# sudo cat /etc/systemd/system/elasticsearch.service.d/tmp_dir
cat: /etc/systemd/system/elasticsearch.service.d/tmp_dir: No such file or directory
[[email protected] ~]# systemctl daemon-reload
[roo[email protected] ~]# systemctl daemon-reload
[[email protected] ~]# systemctl cat elasticsearch --no-pager | grep -Eiv "(^#.*|^$)" | grep -i TMPDIR
[[email protected] ~]# vim /etc/sysconfig/elasticsearch
[[email protected] ~]# systemctl cat elasticsearch --no-pager | grep -Eiv "(^#.*|^$)" | grep -i TMPDIR
[[email protected] ~]# vim /etc/sysconfig/elasticsearch
[[email protected] ~]# systemctl daemon-reload
[[email protected] ~]# systemctl cat elasticsearch --no-pager | grep -Eiv "(^#.*|^$)" | grep -i TMPDIR
[[email protected] ~]# cat /etc/systemd/system/elasticsearch.service.d/tmp_dir
cat: /etc/systemd/system/elasticsearch.service.d/tmp_dir: No such file or directory
[[email protected] ~]# sudo cat /etc/systemd/system/elasticsearch.service.d/tmp_dir
cat: /etc/systemd/system/elasticsearch.service.d/tmp_dir: No such file or directory
[[email protected] ~]# /bin/systemctl start elasticsearch.service
Job for elasticsearch.service failed because the control process exited with error code. See "systemctl status elasticsearch.service" and "journalctl -xe" for details.
[[email protected] ~]# systemctl cat elasticsearch --no-pager | grep -Eiv "(^#.*|^$)" | grep -i TMPDIR
[[email protected] ~]# systemctl daemon-reload
[[email protected] ~]# systemctl cat elasticsearch --no-pager | grep -Eiv "(^#.*|^$)" | grep -i TMPDIR
[[email protected] ~]# cat /etc/systemd/system/elasticsearch.service.d/tmp_dir
cat: /etc/systemd/system/elasticsearch.service.d/tmp_dir: No such file or directory
[[email protected] ~]# systemctl status elasticsearch.service
● elasticsearch.service - Elasticsearch
Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Sat 2021-01-02 18:37:30 EET; 24min ago
Docs: https://www.elastic.co
Main PID: 3743 (code=exited, status=1/FAILURE)
Jan 02 18:37:30 srv6.le.com systemd-entrypoint[3743]: at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:161)
Jan 02 18:37:30 srv6.le.com systemd-entrypoint[3743]: at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86)
Jan 02 18:37:30 srv6.le.com systemd-entrypoint[3743]: at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:127)
Jan 02 18:37:30 srv6.le.com systemd-entrypoint[3743]: at org.elasticsearch.cli.Command.main(Command.java:90)
Jan 02 18:37:30 srv6.le.com systemd-entrypoint[3743]: at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:126)
Jan 02 18:37:30 srv6.le.com systemd-entrypoint[3743]: at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92)
Jan 02 18:37:30 srv6.le.com systemd[1]: elasticsearch.service: main process exited, code=exited, status=1/FAILURE
Jan 02 18:37:30 srv6.le.com systemd[1]: Failed to start Elasticsearch.
Jan 02 18:37:30 srv6.le.com systemd[1]: Unit elasticsearch.service entered failed state.
Jan 02 18:37:30 le.com systemd[1]: elasticsearch.service failed.
[[email protected] ~]#
my /etc/sysconfig/elasticsearch file
Code:
################################
# Elasticsearch
################################
# Elasticsearch home directory
#ES_HOME=/usr/share/elasticsearch
# Elasticsearch Java path
#JAVA_HOME=
#
#
#####AGGIUNTO A MANO--------------------------------------------------------????????
ES_TMPDIR=/tmp
#
# Elasticsearch configuration directory
# Note: this setting will be shared with command-line tools
ES_PATH_CONF=/etc/elasticsearch
# Elasticsearch PID directory
#PID_DIR=/var/run/elasticsearch
# Additional Java OPTS
#ES_JAVA_OPTS=
# Configure restart on package upgrade (true, every other setting will lead to not restarting)
#RESTART_ON_UPGRADE=true
################################
# Elasticsearch service
################################
# SysV init.d
# The number of seconds to wait before checking if Elasticsearch started successfully as a daemon process
ES_STARTUP_SLEEP_TIME=5
################################
# System properties
################################
# Specifies the maximum file descriptor number that can be opened by this process
# When using Systemd, this setting is ignored and the LimitNOFILE defined in
# /usr/lib/systemd/system/elasticsearch.service takes precedence
#MAX_OPEN_FILES=65535
# The maximum number of bytes of memory that may be locked into RAM
# Set to "unlimited" if you use the 'bootstrap.memory_lock: true' option
# in elasticsearch.yml.
# When using systemd, LimitMEMLOCK must be set in a unit file such as
# /etc/systemd/system/elasticsearch.service.d/override.conf.
#MAX_LOCKED_MEMORY=unlimited
# Maximum number of VMA (Virtual Memory Areas) a process can own
# When using Systemd, this setting is ignored and the 'vm.max_map_count'
# property is set at boot time in /usr/lib/sysctl.d/elasticsearch.conf
#MAX_MAP_COUNT=262144
elasticsearch elasticsearch-7.10.1-1.x86_64
CENTOS 7.9 xen hvm v92.0.6
-
#2
What does journalctl -xe shows?
-
#3
Code:
-- Unit user-1015.slice has finished shutting down.
Jan 03 12:22:20 srv6.le.com polkitd[652]: Registered Authentication Agent for unix-process:31749:92031614 (system bus name :1.450885 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, loca
Jan 03 12:22:20 srv6.le.com systemd[1]: Starting Elasticsearch...
-- Subject: Unit elasticsearch.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit elasticsearch.service has begun starting up.
Jan 03 12:22:34 srv6.le.com systemd-entrypoint[31755]: fatal error in thread [main], exiting
Jan 03 12:22:34 srv6.le.com systemd-entrypoint[31755]: java.lang.NoClassDefFoundError: Could not initialize class com.sun.jna.Native
Jan 03 12:22:34 srv6.le.com systemd-entrypoint[31755]: at org.elasticsearch.systemd.Libsystemd.lambda$static$0(Libsystemd.java:34)
Jan 03 12:22:34 srv6.le.com systemd-entrypoint[31755]: at java.base/java.security.AccessController.doPrivileged(AccessController.java:312)
Jan 03 12:22:34 srv6.le.com systemd-entrypoint[31755]: at org.elasticsearch.systemd.Libsystemd.<clinit>(Libsystemd.java:33)
Jan 03 12:22:34 srv6.le.com systemd-entrypoint[31755]: at org.elasticsearch.systemd.SystemdPlugin.sd_notify(SystemdPlugin.java:126)
Jan 03 12:22:34 srv6.le.com systemd-entrypoint[31755]: at org.elasticsearch.systemd.SystemdPlugin.onNodeStarted(SystemdPlugin.java:137)
Jan 03 12:22:34 srv6.le.com systemd-entrypoint[31755]: at java.base/java.util.ArrayList.forEach(ArrayList.java:1511
Jan 03 12:22:34 srv6.le.com systemd-entrypoint[31755]: at org.elasticsearch.node.Node.start(Node.java:902)
Jan 03 12:22:34 srv6.le.com systemd-entrypoint[31755]: at org.elasticsearch.bootstrap.Bootstrap.start(Bootstrap.jav
Jan 03 12:22:34 srv6.le.com systemd-entrypoint[31755]: at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java
Jan 03 12:22:34 srv6.le.com systemd-entrypoint[31755]: at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsea
Jan 03 12:22:34 srv6.le.com systemd-entrypoint[31755]: at org.elasticsearch.bootstrap.Elasticsearch.execute(Elastic
Jan 03 12:22:34 srv6.le.com systemd-entrypoint[31755]: at org.elasticsearch.cli.EnvironmentAwareCommand.execute(Env
Jan 03 12:22:34 srv6.le.com systemd-entrypoint[31755]: at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Co
Jan 03 12:22:34 srv6.le.com systemd-entrypoint[31755]: at org.elasticsearch.cli.Command.main(Command.java:90)
Jan 03 12:22:34 srv6.e.com systemd-entrypoint[31755]: at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsea
Jan 03 12:22:34 srv6.le.com systemd-entrypoint[31755]: at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsea
Jan 03 12:22:34 srv6.le.com systemd[1]: elasticsearch.service: main process exited, code=exited, status=1/FAILURE
Jan 03 12:22:34 srv6.le.com systemd[1]: Failed to start Elasticsearch.
-- Subject: Unit elasticsearch.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit elasticsearch.service has failed.
--
-- The result is failed.
Jan 03 12:22:34 srv6.le.com systemd[1]: Unit elasticsearch.service entered failed state.
Jan 03 12:22:34 srv6.le.com systemd[1]: elasticsearch.service failed.
Jan 03 12:22:34 srv6.le.com polkitd[652]: Unregistered Authentication Agent for unix-process:31749:92031614 (system
lines 4077-4099/4099 (END)
-
#5
change in /etc/elasticsearch/jvm.options
#-Djava.io.tmpdir=${ES_TMPDIR}
-Djava.io.tmpdir=/var/log/elasticsearch
issue will fix.
Fixed my issue too! Thanks.
-
#6
I’m happy I could help.
Take care
-
#7
I have an error please help me
Job for elasticsearch.service failed because the control process exited with error code. See «systemctl status elasticsearch.service» and «journalctl -xe» for details.
-
#8
and have you made sure the folder exist? You might need to follow up with ElasticSearch support in order to get this resolved as this forum is for primary cPanel related issues.
-
#9
Try:
Code:
curl -XGET 'http://localhost:9200'
Expected Output:
{
«status» : 200,
«name» : «Paradigm»,
«cluster_name» : «elasticsearch»,
«version» : {
«number» : «6.8.12»,
«build_hash» : «16e5641082fg1fb57e1g5gb7ff75ecd8eg760793»,
«build_timestamp» : «2019-11-21T10:15:28Z»,
«build_snapshot» : false,
«lucene_version» : «4.10.4»
},
«tagline» : «You Know, for Search»
}
You need to make sure that port 9200 is open otherwise you will see this connection refused error:
Code:
curl -XGET 'http://localhost:9200/'
curl: (7) Failed connect to localhost:9200; Connection refused
-
#10
Great collaboration here, guys!