[root@vcyber elasticsearch]# bin/elasticsearch
Exception in thread"main" java.lang.RuntimeException: Java version: Oracle Cooration 1.7.0_51 [Java HotSpot(TM) 64-Bit Server VM 24.51-b03] suffers from crical bug https://bugs.openjdk.java.net/browse/JDK-8024830 which can cause dataorruption.
Please upgrade the JVM, see http:// for current recommendations.
If you absolutely cannot upgrade, please add-XX:-UseSuperWord to the JAVA_OPT environment variable.
Upgrading is preferred,this workaround will result in degraded performance.
at org.elasticsearch.bootstrap.JVMCheck.check(JVMCheck.java:123)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:283)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:3
Refer to the logfor complete error details.
大意是:Java 运行时异常,本机版本 JDK 有 bug……让升级 JVM。如果实在不能升级,就向 JAVA_OPT 环境变量添加 -XX:-UseSuperWord 选项。
2、elasticsearch 不能用 root 用户运行——切换到非root用户运行
在root用户解压完elasticsearch后出现如下错误:
[root@localhost cs408]# /usr/local/elasticsearch-5.0.1/bin/elasticsearch
[2016-11-30T09:24:56,235][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:116) ~[elasticsearch-5.0.1.jar:5.0.1]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:103) ~[elasticsearch-5.0.1.jar:5.0.1]
at org.elasticsearch.cli.SettingCommand.execute(SettingCommand.java:54) ~[elasticsearch-5.0.1.jar:5.0.1]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:96) ~[elasticsearch-5.0.1.jar:5.0.1]
at org.elasticsearch.cli.Command.main(Command.java:62) ~[elasticsearch-5.0.1.jar:5.0.1]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80) ~[elasticsearch-5.0.1.jar:5.0.1]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:73) ~[elasticsearch-5.0.1.jar:5.0.1]
Caused by: java.lang.RuntimeException: can not run elasticsearch as root
at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:96) ~[elasticsearch-5.0.1.jar:5.0.1]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:155) ~[elasticsearch-5.0.1.jar:5.0.1]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:286) ~[elasticsearch-5.0.1.jar:5.0.1]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:112) ~[elasticsearch-5.0.1.jar:5.0.1]
... 6 more
[root@localhost cs408]# vim /usr/local/elasticsearch-5.0.1/config/elasticsearch.yml
解决方案:
因为安全问题elasticsearch 不让用root用户直接运行,所以要创建新用户,这里以已有用户cs408为例:
第一步:liunx创建新用户 adduser XXX 然后给创建的用户加密码 passwd XXX 输入两次密码。(已有可以忽略)
第二步:切换刚才创建的用户 su XXX 然后执行elasticsearch 会显示AccessDeniedException 权限不足。
第三步:给新建的XXX赋权限,chmod 777 * 这个不行,因为这个用户本身就没有权限,肯定自己不能给自己付权限。所以要用root用户登录赋予权限。
第四步:root给XXX赋权限,chown -R XXX /你的elasticsearch安装目录。
chown -R cs408 /usr/local/elasticsearch-5.0.1
再次执行就能看到成功输出信息。
bin/elasticsearch
3 logstashlogstash 提供各种安装包,包括 tar.gz,ZIP,DEB 和 RPM。另外,又提供了一个包含所有插件的压缩包——logstash-all-plugins-2.2.0.tar.gz 。本文以它为例。解压后,配置 logstash,运行即可。
3.1 创建配置文件logstash运行时需要使用配置文件,主要是用于定义内容的输入、输出、中间处理等。
创建配置文件所在目录,并编辑配置文件
cd /home/ipsp/Etest/logstash-2.2.0
vim logstash_agent.conf
在配置文件logstash_agent.conf添加如下内容: