1.Elasticsearch至少需要Java 8,在安装前确保已安装JDK8。
2.报错:org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
es不允许root账户启动,须新建用户,并开启目录权限,使用新账户启动。因此建议安装前先切换用户。
groupadd es
useradd es -g es
passwd es
chown -R es:es /usr/elasticsearch-5.6.9
su es
3.报错:max virtual memory areas vm.maxmapcount [65530] is too low, increase to at least [262144]
su root
sysctl -w vm.max_map_count=262144(存在重启虚拟机将失效)
或
vim /etc/sysctl.conf
vm.max_map_count = 262144(试过没有生效)
或
cat /proc/sys/vm/max_map_count
echo 262144 > /proc/sys/vm/max_map_count
4.报错:max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
或max number of threads [3818] for user [es] is too low, increase to at least [4096]
su root
vim /etc/security/limits.conf
* soft nofile 65536
* hard nofile 65536
* soft nproc 4096
* hard nproc 4096
5.默认情况下,Elastic 只允许本机访问,如果需要远程访问,可以修改 Elastic 安装目录的config/elasticsearch.yml
文件,去掉network.host
的注释,将它的值改成0.0.0.0
,然后重新启动 Elastic。
network.host: 0.0.0.0
// 虚拟机中要关闭禁用防火墙
su root
systemctl stop firewalld.service
systemctl disable firewalld.service