• centos 7 搭建 efk 日志收集系统


    一,下载软件

           下载地址 https://www.elastic.co/cn/downloads/  ,里面有 Elasticsearch Kibana Logstash Beats 整套软件下载,我们只下载  Elasticsearch 和  Kibana 。

           下载有 2种 一种是 rpm 包,另外是 .tar.gz 解压文件,我们这里选择 .tar.gz ,版本选择 最新版 注意要版本一致。

            下载命令:

            wget  https://artifacts.elastic.co/downloads/kibana/kibana-6.7.1-linux-x86_64.tar.gz

            wget  wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.7.1.tar.gz

            

    二,修改系统参数

           vim  /etc/sysctl.conf      #增加如下内容

           net.ipv4.tcp_tw_recycle = 1
           net.ipv4.tcp_tw_reuse = 1
           net.ipv4.ip_local_port_range = 10240    65535

           vm.max_map_count = 262144

           vim /etc/security/limits.conf #增加如下内容

           root soft nofile 65536
           root hard nofile 65536
           * soft nofile 65536
           * hard nofile 65536

    三,安装 Elasticsearch 

           1, 解压 elasticsearch-6.7.1.tar.gz 并移动到 /usr/local/ 下面

            tar -zxvf  elasticsearch-6.7.1.tar.gz

            mv elasticsearch-6.7.1 /usr/local/elasticsearch

            2,修改配置文件

            vim /usr/local/elasticsearch/config/elasticsearch.yml #增加如下内容

            network.host: 0.0.0.0

            node.name: node-1

            cluster.initial_master_nodes: ["node-1"]

           #开启权限验证 用户名密码登录

      http.cors.enabled: true
      http.cors.allow-origin: "*"
      http.cors.allow-headers: Authorization
      xpack.security.enabled: true
      xpack.security.transport.ssl.enabled: true

           vim /usr/local/elasticsearch/bin/elasticsearch-env

           #!/bin/bash

            export JAVA_HOME="/usr/local/elasticsearch/jdk"

      执行 bin/elasticsearch-setup-passwords interactive  设置密码

            测试站设置 0.0.0.0 正式站写IP为了安全。

            3,增加 es用户

             adduser es

             chown -R es /usr/local/elasticsearch

             4,启动 Elasticsearch 

             su es

             cd /usr/local/elasticsearch/bin

             ./elasticsearch -d

             四,安装Kibana

             1,解压 kibana-6.7.1-linux-x86_64.tar.gz 到 /usr/local/ 下面

              tar -zxvf kibana-6.7.1-linux-x86_64.tar.gz 

              mv kibana-6.7.1-linux-x86_64 /usr/local/kibana

              cd /usr/local/kibana

              2, 修改 配置文件

              vim kibana.yml

              server.host: "0.0.0.0"

              elasticsearch.hosts: ["http://192.168.192.11:9200"]

              在kibana的management=>advance setting里设置truncate:maxHeight为0

              3,启动

               nohup /usr/local/kibana/bin/kibana >>/usr/local/kibana/bin/kibanalog.txt 2>&1 &

              五,安装 fluentd

              1,执行如下命令(命令将会自动安装td-agent,td-agent即为fluentd)

        $ curl -L https://toolbelt.treasuredata.com/sh/install-redhat-td-agent2.sh | sh
    2,安装插件
    /usr/sbin/td-agent-gem install fluent-plugin-elasticsearch
    /usr/sbin/td-agent-gem install fluent-plugin-typecast
    /usr/sbin/td-agent-gem install fluent-plugin-secure-forward
    3,修改配置文件

    vim /etc/td-agent/td-agent.conf #修改为如下
    <source>
       @type forward
       port 24224
       bind 0.0.0.0
    </source>
    <match *.**>
       @type copy
       <store>
          @type elasticsearch
          host 127.0.0.1
          port 9200
          logstash_format true
          logstash_prefix fluentd
          logstash_dateformat %Y%m%d
          include_tag_key true
          type_name access_log
          tag_key @log_name
          flush_interval 1s
       </store>
       <store>
        @type stdout
       </store>
    </match>

    3,重启
               systemctl restart td-agent

            

  • 相关阅读:
    state estimation for robotics-1
    Linux命令----用户目录、路径
    Linux命令----系统目录结构
    Linux命令----shell
    socket php
    深入浅出讲解:php的socket通信 转
    phpstorm配置sftp自动上传
    linux下xdebug的安装和配置方法
    xdebug安装
    swoole 客户端和服务端不断通信
  • 原文地址:https://www.cnblogs.com/ligang0357/p/10671580.html
Copyright © 2020-2023  润新知