install elasticsearch 7.x on cpanel whm

madamada

Member
Nov 5, 2019
9
2
3
italia
cPanel Access Level
Root Administrator
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:

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
[[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
 

andrew.n

Well-Known Member
Jun 9, 2020
461
119
43
EU
cPanel Access Level
Root Administrator
What does journalctl -xe shows?
 

madamada

Member
Nov 5, 2019
9
2
3
italia
cPanel Access Level
Root Administrator
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)
 

andrew.n

Well-Known Member
Jun 9, 2020
461
119
43
EU
cPanel Access Level
Root Administrator
  • Like
Reactions: madamada

madamada

Member
Nov 5, 2019
9
2
3
italia
cPanel Access Level
Root Administrator
Give this a try:

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.
 
  • Like
Reactions: andrew.n

andrew.n

Well-Known Member
Jun 9, 2020
461
119
43
EU
cPanel Access Level
Root Administrator
I'm happy I could help.

Take care
 
  • Like
Reactions: madamada

ahmadroje

Registered
Jan 3, 2021
1
0
1
egypt
cPanel Access Level
Root Administrator
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.




 

andrew.n

Well-Known Member
Jun 9, 2020
461
119
43
EU
cPanel Access Level
Root Administrator
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.
 
  • Like
Reactions: madamada and cPRex

kodeslogic

Well-Known Member
Apr 26, 2020
188
57
103
IN
cPanel Access Level
Root Administrator
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
 
  • Like
Reactions: madamada and cPRex