1,下载elasticsearch 安装包(官网:https://www.elastic.co/cn/downloads/elasticsearch)
wget -c https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.7.0.tar.gz
2,解压文件 tar -zxvf elasticsearch-6.7.0.tar.gz
3,修改config/jvm.options,elasticsearch 默认为1G,如果你服务器内存不够大可以修改
-Xms512m
-Xmx512m
4,修改config/elasticsearch.yml
# ---------------------------------- Cluster ------
cluster.name: my-application
# ------------------------------------ Node -----------------------------------
node.name: node-1
# ---------------------------------- Network ----------------------------------
network.host: 0.0.0.0
http.port: 9200
transport.tcp.port: 9300
5,添加elasticsearch 用户并给于目录的权限,elasticsearch不能使用root启动
groupadd usergroupname
useradd esusername -g usergroupname -p 123456
chown -R esusername:usergroupname /usr/local/server/elasticsearch-6.7.0
6,修改 vi /etc/sysctl.conf
#在最后添加
vm.max_map_count=655360
保存修改后,使用 sysctl -p 查看修改结果
7,修改 vi /etc/security/limits.conf
* soft nofile 65536
* hard nofile 65536
* soft nproc 4096
* hard nproc 4096
保存后重启服务器
8,登录服务器,进入elasticsearch安装目录,切换为用户
su esusername
cd /usr/local/server/elasticsearch-6.7.0/bin
./elasticsearch
9,开放端口
firewall-cmd --zone=public --add-port=9200/tcp --permanent
firewall-cmd --zone=public --add-port=9300/tcp --permanent
firewall-cmd --reload
完成