一、背景

  学习ELK,动手实验。

  参考:https://blog.csdn.net/qq_33406938/article/details/80307679

二、环境

  虚拟机一台,已安装jdk1.8,nginx,ip:192.168.1.8。

三、步骤

1、配置limit.conf

[root@localhost ~]# vi /etc/security/limit.conf
* hard nofile 65536
* soft nofile 65536
* soft nproc 65536
* hard nproc 65536

2、配置sysctl.conf

[root@localhost ~]# vi /etc/sysctl.conf

...

vm.max_map_count = 262144
net.core.somaxconn=65535
net.ipv4.ip_forward = 1

...

[root@localhost ~]# sysctl -p
vm.max_map_count = 262144
net.core.somaxconn = 65535
net.ipv4.ip_forward = 1

3、关闭防火墙

[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# systemctl disable firewalld

[root@localhost ~]# iptables -F

4、配置清华镜像yum源

[root@localhost ~]# vi /etc/yum.repos.d/elk.repo
[elk]
name=elk
baseurl=https://mirrors.tuna.tsinghua.edu.cn/elasticstack/yum/elastic-6.x/
enable=1
gpgcheck=0

5、安装elasticsearch、logstash、kibana、filebeat、nodejs

[root@localhost ~]# yum install elasticsearch -y

[root@localhost ~]# yum install logstash -y

[root@localhost ~]# yum install kibana -y

[root@localhost ~]# yum install filebeat -y

[root@localhost ~]# yum install nodejs -y

6、配置elasticsearch.yml并启动elasticsearch服务

[root@localhost ~]# vi /etc/elasticsearch/elasticsearch.yml

...

cluster.name: elk-stack
node.name: elk.node1
path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch
network.host: 0.0.0.0
http.port: 9200
discovery.zen.ping.unicast.hosts: ["192.168.1.8:9300"]
discovery.zen.minimum_master_nodes: 1

...

[root@elk ~]# systemctl start elasticsearch
[root@elk ~]# ss -ntlup| grep -E "9200|9300"

tcp LISTEN 0 65535 :::9200 :::* users:(("java",pid=16217,fd=234))
tcp LISTEN 0 65535 :::9300 :::* users:(("java",pid=16217,fd=209))

7、配置kibana.yml并启动kibana服务

[root@localhost ~]# vi /etc/kibana/kibana.yml

...

server.port: 5601
server.host: "0.0.0.0"
elasticsearch.url: "http://192.168.1.8:9200"
kibana.index: ".kibana"

...

[root@localhost ~]# systemctl start kibana

[root@localhost ~]# ss -ntlup | grep 5601
tcp LISTEN 0 511 *:5601 *:* users:(("node",pid=19513,fd=18))

8、配置logstash.yml,添加日志处理文件local_syslog.conf,启动logstash

[root@localhost ~]# vi /etc/logstash/logstash.yml

...

path.config: /etc/logstash/conf.d

...

添加日志处理文件:

[root@localhost ~]# vi /etc/logstash/conf.d/local_syslog.conf

input {
#filebeat客户端
beats {
port => 5044
}
}

#筛选
#filter { }

output {
# 输出到es
elasticsearch {
hosts => ["http://192.168.1.8:9200"]
index => "syslog-%{+YYYY.MM.dd}"
}

}

[root@localhost ~]# vi /etc/logstash/conf.d/local_syslog.conf

[root@localhost ~]# lsof -i:5044
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 17524 logstash 114u IPv6 149366 0t0 TCP *:lxi-evntsvc (LISTEN)

9、配置filebeat.yml并启动filebeat

[root@localhost ~]# vi /etc/filebeat/filebeat.yml

...

filebeat.inputs:
- type: log
enabled: true
paths:
- /var/log/messages
filebeat.config.modules:
path: ${path.config}/modules.d/*.yml
reload.enabled: false
setup.template.settings:
index.number_of_shards: 3
output.logstash:
hosts: ["192.168.1.8:5044"]

...

[root@localhost ~]# systemctl start filebeat

至此,在浏览器中输入http://192.168.1.8即可访问ELK之kibana界面。

10、汉化kibana

[root@localhost ~]# yum install -y git

[root@localhost ~]# git clone https://github.com/anbai-inc/Kibana_Hanization.git

[root@localhost ~]# cd kibana_Hanization

#查看README.md文件,得到汉化方法为:拷贝translations`文件夹`到kibana目录下的`src/legacy/core_plugins/kibana/`目录

[root@localhost kibana_Hanization]#  rsync -av --progress translations /usr/share/kibana/src/legacy/core_plugins/kibana

重启kibana:

[root@localhost ~]#  systemctl restart kibana

[root@localhost ~]# ss -ntlup | grep 5601
tcp LISTEN 0 511 *:5601 *:* users:(("node",pid=19513,fd=18))

此时,用浏览器访问http://192.168.1.8:5601即可看到中文界面的kibana。

centos7部署ELK测试的更多相关文章

  1. centos7 部署 ELK 日志系统

    =============================================== 2017/12/24_第3次修改                       ccb_warlock 更 ...

  2. Centos7部署kubernetes测试k8s应用(九)

    1.创建一个deployment [root@linux-node1 ~]# kubectl run net-test --image=alpine --replicas=2 sleep 360000 ...

  3. Centos7单机部署ELK+x-pack

    ELK分布式框架作为现在大数据时代分析日志的常为大家使用.现在我们就记录下单机Centos7部署ELK的过程和遇到的问题. 系统要求:Centos7(内核3.5及以上,2核4G) elk版本:6.2. ...

  4. centos7.5部署ELk

    第1章 环境规划 1.1 ELK介绍       ELK是ElasticSerach.Logstash.Kibana三款产品名称的首字母集合,用于日志的搜集和搜索.      Elasticsearc ...

  5. centos7搭建ELK Cluster集群日志分析平台(四):Fliebeat-简单测试

    续之前安装好的ELK集群 各主机:es-1 ~ es-3 :192.168.1.21/22/23 logstash: 192.168.1.24 kibana: 192.168.1.25 测试机:cli ...

  6. [原创]ubuntu14.04部署ELK+redis日志分析系统

    ubuntu14.04部署ELK+redis日志分析系统 [环境] host1:172.17.0.4 搭建ELK+redis服务 host2:172.17.0.3 搭建logstash+nginx服务 ...

  7. centos7搭建ELK Cluster集群日志分析平台(三):Kibana

    续  centos7搭建ELK Cluster集群日志分析平台(一) 续  centos7搭建ELK Cluster集群日志分析平台(二) 已经安装好elasticsearch 5.4集群和logst ...

  8. redis3.0集群部署和测试

    redis3.0集群部署和测试 环境介绍 两台Centos7的虚拟机模拟6个节点,A台3个master节点,B台3个slave节点A地址:172.16.81.140B地址:172.16.81.141r ...

  9. centos7搭建ELK Cluster集群日志分析平台

    应用场景:ELK实际上是三个工具的集合,ElasticSearch + Logstash + Kibana,这三个工具组合形成了一套实用.易用的监控架构, 很多公司利用它来搭建可视化的海量日志分析平台 ...

随机推荐

  1. css的属性选择器

    语法说明: 属性选择器需要将对应属性放入到 方括号中  [ ] ,其中包含属性名,标识符(* $ ~ ^ |) 使用说明: [attribute] 例如  [target] 表示 选择带有 targe ...

  2. vue将后台的值赋给前台

    后台传List到前台: 赋值给table 赋值给form(只能一个个的赋值,对应prop属性) 后台传map到前台:(不需要使用下标取值)

  3. mac下xampp访问php显示403错误

    错误描述 New xampp security concept: Access Forbidden Error 403 错误分析和解决 403就是我们访问的时候,被安全策略拒绝了,解决方法 找到文件 ...

  4. crontab自动启动小任务例子(每一分钟将当前日期打入一个文件)

      crontab -l #查看当前定时任务列表 显示没有,那么我们来安装一下(必须在root用户下) – yum install vixie-cron  – yum install crontabs ...

  5. java接口自动化(五) - 企业级代码管理工具Git的配置

    1.简介 上一篇讲解完如何安装Git后,今天宏哥趁热打铁讲解一下Git的使用,要想使用Git,我们还需要做一些准备工作,首先你的拥有一个Git账号,所以如果你没有的话,就快速注册一个吧. 2.Git注 ...

  6. JSP中System.out.println()与out.println()区别

    1.out.println()输出到客户端. 在out.println()中,out是response的实例,是以response为对象进行流输出的,即将内容输出到客户端. 如果在JSP页面中使用Sy ...

  7. hdu2138 How many prime numbers 米勒测试

    hdu2138 How many prime numbers #include <bits/stdc++.h> using namespace std; typedef long long ...

  8. nginx操作目录

    nginx配置文件/conf/nginx.conf 错误日志功能:los/error.log 访问日志功能:logs/access.log 站点服务请求功能配置:html/ 禁止访问功能配置 404页 ...

  9. python3.x 基础三:文件IO

    打开文件的两种方式 1.直接打开文件并赋值给变量,打开后得到操作句柄,但不会自动关闭 file = open('文件名‘,'打开模式',’编码‘) fd = open('../config/file1 ...

  10. Spring 由构造函数自动装配

    Spring 由构造函数自动装配,这种模式与 byType 非常相似,但它应用于构造器参数. Spring 容器看作 beans,在 XML 配置文件中 beans 的 autowire 属性设置为 ...