Deploy ELK to build a log server cluster

Deploy the elasticsearch cluster The
first
cluster node configuration The first cluster node modify the host name
Insert picture description hereInsert picture description here
Change the SELINUX=permissive in the following file
Insert picture description here
[root@elk-n1 ~]# vim /etc/security/limits.conf #Modify system limits
Insert picture description here

  • soft nofile 65536 #The maximum number of files that can be opened by a single user (soft limit)
  • hard nofile 131072 #The maximum number of files that can be opened by a single user (hard limit)
  • soft nproc 4096 #The maximum number of processes available to a single user (soft limit)
  • hard nproc 8192 #The maximum number of processes available to a single user (hard limit)
  • soft memlock unlimited #Maximum lock memory address space (kb) (soft limit)
  • hard memlock unlimited #Maximum lock memory address space (kb) (hard limit)
    [root@elk-n1 ~]#reboot
    install java environment (java environment must be version 1.8 or higher)
    Insert picture description here
    Insert picture description here
    Insert picture description here
    Insert picture description here
    Insert picture description here
    Insert picture description here
    Insert picture description here
    #install elasticsearch to
    Insert picture description here
    Insert picture description here
    create a storage directory for elasticsearch data, and Modify the owner group of the directory
    Insert picture description here
    Insert picture description here
    Modify the elasticsearch log owner group
    Insert picture description here
    Modify the elasticsearch configuration file
    Insert picture description here
    Insert picture description here
    Insert picture description here
    Insert picture description here
    Insert picture description here
    Insert picture description here
    cluster.name: my-elk
    #Set the cluster name node.name: elk-n1
    #Set the node name node.master: true #Master Node
    node.data: true
    #Data node path.data: /var/es-data
    #Modify the path where data is stored path.logs: /var/log/elasticsearch #Modify the path of the logs
    bootstrap.memory_lock: true #Configure memory usage Exchange partition
    network.host: 0.0.0.0
    #Listening network address http.port: 9200 #Open the listening port
    cluster.initial_master_nodes: [“elk-n1”] #Cluster initial master node (Required for version 7.6)
    discovery.zen. ping.unicast.hosts: ["elk-n1","elk-n2"] #Node unicast communication
    http.cors.enabled: true #The following two are the newly added parameters,
    http.cors.allow-origin: “*” #Make the head plug-in can access the es
    firewall configuration
    Insert picture description here
    Modify the service configuration file of
    Insert picture description here
    Insert picture description here
    elasticsearch Start the elasticsearch
    Insert picture description here
    Insert picture description here
    second group Rally point configuration
    Modify the hostname of the second cluster node.
    Insert picture description here
    Insert picture description here
    Close SELinux:
    change SELINUX=permissive
    Insert picture description here
    Insert picture description here
    Insert picture description here
    Insert picture description here
    [root@elk-n2 ~]#reboot
    install java environment (java environment must be version 1.8 or higher)
    Insert picture description here
    Insert picture description here
    Insert picture description here
    Insert picture description here
    Insert picture description here
    Insert picture description here
    Insert picture description here
    install elasticsearch and
    Insert picture description here
    create elasticsearch data The storage directory of the directory and modify the owner group of the directory.
    Insert picture description here
    Insert picture description here
    Modify the log owner group of
    Insert picture description here
    elasticsearch. Modify the configuration file of elasticsearch.
    Insert picture description here
    Insert picture description here
    Insert picture description here
    Insert picture description here
    Insert picture description here
    Insert picture description here
    Firewall configuration.
    Insert picture description here
    Modify the configuration file of elasticsearch.
    Insert picture description here
    Insert picture description here
    Start elasticsearch and
    Insert picture description here
    Insert picture description here
    install the Head plug-in. On the elk-n1 host (the first machine) )
    Install EPEL source
    Insert picture description here
    First install phantomjs to
    Insert picture description here
    Insert picture description here
    Insert picture description here
    Insert picture description here
    test it
    Insert picture description here
    Install Head plugin
    Insert picture description here
    Insert picture description here
    Insert picture description here
    Insert picture description here
    Insert picture description here
    Insert picture description here
    #Install git, download Head plugin
    Insert picture description here
    Insert picture description here
    Insert picture description here
    Insert picture description here
    #Install grunt #Install
    Insert picture description here
    Insert picture description here
    plugin
    Insert picture description here
    Configure the Gruntfile.js file under elasticsearch-head
    Insert picture description here
    Modify the connect configuration node
    Add the host name
    Insert picture description here
    Modify the _site/app.js file
    Insert picture description here
    Modify the IP address
    Insert picture description here
    Start the head plug-in service (run in the background)
    Insert picture description here
    Insert picture description here
    Install and configure logstash (where you want to collect the logs, install it where )
    Insert picture description here
    Insert picture description here
    Insert picture description here
    Insert picture description here
    Logstash test
    Insert picture description here
    Log collection configuration:
    Insert picture description here
    Insert picture description here
    Insert picture description here
    input { file { path => “/var/log/messages” #Collect Linux system log type => “system” start_position => “beginning” } } output { elasticsearch {#output to elasticsearch = the hosts> [ "192.168.60.10:9200"] index => "System - YYYY.MM.DD% {+}" } } start Logstash View log mounting kibana # install # edit /etc/kibana/kibana.yml # start kibana install and configure filebeat # installation













    Insert picture description here

    Insert picture description here


    Insert picture description here

    Insert picture description here
    Insert picture description here
    Insert picture description here
    Insert picture description here
    Insert picture description here

    Insert picture description here


    Insert picture description here
    #Edit/etc/filebeat/filebeat.yml #Start filebeat to deploy
    Insert picture description here
    Insert picture description here
    Insert picture description here
    Insert picture description here
    Insert picture description here
    Insert picture description here
    Logstash
    Insert picture description here
    on the ELK-n2 server, and the Java environment is also required #Install the
    java environment (java environment must be version 1.8 or higher)
    Insert picture description here
    Insert picture description here
    Insert picture description here
    Insert picture description here
    Insert picture description here
    Insert picture description here
    Install Apache and Logstash
    Insert picture description here
    Insert picture description here
    Insert picture description here
    #Install Logstash #Edit
    Insert picture description here
    Insert picture description here
    Insert picture description here
    Insert picture description here
    Insert picture description here
    configuration /etc/logstash/conf.d/apache_access.conf
    Insert picture description here
    Insert picture description here
    input { file { path => “/var/log/httpd/access_log” type => “Apache_access” start_position => “beginning” } } output { elasticsearch { action => "Index" hosts => ["192.168.60.10:9200"] index => "apache_access-%{+YYYY.MM.dd}" } } Edit configuration /etc/logstash/conf.d/apache_error.conf input { file { path => “/etc/httpd/logs/error_log”














    Insert picture description here
    Insert picture description here



    type => "Apache_error"
    start_position => "beginning"
    }
    }
    output { elasticsearch { action => "index" hosts => ["192.168.60.10:9200"] index => "apache_error-%{+YYYY.MM.dd }” } } Start the Logstash test or start Logstash, and verify on the ESK host, don’t forget the firewall settings Kibana page







    Insert picture description here

    Insert picture description here
    Insert picture description here
    Insert picture description here
    Insert picture description here
    Insert picture description here

    Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_51167520/article/details/110645806