一、内存不足

问题:

Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000085330000, 2060255232, 0) failed; error='Cannot allocate memory' (errno=12)

解决:

# 进入config目录,修改jvm.options的配置
-Xms512M
-Xmx512M

二、不能以root启动

问题:

Exception in thread "main" java.nio.file.AccessDeniedException: /software/elasticsearch-6.4.3/config/jvm.options

解决:

chown -R 用户名:用户名 目录名

三、外网不能访问

问题:

# 启动正常,IP不能访问

解决:

# 修改config下面的elasticsearch.yml的配置
network.host: 0.0.0.0
http.port: 9200

四、文件句柄不足

问题:

ERROR: [3] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
[2]: max number of threads [3780] for user [esyonghu] is too low, increase to at least [4096]
[3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

解决:

# 修改配置文件
vim /etc/security/limits.conf
# 在文件的末尾加上
* soft nofile 65536
* hard nofile 65536
* soft nproc 4096
* hard nproc 4096
# 修改配置文件
vim /etc/security/limits.d/20-nproc.conf
# 在文件的末尾加上
esyonghu   soft    nproc     4096
root       soft    nproc     unlimited
# 修改配置文件
vim /etc/sysctl.conf
# 在文件的末尾加上
vm.max_map_count = 655360
# 使配置文件生效
sysctl -p

五、磁盘使用过高

问题:

low disk watermark [85%]”或“high disk watermark [90%]

解决:

# 修改config下面的elasticsearch.yml的配置
cluster.routing.allocation.disk.threshold_enabled: false