ELK学习003:Elasticsearch启动常见问题

编程

一、Caused by: java.lang.RuntimeException: can not run elasticsearch as root

这个错误,是因为使用root用户启动elasticsearch,elasticsearch是不允许使用root用户启动的,所以我们需要添加用户。

[root@localhost ~]# adduser elsearch

[root@localhost ~]# passwd elsearch

[root@localhost ~]# chown -R elsearch:elsearch elasticsearch-7.6.0

[root@localhost ~]# chmod 770 elasticsearch-7.6.0/ # 这一步之后,切换到elsearch用户,再执行下面两条命令。

[root@localhost ~]# cd elasticsearch-7.6.0/

[root@localhost ~]# bin/elasticsearch

二、OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000e5330000, 449642496, 0) failed; error="Not enough space" (errno=12); 或者error="Cannot a ..."(errno=12);

原因:jvm要分配最大内存超出系统内存

解决:

root@localhost ~]# vim /elasticsearch-7.6.0/config/jvm.options   # 适当调整指定jvm内存,由于虚拟机内存制定1g,所以适当降低jvm内存指定,这里改成512m。

-Xms512m

-Xmx512m

[root@localhost ~]# /elasticsearch-7.6.0/bin/elasticsearch # 重启elasticsearch

三、org.elasticsearch.bootstrap.StartupException: java.lang.IllegalStateException: failed to obtain node locks, tried [[/www/wwwroot/elasticsearch-7.6.0/data]] with lock id [0]; maybe these locations are not writable or multiple nodes were started without increasing [node.max_local_storage_nodes] (was [1])?

原因:线程占用

解决:重新启动

[root@localhost ~]# ps -ef | grep elasticsearch                 # 找到elasticsearch线程

[root@localhost ~]# kill -9 pid # 杀死elasticsearch线程

[root@localhost ~]# /elasticsearch-7.6.0/bin/elasticsearch # 重启elasticsearch

  

 

以上是 ELK学习003:Elasticsearch启动常见问题 的全部内容, 来源链接: utcz.com/z/513400.html

回到顶部