1.下载解压
此处略过~~
2.elasticsearch.yml文件配置
cluster.name: elasticsearch
//node.name自己分配,每台不一样
node.name: es02
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
network.host: //本机的公网地址
network.bind_host: //本机的内网地址
http.port: 9200
discovery.zen.ping.unicast.hosts: ["集群其他两台主机公网地址", "集群其他两台主机公网地址"]
discovery.zen.minimum_master_nodes: 2
http.cors.enabled: true
http.cors.allow-origin: "*"
另外两台主机类推,修改相关配置即可
3.可能会出的异常
3.1不能以root用户启动服务
es不允许以root身份启动es,因此需要新建用户
groupadd es
useradd es -g es
chown -R es:es es目录
3.2启动内存不够
[root@tencent2 elasticsearch-5.5.2]# vim config/jvm.options
修改启动内存为512m
-Xms512m
-Xmx512m
3.3还有其他异常,修改以下配置即可
vim /etc/sysctl.conf
vm.max_map_count=655360
修改完执行命令使配置生效
sysctl -p
vim /etc/security/limits.conf
* soft nofile 100001
* hard nofile 100002
root soft nofile 100001
root hard nofile 100002
* soft nproc 2048
vim /etc/security/limits.d/20-nproc.conf
* hard nproc 4096
* soft nproc 4096
root soft nproc unlimited
4.启动
在ES目录下
[root@tencent2 elasticsearch-5.5.2]# su es
-d 是后台启动参数
bash-4.2$ ./bin/elasticsearch -d