CentOS 安装 Logstash 2.2.0 和 Elasticsearch 2.2.0(2)


[root@linuxidc elasticsearch]# yum list installed | grep java
 
 [root@linuxidc elasticsearch]# yum list installed | grep jdk
 
 jdk.x86_64                          2000:1.7.0_51-fcs                installed
 
 [root@linuxidc elasticsearch]# yum -y remove jdk.x86_64
 
 ……
 
 [root@linuxidc elasticsearch]#yum -y install java-1.8.0-openjdk*
 
 ……

注意:java-1.8.0-openjdk*”,后面有个星号,即安装 java 全部相关的东西~
•安装完成后,设置 JDK 的环境变量:


[root@linuxidc elasticsearch]# export JAVA_HOME=/usr/lib/jvm/java-1.8.0
 
 [root@linuxidc elasticsearch]# export PATH=$JAVA_HOME/bin:$PATH
 
 [root@linuxidc elasticsearch]# export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
 
 [root@linuxidc elasticsearch]# java -version
 
 openjdk version "1.8.0_71"
 
 OpenJDK Runtime Environment (build 1.8.0_71-b15)
 
 OpenJDK 64-Bit Server VM (build 25.71-b15, mixed mode)
 
 [root@linuxidc elasticsearch]# echo $JAVA_HOME
 
 /usr/lib/jvm/java-1.8.0
 
 [root@linuxidc elasticsearch]#

另外,JDK 安装在了我机器的 /usr/lib/jvm 目录下,自己确认一下你的路径。
•再次运行:


 [root@linuxidc elasticsearch]# bin/elasticsearch
 
 Exception in thread "main" java.lang.RuntimeException: don't run elasticsearch as root.
 
        at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:93)
 
        at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:144)
 
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:285)
 
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)
 
 Refer to the log for complete error details.
 
 [root@linuxidc elasticsearch]#
•又报错,elasticsearch 不能用 root 用户运行,那就建立一个:


[root@linuxidc elasticsearch]# groupadd es
 
 [root@linuxidc elasticsearch]# useradd -g es es
 
 [root@linuxidc elasticsearch]# passwd es
 
 Changing password for user es.
 
 New password:
 
 BAD PASSWORD: it is WAY too short
 
 BAD PASSWORD: is too simple
 
 Retype new password:
 
 passwd: all authentication tokens updated successfully.
 
 [root@linuxidc elasticsearch]#
 
 [root@linuxidc elasticsearch]# chown -R root .
 
 [root@linuxidc elasticsearch]# chown -R es .
 
 [root@linuxidc elasticsearch]# chgrp -R es .
 
 [root@linuxidc elasticsearch]# ls -l
 
 total 4
 
 drwxr-xr-x 7 es es 4096 Mar  1 03:07 elasticsearch
 
 [root@linuxidc elasticsearch]#
•重新打开一个终端,用 es 用户登录,并运行 elasticsearch:


[root@linuxidc ~]$ cd /usr/local/elasticsearch/elasticsearch
 
 [root@linuxidc elasticsearch]$ bin/elasticsearch
 
 [2016-03-01 05:11:48,413][WARN ][bootstrap                ] unable to install syscall filter: seccomp unavailable: CONFIG_SECCOMP not compiled into kernel, CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER are needed
 
 [2016-03-01 05:11:48,750][INFO ][node                    ] [Googam] version[2.1.1], pid[15042], build[40e2c53/2015-12-15T13:05:55Z]
 
 [2016-03-01 05:11:48,750][INFO ][node                    ] [Googam] initializing ...
 
 [2016-03-01 05:11:49,088][INFO ][plugins                  ] [Googam] loaded [elasticsearch-analysis-ik, elasticsearch-analysis-mmseg, elasticsearch-analysis-stconvert, elasticsearch-analysis-pinyin], sites []
 
 [2016-03-01 05:11:49,121][INFO ][env                      ] [Googam] using [1] data paths, mounts [[/ (/dev/mapper/vg_linuxidc-lv_root)]], net usable_space [26.1gb], net total_space [34.8gb], spins? [possibly], types [ext4]
 
 [2016-03-01 05:11:51,119][INFO ][mmseg-analyzer          ] [Dict Loading] chars loaded time=42ms, line=12638, on file=chars.dic
 
 ……
•此时,在另一个终端,访问 elasticsearch:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/20d0dab583628264c38759d3fddeddf1.html