install on any RPM-based system such as OpenSuSE, SLES, Centos, Red Hat, and Oracle Enterprise.
RPM install is not supported on distributions with old versions of RPM, such as SLES 11 and CentOS 5.
requires Java 8 or later. Use the official Oracle distribution or an open-source distribution such as OpenJDK.
Installing from the RPM repository
Create a file called elasticsearch.repo in the /etc/yum.repos.d/ directory for RedHat based distributions,
or in the /etc/zypp/repos.d/ directory for OpenSuSE based distributions
name=Elasticsearch repository for 5.x packages
sudo yum install elasticsearch
sudo rpm --install elasticsearch-5.0.2.rpm
Compare the SHA produced by sha1sum or shasum with the published SHA
On systemd-based distributions, the installation scripts will attempt to set kernel parameters (e.g., vm.max_map_count);
you can skip this by setting the environment variable ES_SKIP_SET_KERNEL_PARAMETERS to true.
SysV init or systemd (used by newer distributions).
SysV init vs systemd
ps -p 1
Running Elasticsearch with SysV init
Use the chkconfig command to configure Elasticsearch to start automatically when the system boots up:
sudo chkconfig --add elasticsearch
Elasticsearch can be started and stopped using the service command:
sudo -i service elasticsearch start
sudo -i service elasticsearch stop
Running Elasticsearch with systemd
To configure Elasticsearch to start automatically when the system boots up, run the following commands:
sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable elasticsearch.service
Elasticsearch can be started and stopped as follows:
sudo systemctl start elasticsearch.service
sudo systemctl stop elasticsearch.service
These commands provide no feedback as to whether Elasticsearch was started successfully or not.
Instead, this information will be written in the log files located in /var/log/elasticsearch/.
这些命令不会提供成功或失败的反馈 ，信息写入日志文件 /var/log/elasticsearch/
默认不会写入 systemd journal 日志文件
To enable journalctl logging, the --quiet option must be removed from the ExecStart command line in the elasticsearch.service file.
去掉 --quiet 选项 ，启用 journalctl日志
sudo journalctl -f
sudo journalctl --unit elasticsearch
sudo journalctl --unit elasticsearch --since "2016-10-30 18:17:16"
RPM 配置文件 /etc/sysconfig/elasticsearch
ES_USER The user to run as, defaults to elasticsearch.
ES_GROUP The group to run as, defaults to elasticsearch.
JAVA_HOME Set a custom Java path to be used.
MAX_OPEN_FILES Maximum number of open files, defaults to 65536.
MAX_LOCKED_MEMORY Maximum locked memory size. Set to unlimited if you use the bootstrap.memory_lock option in elasticsearch.yml.
Maximum number of memory map areas a process may have.
If you use mmapfs as index store type, make sure this is set to a high value.
For more information, check the linux kernel documentation about max_map_count.
This is set via sysctl before starting elasticsearch. Defaults to 262144.
LOG_DIR Log directory, defaults to /var/log/elasticsearch.
DATA_DIR Data directory, defaults to /var/lib/elasticsearch.
CONF_DIR Configuration file directory (which needs to include elasticsearch.yml and log4j2.properties files), defaults to /etc/elasticsearch.
ES_JAVA_OPTS Any additional JVM system properties you may want to apply.
Configure restart on package upgrade, defaults to false.
This means you will have to restart your elasticsearch instance after installing a package manually.
The reason for this is to ensure, that upgrades in a cluster do not result in a continuous shard
reallocation resulting in high network traffic and reducing the response times of your cluster.