elk 安装与所遇问题

2023-05-18,,

系统centos6.7

1,安装jdk-1.8.0

    

yum install java-1.8.0-openjdk

2,下载elasticsearch-2.4.3.tar.gz并安装

tar zxvf elasticsearch-2.4.3.tar.gz -C /opt
vi /opt/elasticsearch-2.4.3/conf/elasticsearch.yml

添加配置

network.host: 0.0.0.0#server绑定本地服务器内外网ip
http.cors.enabled: true
http.cors.allow-origin: "*"

3,启动

报错

penJDK 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" 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.

[root@vultr elasticsearch]# su es bin/elasticsearch

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

[2016-12-29 08:56:59,510][WARN ][bootstrap                ] unable to install syscall filter: seccomp unavailable: CONFIG_SECCOMP not compiled into kernel, CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER are needed

Exception in thread "main" java.lang.IllegalStateException: Unable to access 'path.plugins' (/opt/elasticsearch/plugins)

Likely root cause: java.nio.file.AccessDeniedException: /opt/elasticsearch/plugins

at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84)

at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)

at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)

at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:384)

at java.nio.file.Files.createDirectory(Files.java:674)

at java.nio.file.Files.createAndCheckIsDirectory(Files.java:781)

at java.nio.file.Files.createDirectories(Files.java:767)

at org.elasticsearch.bootstrap.Security.ensureDirectoryExists(Security.java:337)

at org.elasticsearch.bootstrap.Security.addPath(Security.java:314)

at org.elasticsearch.bootstrap.Security.addFilePermissions(Security.java:246)

at org.elasticsearch.bootstrap.Security.createPermissions(Security.java:212)

at org.elasticsearch.bootstrap.Security.configure(Security.java:118)

at org.elasticsearch.bootstrap.Bootstrap.setupSecurity(Bootstrap.java:212)

at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:183)

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.

原因:1,新版本不允许用root启动,2,软件目录没相应的权限

解决:

groupadd es
useradd -g es es
passwd es

重新启动:

su es -c /opt/elasticsearch-2.4.3/bin/elasticsearch -Xmx2g -Xms2g -
Des.index.storage.type=memory –d > /dev/null 2>&1 &”

#因为我用的是虚拟机,内存比较小,所以启动看实际情况 -Xmx2g 是最大内存 -Xms2g 是最小内存 -d 是后台运行
#我的运行命令是
su es -c /opt/elasticsearch/bin/elasticsearch –d > /dev/null 2>&1 &

安装插件:elasticsearch-head(是集群前段显示页面)

切换到bin目录下 执行

./plugin install  mobz/elasticsearch-head

页面展示:http://localhost/_plugin/head

测试:

curl http://localhost:9200 出现一个json 数据表明启动成功,如下

{

    "status": 200,

    "name": "Omen",

    "version": {

        "number": "1.1.1",

        "build_hash": "f1585f096d3f3985e73456debdc1a0745f512bbc",

        "build_timestamp": "2014-04-16T14:27:12Z",

        "build_snapshot": false,

        "lucene_version": "4.7"

    },

    "tagline": "You Know, for Search"

}

安装插件:elasticsearch-kopf

执行命令:

./plugin install lmenezes/elasticsearch-kopf

页面展示:http://localhost/_plugin/bigdesk/

4,安装kibana 

tar zxvf kibana-4.6.3-linux-x86_64.tar.gz -C /opt

修改配置

因为和elasticsearch 在同一台服务器上,所以只需要修改elasticsearch的链接地址

elasticsearch_url: http://localhost:9200

启动

bin/kibana -p 5601 > /dev/null 2>&1 &

意思是以5601端口启动

然后以http://ip:5601访问就可以了

《elk 安装与所遇问题.doc》

下载本文的Word格式文档,以方便收藏与打印。