码迷,mamicode.com
首页 > 其他好文 > 详细

ELK日志搭建

时间:2019-09-29 21:40:40      阅读:79      评论:0      收藏:0      [点我收藏+]

标签:gif   sys   pre   roo   kibana   nload   arch   cse   search   

 

安装java

安装java1.8以上的版本并验证

[root@localhost ~]# yum install java
[root@localhost ~]# java -version
openjdk version "1.8.0_222"
OpenJDK Runtime Environment (build 1.8.0_222-b10)
OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode)

安装Elasticsearch

安装Elasticsearch(Elasticsearch、Kibana、FileBeat版本最好一致)

技术图片
[root@localhost ~]# wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.4.tar.gz
[root@localhost ~]# tar -zxvf elasticsearch-6.2.4.tar.gz
[root@localhost ~]# mv elasticsearch-6.2.4 /usr/local/elasticsearch-6.2.4
[root@localhost ~]# cd /usr/local/elasticsearch-6.2.4 [root@localhost ~]# vi config/elasticsearch.yml network.host: 0.0.0.0 http.port: 9200 #由于这里不能直接用root用户运行elasticsearch,所以要创建一个新用户 [root@localhost ~]# adduser fengzi [root@localhost ~]# passwd fengzi [root@localhost ~]# chmod -R 777 /usr/local/elasticsearch-6.2.4 [root@localhost ~]# su fengzi

#启动elasticsearch
[root@localhost ~]# ./bin/elasticsearch
技术图片

如果服务启动不起来,以下是解决办法

技术图片
#添加以下4行内容
[root@localhost local]# vim /etc/security/limits.conf
        * soft nofile 65536
        * hard nofile 65536
        efk soft nproc 8192
        efk hard nproc 8192            

#修改成以下内容
[root@localhost local]# vim /etc/security/limits.d/20-nproc.conf
        *          soft    nproc    4096
        root       soft    nproc     unlimited    

#添加如下一行
[root@localhost local]# vim /etc/sysctl.conf 
        vm.max_map_count=655360
[root@localhost local]# sysctl -p
#查看一下9200和9300端口有没有启
[root@localhost local]# ss -tnl
State       Recv-Q Send-Q              Local Address:Port                             Peer Address:Port              
LISTEN      0      128                             *:22                                          *:*                  
LISTEN      0      100                     127.0.0.1:25                                          *:*                
LISTEN      0      80                             :::3306                                       :::*                  
LISTEN      0      128                            :::9200                                       :::*                  
LISTEN      0      128                            :::9300                                       :::*                  
LISTEN      0      128                            :::22                                         :::*                  
LISTEN      0      100                           ::1:25                                         :::*                  
技术图片

 

安装Kibana

按 Ctrl+C 复制代码

[root@localhost local]# wget https://artifacts.elastic.co/downloads/kibana/kibana-6.2.4-linux-x86_64.tar.gz
[root@localhost local]# tar -zxvf kibana-6.2.4-linux-x86_64.tar.gz
[root@localhost local]# vi config/kibana.yml
elasticsearch.url: "http://0.0.0.0:9200"
server.host: "0.0.0.0"
kibana.index: ".kibana"
#启动kibana服务
[root@localhost local]# ./bin/kibana

#查看5601端口有没有启动
[root@localhost local]# ss -tnl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:22 *:*
LISTEN 0 100 127.0.0.1:25 *:*
LISTEN 0 128 *:5601 *:*
LISTEN 0 80 :::3306 :::*
LISTEN 0 128 :::9200 :::*
LISTEN 0 128 :::9300 :::*
LISTEN 0 128 :::22 :::*
LISTEN 0 100 ::1:25 :::*

按 Ctrl+C 复制代码

安装FileBeat

技术图片
[root@localhost local]# wget https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-6.2.4-linux-x86_64.tar.gz
[root@localhost local]# tar -zxvf filebeat-6.2.4-linux-x86_64.tar.gz
[root@localhost local]# vi filebeat.yml
        enabled: true
[root@localhost local]# ./filebeat -c filebeat.yml
技术图片

 

配置Kibana

技术图片

 

 

技术图片

 

 

技术图片

ELK日志搭建

标签:gif   sys   pre   roo   kibana   nload   arch   cse   search   

原文地址:https://www.cnblogs.com/gxc888/p/11609829.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!