Elasticsearch+Logstash+Kibana搭建手册

Elasticsearch+Logstash+Kibana搭建

环境:

linux系统版本:CentOS6.5 32bit
java版本:jdk_1.8.0_144
elasticsearch:elasticsearch-6.1.1.tar.gz
logstash:logstash-6.1.1.tar.gz
kibana:kibana-6.1.1-linux-x86_64.tar.gz
1.Elasticsearch安装
1.1.下载elasticsearch-6.1.1二进制包

去官网下载Elasticsearch6.1.1,Elasticsearch-6.1.1

1.2.在/usr/local目录下,解压elasticsearch-6.1.1.tar.gz
# tar -zxvf elasticsearch-6.1.1.tar.gz
1.3.将elasticsearch作为linux服务
# cd /etc/init.d
# vi elasticsearch

在elasticsearch文件中添加如下内容:

#!/bin/sh
#
# Simple elasticsearch init.d script conceived to work on Linux systems
# as it does use of the /proc filesystem.
#chkconfig: 2345 80 90
#启动elasticsearch服务
/usr/local/elasticsearch/elasticsearch-6.1.1/bin/elasticsearch -d -p /usr/local/elasticsearch/elasticsearch-6.1.1/pid

给予执行权限,执行如下命令:

chmod a+x elasticsearch
1.4.修改config/elasticsearch.yml如下:
#自己的节点主机名
node.name: edu-zk-01
network.host: 0.0.0.0
1.5.启动服务
# /etc/init.d/elasticsearch start

通过jps查看后台进程,得到结果如下:

3179 Elasticsearch
3247 Jps

验证elasticsearch能否正常提供服务,调用http web服务,内容如下:

# curl -XGET http://ip地址:9200

能够正常返回结果,示例如下:

{
  "name" : "edu-zk-01",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "OXx8Go5URo2guyPV4BwRKQ",
  "version" : {
    "number" : "6.1.1",
    "build_hash" : "bd92e7f",
    "build_date" : "2017-12-17T20:23:25.338Z",
    "build_snapshot" : false,
    "lucene_version" : "7.1.0",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}

说明服务正常,搭建成功。

1.6.常见问题
  • 问题一

启动时报:max file descriptors [4096] for elasticsearch process likely too low, increase to at least
[65536]

原因:无法创建本地文件问题,用户最大可创建文件数太小

解决方案:切换到root用户,编辑limits.conf配置文件, 添加类似如下内容:

* 代表Linux所有用户名称,需要保存、退出、重新登录才可生效

vi /etc/security/limits.conf
添加如下内容:
*  soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096
  • 问题二

启动时报:max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]

原因:最大虚拟内存太小

解决方案:以root用户边界sysctl.conf,添加如下内容:

# Vm max map count 
vm.max_map_count = 262144
  • 问题三
    启动时报:system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk

原因:Centos6不支持SecComp,而ES默认bootstrap.system_call_filter为true进行检测,所以导致检测失败,失败后直接导致ES不能启动

解决方案:在elasticsearch.yml中新增配置bootstrap.system_call_filter,设为false,注意要在Memory下面:

bootstrap.memory_lock: false
bootstrap.system_call_filter: false
2.Logstash安装
2.1.下载logstash-6.1.1二进制包

去官网下载Logstash6.1.1,Logstash-6.1.1

2.2.在/usr/local目录下,下载logstash-6.1.1.tar.gz
# tar -zxvf logstash-6.1.1.tar.gz
2.3.将下载logstash作为linux服务
# cd /etc/init.d
# vi logstash

在logstash文件中添加如下内容:

#!/bin/sh
#
# Simple logstash init.d script conceived to work on Linux systems
# as it does use of the /proc filesystem.
#chkconfig: 2345 80 90
#启动logstash服务
/usr/local/logstash/logstash-6.1.1/bin/logstash -f /usr/local/logstash/logstash-6.1.1/logstash.conf --config.reload.automatic

给予执行权限,执行如下命令:

chmod a+x logstash

–config.reload.automatic为修改了logstash的配置文件后无需重启,能够自动加载配置

2.4.启动服务
# /etc/init.d/logstash start

通过jps查看后台进程,得到结果如下:

3472 Main
3527 Jps
3179 Elasticsearch
2.5.验证服务是否能够正常运行
# cd logstash-6.1.1
# bin/logstash -e 'input { stdin { } } output { stdout {} }'

最后在输入如下内容:

hello world

如果正确输出了:2017-12-28T01:00:55.393Z edu-zk-01 hello world,说明能够正常运行。

3.Kibana安装
3.1.下载kibana-6.1.1二进制包

去官网下载Kibana6.1.1,Kibana-6.1.1

3.2.在/usr/local目录下,下载kibana-6.1.1.tar.gz
# tar -zxvf kibana-6.1.1.tar.gz
3.3.将下载kibana作为linux服务
# cd /etc/init.d
# vi kibana

在kibana文件中添加如下内容:

#!/bin/sh
#
# Simple kibana init.d script conceived to work on Linux systems
# as it does use of the /proc filesystem.
#chkconfig: 2345 80 90
#启动kibana服务
/usr/local/kibana/kibana-6.1.1-linux-x86_64/bin/kibana &

给予执行权限,执行如下命令:

chmod a+x kibana
3.4.启动服务
# /etc/init.d/kibana start

通过http://ip地址:5601访问是否启动成功

3.5.常见问题

问题一:

如果在32位linux系统中运行会报:/node/bin/node: cannot execute binary file问题

原因:kibana只提供了64位的kibana,由于kibana是基于node.js,而提供的二进制包中的node.js是64位的

解决方案:去IBM下载你的系统对应的node.js,笔者下载的是ibm-6.12.2.0-node-v6.12.2-linux-x86.bin,在linux系统中,进行如下操作:

# chmod a+x ibm-6.12.2.0-node-v6.12.2-linux-x86.bin
# ./ibm-6.12.2.0-node-v6.12.2-linux-x86.bin

安装完后,会默认安装到:/root/ibm中,将kibana中的kibana-6.1.1-linux-x86_64/node替换为/root/ibm/node,就可以大功告成了。

下载地址:http://www14.software.ibm.com/cgi-bin/weblap/lap.pl?popup=Y&la_formnum=&li_formnum=L-PIVN-AR5EGT&title=IBM%20SDK%20for%20Node.js%20Version%206&accepted_url=http://public.dhe.ibm.com/ibmdl/export/pub/systems/cloud/runtimes/nodejs/6.12.2.0/linux/i386/ibm-6.12.2.0-node-v6.12.2-linux-x86.bin

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值