首页  

elasticsearch5.0使用RPM包安装     所属分类 elasticsearch 浏览量 1177
根据原文翻译整理
https://www.elastic.co/guide/en/elasticsearch/reference/5.0/rpm.html


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.

https://www.elastic.co/downloads/past-releases/elasticsearch-5-0-2

requires Java 8 or later. Use the official Oracle distribution or an open-source distribution such as OpenJDK.

rpm可以使用数字签名来判断待安装的软件是否有问题

从RPM仓库安装


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


/etc/yum.repos.d/elasticsearch.repo


[elasticsearch-5.x]
name=Elasticsearch repository for 5.x packages
baseurl=https://artifacts.elastic.co/packages/5.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md

sudo yum install elasticsearch


手工下载rpm包安装


wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.0.2.rpm
sha1sum elasticsearch-5.0.2.rpm 
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

日志文件
/var/log/elasticsearch/

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"

http://127.0.0.1:9200 
检查是否启动成功


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.

MAX_MAP_COUNT

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.

RESTART_ON_UPGRADE

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.

上一篇     下一篇
elasticsearch中refresh和flush区别

elasticsearch5.0数据索引与查询实战

网站运营推广之七言绝句

elasticsearch5.0安装

elasticsearch5.0配置

elasticsearch5.0的重要配置