如何在自定义路径中安装elasticsearch?
How to install elasticsearch in custom path?
我需要将 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/
中的执行箱
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?
您可以使用 rpm
命令将 elasticsearch 安装到 /opt/elasticsearch
,然后将配置文件从默认位置移动到您选择的位置,最后更改 ES_PATH_CONF
和 ES_HOME
环境变量到各自的新路径。
使用“手动”安装方法(通过下载 .tar.gz)时,您可以自由地将文件放在您想要的位置。 wget
returns 404 因为 file/URL 不存在。 wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.15.0-linux-x86_64.tar.gz
应该是正确的。 (你错过了 -linux
)
唯一的方法是将 tar.gz 下载到您的目录中,然后手动添加所有环境变量,并构建和管理您自己的初始化脚本
我需要将 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/
中的执行箱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?
您可以使用 rpm
命令将 elasticsearch 安装到 /opt/elasticsearch
,然后将配置文件从默认位置移动到您选择的位置,最后更改 ES_PATH_CONF
和 ES_HOME
环境变量到各自的新路径。
使用“手动”安装方法(通过下载 .tar.gz)时,您可以自由地将文件放在您想要的位置。 wget
returns 404 因为 file/URL 不存在。 wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.15.0-linux-x86_64.tar.gz
应该是正确的。 (你错过了 -linux
)
唯一的方法是将 tar.gz 下载到您的目录中,然后手动添加所有环境变量,并构建和管理您自己的初始化脚本