1.安装JDK8
2.解压elasticsearch-6.6.0.tar.gz
在/opt/application中创建一个elasticsearch文件夹,解压到此目录中
> tar -zxvf elasticsearch-6.6.0.tar.gz -C /opt/application/elasticsearch
3.在elasticsearch中创建data以及logs目录
> elasticsearch# ls
drwxr-xr-x. 3 root root 18 2月 15 10:58 data
drwxr-xr-x. 8 root root 4096 2月 15 10:47 elasticsearch-6.6.0
drwxr-xr-x. 2 root root 4096 2月 15 10:58 logs
4.修改配置
vi elasticsearch-6.6.0/conf/elasticsearch.yml
cluster.name: my-application #集群名字 每个节点设置成一样
node.name: node113 #节点名字,必须不一样
path.data: /opt/application/elasticsearch/data
path.logs: /opt/application/elasticsearch/logs
network.host: 172.19.224.113 #节点IP
http.port: 9200
discovery.zen.ping.unicast.hosts: ["172.19.224.113","172.19.224.212", "172.19.224.213","172.19.224.214"] #各节点的IP或者名称
discovery.zen.minimum_master_nodes: 3 #节点数量/2 + 1
vi /etc/sysctl.conf
末尾添加
vm.max_map_count=262144
使其生效
> sysctl -p
vi /etc/security/limits.conf
添加
* hard nofile 65536
* soft nofile 65536
* soft nproc 2048
* hard nproc 4096
5.创建用户以及更改权限
由于elasticsaerch不能用root用户启动,所以需要单独建立一个用户
> useradd es
> passwd es
修改elasticsearch文件夹权限
> chown -R es:es /opt/application/elasticsearch
6.启动
直接启动
> bin/elasticsearch
后台启动
> bin/elasticsearch -d
查看结果
http://172.19.224.113:9200/