CentOS6.5安装Elasticsearch5.4.1+Kibana5.4.1
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS6.5安装Elasticsearch5.4.1+Kibana5.4.1相关的知识,希望对你有一定的参考价值。
CentOS6.5安装Elasticsearch5.4.1+Kibana5.4.1
第一次接触ELK,坑很多,留下记录,让后人少走点坑
本人环境VMware虚拟机,CentOS6.5 X86_64 1G内存
下载二进制包
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.4.1.tar.gz
wget https://artifacts.elastic.co/downloads/kibana/kibana-5.4.1-linux-x86_64.tar.gz
安装JAVA 1.8版本(必需1.8及以上版本)
wget http://javadl.oracle.com/webapps/download/AutoDL?BundleId=220304_d54c1d3a095b4ff2b6607d096fa80163
rpm -ivh jre_*
解压至指定目录
进入解压后的elasticsearch-5.4.1目录
此时如果相直接 bin/elasticsearch 就启动,会报一堆的警告和错误,需要对系统进行环境参数的调整,如下
(1)
vim /etc/security/limits.conf
添加如下内容:
* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096
备注:* 代表Linux所有用户名称
(2)
vim /etc/security/limits.d/90-nproc.conf
找到如下内容:
* soft nproc 1024
修改为
* soft nproc 2048
(3)
vim /etc/sysctl.conf
添加下面配置:
vm.max_map_count=655360
然后命令行执行
sysctl -p
(4)配置elasticsearch.yml
vim config/elasticsearch.yml
在Memory项下添加以下两项,因为Centos6不支持SecComp,所以必须关闭bootstrap.system_call_filter
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
(5)配置jvm.options
修改以下两项内存值为适当的值(不要超来本机的内存)
-Xms2g
-Xmx2g
改为
-Xms512m
-Xmx512m
经过以上5步,现在可以启动elasticsearch
bin/elasticsearch
正常应该出现类似如下信息,没有WARN,没有ERROR
[[email protected] elasticsearch-5.4.1]$ ./bin/elasticsearch &
[2017-06-20T16:03:50,845][INFO ][o.e.n.Node ] [node0] initializing ...
[2017-06-20T16:03:51,082][INFO ][o.e.e.NodeEnvironment ] [node0] using [1] data paths, mounts [[/ (/dev/mapper/vg_elastic-lv_root)]], net usable_space [13.4gb], net total_space [17.2gb], spins? [possibly], types [ext4]
[2017-06-20T16:03:51,084][INFO ][o.e.e.NodeEnvironment ] [node0] heap size [503.6mb], compressed ordinary object pointers [true]
[2017-06-20T16:03:51,117][INFO ][o.e.n.Node ] [node0] node name [node0], node ID [UzRF3doSTSCjExUTopduMw]
[2017-06-20T16:03:51,118][INFO ][o.e.n.Node ] [node0] version[5.4.1], pid[27739], build[2cfe0df/2017-05-29T16:05:51.443Z], OS[Linux/2.6.32-431.el6.x86_64/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_131/25.131-b11]
[2017-06-20T16:03:51,120][INFO ][o.e.n.Node ] [node0] JVM arguments [-Xms512m, -Xmx512m, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+DisableExplicitGC, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -Djdk.io.permissionsUseCanonicalPath=true, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Dlog4j.skipJansi=true, -XX:+HeapDumpOnOutOfMemoryError, -Des.path.home=/home/program/elasticsearch-5.4.1]
[2017-06-20T16:03:53,777][INFO ][o.e.p.PluginsService ] [node0] loaded module [aggs-matrix-stats]
[2017-06-20T16:03:53,778][INFO ][o.e.p.PluginsService ] [node0] loaded module [ingest-common]
[2017-06-20T16:03:53,778][INFO ][o.e.p.PluginsService ] [node0] loaded module [lang-expression]
[2017-06-20T16:03:53,778][INFO ][o.e.p.PluginsService ] [node0] loaded module [lang-groovy]
[2017-06-20T16:03:53,779][INFO ][o.e.p.PluginsService ] [node0] loaded module [lang-mustache]
[2017-06-20T16:03:53,779][INFO ][o.e.p.PluginsService ] [node0] loaded module [lang-painless]
[2017-06-20T16:03:53,779][INFO ][o.e.p.PluginsService ] [node0] loaded module [percolator]
[2017-06-20T16:03:53,780][INFO ][o.e.p.PluginsService ] [node0] loaded module [reindex]
[2017-06-20T16:03:53,780][INFO ][o.e.p.PluginsService ] [node0] loaded module [transport-netty3]
[2017-06-20T16:03:53,781][INFO ][o.e.p.PluginsService ] [node0] loaded module [transport-netty4]
[2017-06-20T16:03:53,782][INFO ][o.e.p.PluginsService ] [node0] no plugins loaded
[2017-06-20T16:03:58,449][INFO ][o.e.d.DiscoveryModule ] [node0] using discovery type [zen]
[2017-06-20T16:04:00,106][INFO ][o.e.n.Node ] [node0] initialized
[2017-06-20T16:04:00,106][INFO ][o.e.n.Node ] [node0] starting ...
[2017-06-20T16:04:20,593][INFO ][o.e.t.TransportService ] [node0] publish_address {127.0.0.1:9300}, bound_addresses {[::1]:9300}, {127.0.0.1:9300}
[2017-06-20T16:04:23,732][INFO ][o.e.c.s.ClusterService ] [node0] new_master {node0}{UzRF3doSTSCjExUTopduMw}{qPQnF3K6Q92g6qEJEcnIiA}{127.0.0.1}{127.0.0.1:9300}, reason: zen-disco-elected-as-master ([0] nodes joined)
[2017-06-20T16:04:23,875][INFO ][o.e.h.n.Netty4HttpServerTransport] [node0] publish_address {127.0.0.1:9200}, bound_addresses {[::1]:9200}, {127.0.0.1:9200}
[2017-06-20T16:04:23,880][INFO ][o.e.n.Node ] [node0] started
[2017-06-20T16:04:24,400][INFO ][o.e.g.GatewayService ] [node0] recovered [1] indices into cluster_state
此时可以在本机使用 curl http://localhost:9200 访问接口,由于elasticsearch.yml默认配置为只能本机访问,所以其它机器或浏览器无法访问此地址
进入解压后的kibana-5.4.1目录
修改配置文件kibana.yml
vim config/kibana.yml
把
server.host: "localhost"
改为
server.host: "0.0.0.0"
否则无法在其它机器访问到kibana
启动
./bin/kibana &
正常应该出现类似如下信息,没有WARN,没有ERROR
log [08:15:01.753] [info][status][plugin:[email protected]] Status changed from uninitialized to green - Ready
log [08:15:02.076] [info][status][plugin:[email protected]] Status changed from uninitialized to yellow - Waiting for Elasticsearch
log [08:15:02.124] [info][status][plugin:[email protected]] Status changed from uninitialized to green - Ready
log [08:15:02.247] [info][status][plugin:[email protected]] Status changed from uninitialized to green - Ready
log [08:15:02.263] [info][status][plugin:[email protected]] Status changed from yellow to green - Kibana index ready
log [08:15:02.905] [info][status][plugin:[email protected]] Status changed from uninitialized to green - Ready
log [08:15:02.955] [info][listening] Server running at http://0.0.0.0:5601
log [08:15:02.957] [info][status][ui settings] Status changed from uninitialized to green - Ready
在浏览器访问http://YOURIPADDRESS:5601 正常访问,成功
以上是关于CentOS6.5安装Elasticsearch5.4.1+Kibana5.4.1的主要内容,如果未能解决你的问题,请参考以下文章