我需要將 Elasticsearch 安裝到/opt/elasticsearch/包含此路徑中所有資訊的路徑。我的意思是,我也需要將配置路徑放入 opt 中。
https://www.elastic.co/guide/en/elasticsearch/reference/7.15/settings.html它在這里說我可以設定ES_PATH_CONF和環境ES_HOME變數來更改安裝和配置路徑,但它不起作用。
rpm --install elasticsearch-7.15.0-x86_64.rpm --prefix=/opt/elasticsearch/ 這不是我需要的,也不會改變配置路徑。
它在 /opt/elasticsearch 中創建主目錄,我得到下一個結構并且路徑不會改變。它仍然需要 /usr/share/elasticsearch/bin/ 中的執行 bin
el6:~ # tree /opt/elasticsearch/ -d -L 3
/opt/elasticsearch/
├── lib
│ ├── sysctl.d
│ ├── systemd
│ │ └── system
│ └── tmpfiles.d
└── share
└── elasticsearch
├── bin
├── jdk
├── lib
├── modules
└── plugins
但是我需要
el5:~ # tree /opt/elasticsearch/ -d -L 1
/opt/elasticsearch/
├── bin
├── config
├── data
├── jdk
├── lib
├── logs
├── modules
└── plugins
手動安裝
mkdir /opt/elasticsearch/ && tar -xzf elasticsearch-7.15.0-linux-x86_64.tar.gz -C /opt/elasticsearch/ --strip-components 1
我需要我的結構。我做了 systemd 服務
[Unit]
Description=Elasticsearch
Documentation=https://www.elastic.co
Wants=network-online.target
After=network-online.target
[Service]
Type=notify
RuntimeDirectory=elasticsearch
PrivateTmp=true
Environment=ES_HOME=/opt/elasticsearch
Environment=ES_PATH_CONF=/opt/elasticsearch/config
Environment=PID_DIR=/var/run/elasticsearch
Environment=ES_SD_NOTIFY=true
EnvironmentFile=-/etc/sysconfig/elasticsearch
WorkingDirectory=/opt/elasticsearch
User=elasticsearch
Group=elasticsearch
ExecStart=/opt/elasticsearch/bin/elasticsearch -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
# 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=5000
[Install]
WantedBy=multi-user.target
但它不會啟動,不會崩潰,也不會在 journalctl 中寫入任何日志。
如何在 opt 中使用配置安裝 elasticsearch?
uj5u.com熱心網友回復:
您可以/opt/elasticsearch使用您的rpm命令安裝 elasticsearch ,然后將組態檔從它們的默認位置移動到您選擇的位置,最后將ES_PATH_CONF和ES_HOMEenv 變數更改為它們各自的新路徑。
使用“手動”安裝方法(通過下載 .tar.gz)時,您可以自由地將檔案放在您想要的位置。wget回傳 404,因為檔案/URL 不存在。wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.15.0-linux-x86_64.tar.gz應該是正確的。(你不見了-linux)
uj5u.com熱心網友回復:
唯一的方法是將 tar.gz 下載到您的目錄中,然后手動添加所有環境變數,并構建和管理您自己的 init 腳本
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/323683.html
