版本说明
java版本控制1.8以上
Elasticsearch版本为5.5.1
JAVA安装说明
查看centos源版本open jdk
rpm -qa | grep java
删除已有版本
yum remove java*
安装java jdk 1.8.144,至/opt目录
su - root
mv /home/didichen/Downloads/jdk-8u144-linux-x64.tar.gz /opt/
tar -zxvf jdk-8u144-linux-x64.tar.gz
vim /etc/profile
----
JAVA_HOME=/opt/jdk1.8.0_144
export JAVA_HOME
export PATH=\$JAVA_HOME/bin:$PATH
----
source /etc/profile
OS更改配置(root权限,多节点部署时,需要此步骤)
建议修改如下配置,否则在多节点部署时会报错
修改vm.max_map_count配置
# echo "vm.max_map_count=262144" >>/etc/sysctl.conf
# sysctl -p
vm.max_map_count = 262144
修改max file descriptors配置
# echo "didichen hard nofile 65536" >> /etc/security/limits.conf
# echo "didichen soft nofile 65536" >> /etc/security/limits.conf
重新登陆登录didichen(这个是运行es的账号)
关闭防火墙
systemctl stop firewalld.service
Elasticsearch安装
下载
https://www.elastic.co/downloads/elasticsearch
单节点安装
cd elasticsearch-5.5.1/
bin/elasticsearch
多节点安装
配置规划
集群名称为es-cocacola
ip | node | 对外port | 对内port |
---|---|---|---|
192.168.220.128 | node-128 | 9200 | 9300 |
192.168.220.129 | node-129 | 9200 | 9300 |
192.168.220.130 | node-130 | 9200 | 9300 |
修改多节点配置
elasticsearch-5.5.1/config/elasticsearch.yml
![这里写图片描述]192.168.220.128
cluster.name: es-cocacola
node.name: node-128
network.host: 192.168.220.128
http.port: 9200
discovery.zen.ping.unicast.hosts: ["192.168.220.128", "192.168.220.129", "192.168.220.130"]
discovery.zen.minimum_master_nodes: 2
192.168.220.129
cluster.name: es-cocacola
node.name: node-129
network.host: 192.168.220.129
http.port: 9200
discovery.zen.ping.unicast.hosts: ["192.168.220.128", "192.168.220.129", "192.168.220.130"]
discovery.zen.minimum_master_nodes: 2
192.168.220.130
cluster.name: es-cocacola
node.name: node-130
network.host: 192.168.220.130
http.port: 9200
discovery.zen.ping.unicast.hosts: ["192.168.220.128", "192.168.220.129", "192.168.220.130"]
discovery.zen.minimum_master_nodes: 2
在多个节点启动es
cd elasticsearch-5.5.1/
bin/elasticsearch
集群自发现
访问
curl http://192.168.220.128:9200
[didichen@centos7-x64-id1 ~]$ curl http://192.168.220.128:9200
{
"name" : "node-128",
"cluster_name" : "es-cocacola",
"cluster_uuid" : "9v9CkYFzQ56BD1QHgn0M_A",
"version" : {
"number" : "5.5.1",
"build_hash" : "19c13d0",
"build_date" : "2017-07-18T20:44:24.823Z",
"build_snapshot" : false,
"lucene_version" : "6.6.0"
},
"tagline" : "You Know, for Search"
}
[didichen@centos7-x64-id1 ~]$ curl http://192.168.220.129:9200
{
"name" : "node-129",
"cluster_name" : "es-cocacola",
"cluster_uuid" : "9v9CkYFzQ56BD1QHgn0M_A",
"version" : {
"number" : "5.5.1",
"build_hash" : "19c13d0",
"build_date" : "2017-07-18T20:44:24.823Z",
"build_snapshot" : false,
"lucene_version" : "6.6.0"
},
"tagline" : "You Know, for Search"
}
[didichen@centos7-x64-id1 ~]$ curl http://192.168.220.130:9200
{
"name" : "node-129",
"cluster_name" : "es-cocacola",
"cluster_uuid" : "9v9CkYFzQ56BD1QHgn0M_A",
"version" : {
"number" : "5.5.1",
"build_hash" : "19c13d0",
"build_date" : "2017-07-18T20:44:24.823Z",
"build_snapshot" : false,
"lucene_version" : "6.6.0"
},
"tagline" : "You Know, for Search"
}