1.资源下载
https://www.elastic.co/cn/downloads/past-releases#elasticsearch
链接:https://pan.baidu.com/s/1NiIFFJi4CgKWP0NM2TcviQ
提取码:trp6
2.解压
tar -xzvf elasticsearch-7.2.0-linux-x86_64.tar.gz
3.配置jdk
es运行需要jdk支持
es解压后自带jdk
配置自带的jdk
vim bin/elasticsearch-env
修改红框中内容如下:
export ES_JAVA_HOME=/usr/local/es/elasticsearch-7.2.0/jdk
export PATH=$PATH:$ES_JAVA_HOME/bin
4.配置文件elasticsearch.yml
vim config/elasticsearch.yml
5.创建es用户
最新版本的Elasticsearch安全级别提高了,不允许采用root帐号启动,所以需要创建一个新身份来启动
groupadd esgroup
useradd es -g esgroup -p es
chown -R es:esgroup /usr/local/es
# 切换es身份启动
su es
./bin/elasticsearch #前台启动
./bin/elasticsearch -d #后台启动
6.启动
报错
ERROR: [2] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
[2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
第一个问题
max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
弹性搜索进程的最大文件描述符 [4096] 太低,增加到至少 [65535]
查看命令
ulimit -Sn
ulimit -Hn
切换root
vim /etc/security/limits.conf
添加内容
# *:代表所有用户;nofile:进程的最大文件描述符;nproc:进程数
* soft nofile 65536
* hard nofile 65536
* soft nproc 65536
* hard nproc 65536
修改保存后,重启 reboot
第二个问题
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
最大虚拟内存区域 vm.max_map_count [65530] 太低,增加到至少 [262144]
切换:root
vim /etc/sysctl.conf
添加:vm.max_map_count=262144
生效:sysctl -p
切换es启动
./bin/elasticsearch