我有一份 Elasticsearch
autosys
工作。 Elasticsearch 实例在 VM 服务器上运行。当我们使用脚本手动启动 Elasticsearch 时,它可以正常工作。
但是,当我们尝试通过
Autosys
启动该进程时,它会运行几分钟,然后自动停止,并在日志文件夹中记录错误。
Elasticsearch version: 7.17
ERROR: [2] bootstrap checks failed. You must address the points described in the following [2] lines before starting Elasticsearch.
bootstrap check failure [1] of [2]:
max file descriptors (4096] for elasticsearch process is too low, increase to at least [65535]
bootstrap check failure [2] of [2]:
memory locking requested for elasticsearch process but memory is not locked ERROR: Elasticsearch did not exit normally check the logs at /var/log/elasticsearch/elastic-dev.log
uncaught exception in thread (process reaper (pid 23839)]
java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "modifyThread")
at java.base/java.security.AccessControlContext.checkPermission (AccessControlContext.java:485)
我尝试更改elasticsearch.yml文件,但不起作用
从脚本运行
Elasticsearch
时。
脚本正在与当前用户一起运行
$USER
特定上下文:
权限、环境变量、资源限制等等。
当
Autosys
运行时 Elasticsearch
Autosys
脚本在不同的用户上下文中运行。
Elasticsearch
安装的最佳实践Elasticsearch
。Elasticsearch
服务单元管理 SystemD
操作。/etc/systemd/system/elasticsearch.service
。这样
Autosys
将使用以下命令启动 Elasticsearch
:
sudo systemctl start elasticsearch.service
/etc/systemd/system/elasticsearch.service
您可以用作模板:复制自官方Elasticsearch代码库(赞扬开源软件)。
[Unit]
Description=Elasticsearch
Documentation=https://www.elastic.co
Wants=network-online.target
After=network-online.target
[Service]
Type=notify
# the elasticsearch process currently sends the notifications back to systemd
# and for some reason exec does not work (even though it is a child). We should change
# this notify access back to main (the default), see https://github.com/elastic/elasticsearch/issues/86475
NotifyAccess=all
RuntimeDirectory=elasticsearch
PrivateTmp=true
Environment=ES_HOME=/usr/share/elasticsearch
[email protected]@
Environment=PID_DIR=/var/run/elasticsearch
Environment=ES_SD_NOTIFY=true
[email protected]@
WorkingDirectory=/usr/share/elasticsearch
User=elasticsearch
Group=elasticsearch
ExecStart=/usr/share/elasticsearch/bin/systemd-entrypoint -p ${PID_DIR}/elasticsearch.pid --quiet
# StandardOutput is configured to redirect to journalctl since
# some error messages may be logged in standard output before
# elasticsearch logging system is initialized. Elasticsearch
# stores its logs in /var/log/elasticsearch and does not use
# journalctl by default. If you also want to enable journalctl
# logging, you can simply remove the "quiet" option from ExecStart.
StandardOutput=journal
StandardError=inherit
# Specifies the maximum file descriptor number that can be opened by this process
LimitNOFILE=65535
# Specifies the maximum number of processes
LimitNPROC=4096
# Specifies the maximum size of virtual memory
LimitAS=infinity
# Specifies the maximum file size
LimitFSIZE=infinity
# Disable timeout logic and wait until process is stopped
TimeoutStopSec=0
# SIGTERM signal is used to stop the Java process
KillSignal=SIGTERM
# Send the signal only to the JVM rather than its control group
KillMode=process
# Java process is never killed
SendSIGKILL=no
# When a JVM receives a SIGTERM signal it exits with code 143
SuccessExitStatus=143
# Allow a slow startup before the systemd notifier module kicks in to extend the timeout
TimeoutStartSec=900
[Install]
WantedBy=multi-user.target
# Built for @project.name@[email protected]@ (@project.name@)