关于elasticsearch的一些安装报错的问题,重启然后又报错的问题
首先我是安装成功后重启elasticsearch的时候,报错了,然后没有得到解决,一直百度,没有成功
[root@iZuf6i8ft0h4q47dyic5ucZ bin]# OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N
Exception in thread "main" ElasticsearchException[Failed to load logging configuration]; nested: NoSuchFileException[/usr/share/elasticsearch/config];
Likely root cause: java.nio.file.NoSuchFileException: /usr/share/elasticsearch/config
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
at sun.nio.fs.UnixFileAttributeViews$Basic.readAttributes(UnixFileAttributeViews.java:55)
at sun.nio.fs.UnixFileSystemProvider.readAttributes(UnixFileSystemProvider.java:144)
at sun.nio.fs.LinuxFileSystemProvider.readAttributes(LinuxFileSystemProvider.java:99)
at java.nio.file.Files.readAttributes(Files.java:1737)
at java.nio.file.FileTreeWalker.getAttributes(FileTreeWalker.java:225)
at java.nio.file.FileTreeWalker.visit(FileTreeWalker.java:276)
at java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:322)
at java.nio.file.Files.walkFileTree(Files.java:2662)
at org.elasticsearch.common.logging.log4j.LogConfigurator.resolveConfig(LogConfigurator.java:142)
at org.elasticsearch.common.logging.log4j.LogConfigurator.configure(LogConfigurator.java:103)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:259)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:45)
Refer to the log for complete error details.
我百度了第一句的报错是认为CPU没有两个 jvm的警告
我们要先找 /usr/share/elasticsearch/bin 目录下的elasticsearch.in.sh,如果你和我一样买不起内存,买不起cpu,请更改的,ES_MIN_MEM=256m,把你的所有的ES_MIN_MEM都改成256,反正内存不够的jvm的报错,然后再加上这句话JAVA_OPTS="$ES_GC_OPTS -XX:ParallelGCThreads=1"
意思是你容许有一块CPU的跑jvm,你就不会出现
OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N
的警告的了,
如果你改成了后,可能还会出现以下报错
Exception in thread "main" ElasticsearchException[Failed to load logging configuration]; nested: NoSuchFileException[/usr/share/elasticsearch/config];
Likely root cause: java.nio.file.NoSuchFileException: /usr/share/elasticsearch/config
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
at sun.nio.fs.UnixFileAttributeViews$Basic.readAttributes(UnixFileAttributeViews.java:55)
at sun.nio.fs.UnixFileSystemProvider.readAttributes(UnixFileSystemProvider.java:144)
at sun.nio.fs.LinuxFileSystemProvider.readAttributes(LinuxFileSystemProvider.java:99)
at java.nio.file.Files.readAttributes(Files.java:1737)
at java.nio.file.FileTreeWalker.getAttributes(FileTreeWalker.java:225)
at java.nio.file.FileTreeWalker.visit(FileTreeWalker.java:276)
at java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:322)
at java.nio.file.Files.walkFileTree(Files.java:2662)
at org.elasticsearch.common.logging.log4j.LogConfigurator.resolveConfig(LogConfigurator.java:142)
at org.elasticsearch.common.logging.log4j.LogConfigurator.configure(LogConfigurator.java:103)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:259)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:45)
Refer to the log for complet error deils.
如果出现以上报错 ,使用这样的命令试试
ln -s /etc/elasticsearch/ /usr/share/elasticsearch/config
如果你是通过rpm安装就可以这样写,如果你通过安装包,我暂时还无解。
就算你这样的写,还是会出现报错,
Exception in thread "main" java.lang.RuntimeException: don't run elasticsearch as root.
at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:94)
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:160)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:286)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:45)
Refer to the log for complete error details.
这样的话,就不得不行要加上一个新的账户哦了,
原教程如下
https://my.oschina.net/topeagle/blog/591451?fromerr=mzOr2qzZ
加权限一定要加你的安装目录,不仅如此,你还给你的/etc/elasticsearch/加上权限
chown -R elsearch:elsearch /usr/share/elasticsearch
chown -R elsearch:elsearch /etc/elasticsearch
然后你进入你的 /usr/share/elasticsearch/bin
然后./elasticsearch 若没有报错,如下的英文,那么恭喜成功了
**[2018-11-07 13:39:30,638][INFO ][node ] [Spider-Man] version[2.4.6], pid[9632], build[5376dca/2017-07-18T12:17:44Z]
[2018-11-07 13:39:30,639][INFO ][node ] [Spider-Man] initializing ...
[2018-11-07 13:39:32,068][INFO ][plugins ] [Spider-Man] modules [reindex, lang-expression, lang-groovy], plugins [], sites []
[2018-11-07 13:39:32,242][INFO ][env ] [Spider-Man] using [1] data paths, mounts [[/ (rootfs)]], net usable_space [26.9gb], net total_space [39.2gb], spins? [unknown], types [rootfs]
[2018-11-07 13:39:32,242][INFO ][env ] [Spider-Man] heap size [241.7mb], compressed ordinary object pointers [true]
[2018-11-07 13:39:32,243][WARN ][env ] [Spider-Man] max file descriptors [65535] for elasticsearch process likely too low, consider increasing to at least [65536]
[2018-11-07 13:39:35,998][INFO ][node ] [Spider-Man] initialized
[2018-11-07 13:39:35,998][INFO ][node ] [Spider-Man] starting ...
[2018-11-07 13:39:36,089][INFO ][transport ] [Spider-Man] publish_address {127.0.0.1:9300}, bound_addresses {127.0.0.1:9300}
[2018-11-07 13:39:36,094][INFO ][discovery ] [Spider-Man] elasticsearch/WHoj8UseStuRmtwWFL05_w
[2018-11-07 13:39:39,127][INFO ][cluster.service ] [Spider-Man] new_master {Spider-Man}{WHoj8UseStuRmtwWFL05_w}{127.0.0.1}{127.0.0.1:9300}, reason: zen-disco-join(elected_as_master, [0] joins received)
[2018-11-07 13:39:39,140][INFO ][http ] [Spider-Man] publish_address {127.0.0.1:9200}, bound_addresses {127.0.0.1:9200}
[2018-11-07 13:39:39,140][INFO ][node ] [Spider-Man] started
[2018-11-07 13:39:39,375][INFO ][gateway ] [Spider-Man] recovered [0] indices into cluster_state
^C[2018-11-07 13:40:00,382][INFO ][node ] [Spider-Man] stopping ...
[2018-11-07 13:40:00,392][INFO ][node ] [Spider-Man] stopped
[2018-11-07 13:40:00,392][INFO ][node ] [Spider-Man] closing ...
[2018-11-07 13:40:00,404][INFO ][node ] [Spider-Man] closed
使用
./elasticsearch -d
如果你利用安装包出现以上问题,你可以在config/jvm.options。中更改一些内存大小,等问题,
2018年11月7号
@fyk941127