一开始的准备
实在是水平有限,Clash虚拟机网出不去,研究了LAN方案,还在咸鱼买了一单,搞不定,没辙,那我老老实实下载tar包得了,就不docker了
下载安装
直接官网给它安个es
https://www.elastic.co/cn/downloads
然后将环境变量(vim /etc/profile)给它配上
export ES_JAVA_HOME=/etc/elasticsearch-7.14.0/jdk
最后重启并启动
第一个拦路虎-权限问题
java.lang.RuntimeException: can not run elasticsearch as root
说白了就是不给你用root,那我们就建立一个新的es用户
useradd es
这一步用户和用户组就同名创建了
passwd
自己的密码
然后将权限一改,将这个文件和所有子文件权限都给es
sudo chown -R es:es /etc/elasticsearch
第二个拦路虎-外部联网
es必须配置成外网使用,不然毫无意义
我们在es的config/elasticsearch.yml中完成配置network.host: 0.0.0.0
bootstrap check failure [1] of [3]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
bootstrap check failure [2] of [3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
bootstrap check failure [3] of [3]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
这些错误很简单,直接百度一下,然后去配置文件里改改就好
/etc/security/limits.conf加上
elasticsearch hard nofile 65536
elasticsearch soft nofile 65536
/etc/sysctl.conf加上vm.max_map_count=655360
最后在config/elasticsearch.yml中将cluster.initial_master_nodes取消注解即可