ElasticSearch 安装时一些错误以及解决方法

Posted frank-hui

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ElasticSearch 安装时一些错误以及解决方法相关的知识,希望对你有一定的参考价值。

第1章 ElasticSearch 安装时一些错误以及解决方法

1.1 JDK版本问题

1.1.1 问题:

[2020-01-16T09:26:22,296][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [node-1] uncaught exception in thread [main]

org.elasticsearch.bootstrap.StartupException: org.elasticsearch.common.inject.CreationException: Guice creation errors:

 

1) An exception was caught and reported. Message: access denied ("java.lang.RuntimePermission" "accessClassInPackage.jdk.internal.vm.annotation")

  at _unknown_

Caused by: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessClassInPackage.jdk.internal.vm.annotation")

    at java.base/java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)

    at java.base/java.security.AccessController.checkPermission(AccessController.java:1036)

    at java.base/java.lang.SecurityManager.checkPermission(SecurityManager.java:408)

    at java.base/java.lang.SecurityManager.checkPackageAccess(SecurityManager.java:1324)

 

1.1.2 解决方法:

JDK版本不对

java -version看了下是jdk13,卸载装jdk11以及以下版本(版本也不能太低)

 

1.2 启动用户问题

问题:

java.lang.RuntimeException:can not run elasticsearch as root

解决方法:

useradd es(加用户)

passwd es(给密码)

chown –R es:es /usr/local/elasticsearch(给权限)

su – es(切换用户)

./usr/local/elasticsearch/bin/elasticsearch &(后台启动)

 

1.3 安装phantomjs出错

问题:

npm install

Phantom installation failed { Error: EACCES: permission denied, link ‘/tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1496325965675/phantomjs-2.1.1-linux-x86_64‘ -> ‘/XXX/node_modules/phantomjs-prebuilt/lib/phantom‘

at Error (native)

errno: -13,

code: ‘EACCES‘,

syscall: ‘link‘,

path: ‘/tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1496325965675/phantomjs-2.1.1-linux-x86_64‘,

dest: ‘/XXX/node_modules/phantomjs-prebuilt/lib/phantom‘ } Error: EACCES: permission denied, link ‘/tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1496325965675/phantomjs-2.1.1-linux-x86_64‘ -> ‘/XXX/node_modules/phantomjs-prebuilt/lib/phantom‘

at Error (native)

npm ERR! code ELIFECYCLE

npm ERR! errno 1

npm ERR! phantomjs-prebuilt@2.1.14 install: `node install.js`

npm ERR! Exit status 1

 

解决方法:

rm -rf node_modules(删除前面构建错的目录)

npm install --unsafe-perm(重新构建)

 

1.4 文件描述符内存限制

1.4.1 问题:

[1]: max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536]

[2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

[3]: max number of threads [3895] for user [es] is too low, increase to at least [4096]

1.4.2 解决方法:

vi /etc/security/limits.conf

增加(加完重启)

* soft nofile 65536

* hard nofile 131072

 

vim /etc/sysctl.conf

增加(加完执行sysctl -p)

vm.max_map_count=262144

以上是关于ElasticSearch 安装时一些错误以及解决方法的主要内容,如果未能解决你的问题,请参考以下文章

解决elasticsearch启动时常见的错误

解决elasticsearch启动时常见的错误

使用elasticsearch遇到的一些问题以及解决方法(不断更新)

elasticsearch 一些错误及解决

elasticsearch启动常见错误

ElasticSearch-5.3.1集群环境搭建,安装ElasticSearch-head插件,安装错误解决