ELK5.0 (Elasticsearch Logstash Kibana) 搭建部署

Elasticsearch+Logstash+Kibana 实时在线日志分析系统

文件下载地址:https://www.elastic.co/downloads/past-releases

环境

centOS 6.8

jdk1.8

 

一、安装Elasticsearch

1.下载好安装包 并解压安装

[root@linux1 ~]# tar -zxvf  elasticsearch-5.0.0.tar.gz

[root@linux1 ~]# mv elasticsearch-5.0.0 /usr/local/elasticsearch

 

2.运行

[root@linux1 ~]# cd /usr/local/elasticsearch/

[root@linux1 elasticsearch]# bin/elasticsearch

注意:这里直接运行会报错,elasticsearch默认是不允许在root下运行,要新建一个系统用户

[root@linux1 elasticsearch]# useradd es

[root@linux1 elasticsearch]# chown -R root .

[root@linux1 elasticsearch]# chown -R es .

[root@linux1 elasticsearch]# chgrp -R es .

[root@linux1 elasticsearch]# ls -l

total 48

drwxr-xr-x.  2 es es  4096 Dec 25 00:54 bin

drwxr-xr-x.  2 es es  4096 Oct 26 04:40 config

drwxr-xr-x.  2 es es  4096 Oct 26 04:40 lib

-rw-r--r--.  1 es es 11358 Oct 26 04:35 LICENSE.txt

drwxr-xr-x.  2 es es  4096 Dec 25 05:11 logs

drwxr-xr-x. 12 es es  4096 Oct 26 04:40 modules

-rw-r--r--.  1 es es   150 Oct 26 04:35 NOTICE.txt

-rw-r--r--.  1 es es  9108 Oct 26 04:35 README.textile

并给目录下的文件赋予权限,否则会报错permission denied

登录到用户

[root@linux1 elasticsearch]# su es

[es@linux1 elasticsearch]$ bin/elasticsearch

 

3.报错处理

上网查了一下,说是linux版本较低,只是一个警告,那就可以忽略,后面还在继续运行

又发现报错,这次是真的报错

继续上网寻求帮助

摘自http://www.dajiangtai.com/community/18136.do?origin=csdn-blog

(1)error: bootstrap checks failed

max file descriptors [4096] for elasticsearch process likely too low, increase to at least   [65536]

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

解决方案:

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

vi /etc/security/limits.conf

添加如下内容:

* soft nofile 65536

 

* hard nofile 131072

 

* soft nproc 2048

 

* hard nproc 4096

备注:* 代表Linux所有用户名称(比如 hadoop)

保存、退出、重新登录才可生效

 

(2)max number of threads [1024] for user [es] likely too low, increase to at least [2048]

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

解决方案:切换到root用户,进入limits.d目录下,修改90-nproc.conf 配置文件。

vi /etc/security/limits.d/90-nproc.conf

找到如下内容:

* soft nproc 1024

#修改为

* soft nproc 2048

 

(3)max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]

原因:最大虚拟内存太小

解决方案:切换到root用户下,修改配置文件sysctl.conf

vi /etc/sysctl.conf

添加下面配置:

vm.max_map_count=655360

并执行命令:

sysctl -p

然后重新启动elasticsearch,即可启动成功。

 

4.检测elasticsearch

[root@linux1 config]# curl -X GET http://192.168.1.120:9200/

{

  "name" : "QWUKxcz",

  "cluster_name" : "elasticsearch",

  "cluster_uuid" : "QGD4pcGrQXSobqufKkFZ4Q",

  "version" : {

    "number" : "5.0.0",

    "build_hash" : "253032b",

    "build_date" : "2016-10-26T04:37:51.531Z",

    "build_snapshot" : false,

    "lucene_version" : "6.2.0"

  },

  "tagline" : "You Know, for Search"

}

安装完成~

 

 

二、安装Logstash

1.下载安装包 并解压安装

[root@linux1 ~]# tar -zxvf logstash-5.0.0.tar.gz

[root@linux1 ~]# mv logstash-5.0.0 /usr/local/logstash

 

2.测试

[root@linux1 ~]# cd /usr/local/logstash

[root@linux1 logstash]# bin/logstash -e 'input{stdin{}}output{stdout{codec=>rubydebug}}'

回车,然后你会发现终端在等待你的输入。敲入 hello world,回车,然后看看会返回什么结果

{

    "@timestamp" => 2016-12-25T10:13:03.901Z,

      "@version" => "1",

          "host" => "linux1.xxxx.com",

       "message" => "hello world"

}

 

 

三、安装Kibana

1.下载安装包 并解压安装

[root@linux1 ~]# tar -zxvf kibana-5.0.0-linux-x86_64.tar.gz

[root@linux1 ~]# mv kibana-5.0.0-linux-x86_64 /usr/local/kibana

 

2.修改配置

[root@linux1 ~]# /usr/local/kibana/config

[root@linux1 config]# ls

kibana.yml

[root@linux1 config]# vi kibana.yml

找到

#server.host: "localhost"

#elasticsearch.url: "http://localhost:9200"

 

修改为你当前的IP地址,例:

server.host: "192.168.1.120"

elasticsearch.url: "http://192.168.1.120:9200"

 

3.运行Kibana

[root@linux1 kibana]# bin/kibana

用浏览器打开上面的地址

安装完成~

转载于:https://my.oschina.net/u/1458864/blog/2050768

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值