1,下载相应版本
https://www.elastic.co/cn/downloads/past-releases/
2,该软件是下载即用,但是要使用Java环境,检测java是否安装
java -version
3,解压es
tar -zxvf elasticsearch-6.7.0.tar.gz -C /www/es/
4,简单配置
es禁止使用root启动,切换目录权限
chown -R es:es /www/es
chmod -R 777 /www/es
创建日志和数据、备份目录
mkdir -p /data/es/data
mkdir -p /data/es/logs
mkdir -p /data/es/esbak
5,vi ./bin/elasticsearch.yml
注意修改如下几项:
path.data: /data/es/data
path.logs: /data/es/logs
network.host: 192.168.1.63
http.port: 19200
path.repo: /data/es/esbak
##安全认证(一般使用的基础版不能设置密码,需要购买)
#xpack.security.enabled: true
#xpack.security.transport.ssl.enabled: true
6,vi ./config/jvm.options
# 内存占用
# Xms represents the initial size of total heap space
# Xmx represents the maximum size of total heap space
-Xms1g
-Xmx1g
7,vi /etc/sysctl.conf
vm.max_map_count=262144
8,启动
./bin/elasticsearch -d # 后台启动
./bin/elasticsearch -d -p pid # 重启
9,设置开机启动(在root下)
vi /etc/systemd/system/elasticsearch.service
[Unit]
Description=elasticsearch
[Service]
User=yeemiao
LimitNOFILE=100000
LimitNPROC=100000
ExecStart=/usr/bin/su - yeemiao -c "/usr/local/services/elasticsearch/bin/elasticsearch -d -p pid"
[Install]
WantedBy=multi-user.target
设置开机自启
systemctl enable elasticsearch