如果還沒安裝 JAVA,先安裝好
yum -y install java-1.8.0-openjdk java-1.8.0-openjdk-devel
ES的歷史版本
https://github.com/elastic/elasticsearch
1.
rpm --import https://packages.elastic.co/GPG-KEY-elasticsearch
2.
vi /etc/yum.repos.d/elasticsearch.repo
最新 5 版本:
[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
舊的 2.x 版本:
[elasticsearch-2.x]
name=Elasticsearch repository for 2.x packages
baseurl=https://packages.elastic.co/elasticsearch/2.x/centos
enabled=1
gpgcheck=1
gpgkey=https://packages.elastic.co/GPG-KEY-elasticsearch
3.
yum -y install elasticsearch
4.
vi /etc/security/limits.conf
elasticsearch soft memlock unlimited
elasticsearch hard memlock unlimited
5.
編輯
vi /etc/elasticsearch/elasticsearch.yml,加入以下設定(要用空格,不能用tab)
檔案的最底端,加入以下:
network.host: 0.0.0.0
bootstrap.mlockall: true
index:
analysis:
analyzer:
default:
type: ik
use_smart: false
6.
# Install kopf Plugin
cd /usr/share/elasticsearch/bin
./plugin install lmenezes/elasticsearch-kopf
7.
# Add allow port 9200, 9300
firewall-cmd --permanent --add-port={9200/tcp,9300/tcp}
firewall-cmd --reload
8.
chkconfig --add elasticsearch
systemctl daemon-reload
systemctl enable elasticsearch.service
systemctl start elasticsearch