Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Script sharing of one-click deployment of EFK Services based on Centos7 system

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the knowledge of "script sharing for one-click deployment of EFK services based on Centos7 system". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Architecture

EFK adopts a centralized log management architecture

Elasticsearch: an open source distributed search engine that provides three functions of collecting, analyzing and storing data. Its features are: distributed, zero configuration, automatic discovery, automatic index slicing, index copy mechanism, restful style interface, multiple data sources, automatic search load and so on.

Kibana: provides a friendly log analysis Web interface for Logstash, Beats, and ElasticSearch to help summarize, analyze, and search important data logs.

Filebeat: lightweight log collector. Filebeat needs to be configured on each application server to collect logs and output to elasticsearch

Deploy the KIBANA script with one click

Function install_es7_el7 () {echo "" echo-e "\ 033 [33m installation * install ElasticSearch 7.6.2 installation * * 033 [0m "# action" * initialize JAVA environment * "/ bin/true # install_jdk # download package if [- f / opt/elasticsearch-7.6.2-x86_64.rpm] & & [- f / opt/elasticsearch-analysis-ik-7.6.2.zip] Then echo "* there is an ElasticSearch 7.6.2 installation package, no need to download *" else ping-c 4 artifacts.elastic.co > / dev/null 2 > & 1 if [$?-eq 0] Then wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.6.2-x86_64.rpm-O / opt/elasticsearch-7.6.2-x86_64.rpm wget https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.6.2/elasticsearch-analysis-ik-7.6.2.zip-O / opt/elasticsearch-analysis-ik-7.6.2.zip else echo "please download ES7 package manual!" Exit $? Fi fi # install es7.6 action "* install ElasticSearch 7.6.2 Service *" / bin/true chmod uplix / opt/elasticsearch-7.6.2-x86_64.rpm & & rpm-ivh / opt/elasticsearch-7.6.2-x86_64.rpm # create a directory and authorize mkdir-p $ES_HOME/data & & mkdir-p $ES_HOME/log chown-R Elasticsearch:elasticsearch $ES_HOME & & chmod-R 755 $ES_HOME # modify the ES configuration file cp / etc/elasticsearch/elasticsearch.yml / etc/elasticsearch/elasticsearch.yml_bak & > / dev/null cat > / etc/elasticsearch/elasticsearch.yml / dev/null chown-R elasticsearch:elasticsearch / usr/share/elasticsearch/plugins/ & & chmod-R 755 / usr/share/elasticsearch/plugins/ sleep 2 # to add default word splitter attributes to the index template in the filebeat configuration file. New indexes to be created in the future will refer to this attribute: # setup.template.settings: # index.analysis.analyzer.default.type: "ik_max_word" # index.analysis.analyzer.default_search.type: "ik_max_word" # setup.template.overwrite: true # execute the following command in the Linux terminal for all existing indexes Set the default word splitter property: # curl-X POST "172.16.20.143:9200/_all/_close" # curl-X PUT-H'Content-Type: application/json' 'http://172.16.20.143:9200/_all/_settings?preserve_existing=true'-d' {# "index.analysis.analyzer.default.type": "ik_max_word" # "index.analysis.analyzer.default_search.type": "ik_max_word" #}'# curl-X POST "172.16.20.143:9200/_all/_open" # launch ES and initialize data action "* start es and initialize data *" / bin/true systemctl daemon-reload & & systemctl enable elasticsearch.service systemctl restart elasticsearch.service es _ version= `curl-XGET ${ES_IP}: ${ES_PORT} `curl-e "\ 033 [33m installation * complete ElasticSearch 7.6.2 installation * * *\ 033 [0m "cat > / tmp/es7.log / dev/null 2 > & 1 if [$?-eq 0] Then wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.6.2-x86_64.rpm-O / opt/elasticsearch-7.6.2-x86_64.rpm wget https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.6.2/elasticsearch-analysis-ik-7.6.2.zip-O / opt/elasticsearch-analysis-ik-7.6.2.zip else echo "please download ES7 package manual!" Exit $? Fi fi # install es7.6 action "* install ElasticSearch 7.6.2 Service *" / bin/true chmod uplix / opt/elasticsearch-7.6.2-x86_64.rpm & & rpm-ivh / opt/elasticsearch-7.6.2-x86_64.rpm # create a directory and authorize mkdir-p $ES_HOME/data & & mkdir-p $ES_HOME/log chown-R Elasticsearch:elasticsearch $ES_HOME & & chmod-R 755 $ES_HOME # modify the ES configuration file cp / etc/elasticsearch/elasticsearch.yml / etc/elasticsearch/elasticsearch.yml_bak & > / dev/null cat > / etc/elasticsearch/elasticsearch.yml / dev/null chown-R elasticsearch:elasticsearch / usr/share/elasticsearch/plugins/ & & chmod-R 755 / usr/share/elasticsearch/plugins/ sleep 2 # to add default word splitter attributes to the index template in the filebeat configuration file. New indexes to be created in the future will refer to this attribute: # setup.template.settings: # index.analysis.analyzer.default.type: "ik_max_word" # index.analysis.analyzer.default_search.type: "ik_max_word" # setup.template.overwrite: true # execute the following command in the Linux terminal for all existing indexes Set the default word splitter property: # curl-X POST "172.16.20.143:9200/_all/_close" # curl-X PUT-H'Content-Type: application/json' 'http://172.16.20.143:9200/_all/_settings?preserve_existing=true'-d' {# "index.analysis.analyzer.default.type": "ik_max_word" # "index.analysis.analyzer.default_search.type": "ik_max_word" #}'# curl-X POST "172.16.20.143:9200/_all/_open" # launch ES and initialize data action "* start es and initialize data *" / bin/true systemctl daemon-reload & & systemctl enable elasticsearch.service systemctl restart elasticsearch.service es _ version= `curl-XGET ${ES_IP}: ${ES_PORT} `curl-e "\ 033 [33m installation * complete ElasticSearch 7.6.2 installation * * *\ 033 [0m "cat > / tmp/es7.log / dev/null 2 > & 1 if [$?-eq 0] Then wget https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.6.2-x86_64.rpm-O / opt/filebeat-7.6.2-x86_64.rpm else echo "please download Filebeat7.6 package manual!" Exit $? Fi fi # install filebeat7.6 action "* install filebeat 7.6.2 Service *" / bin/true chmod uplix / opt/filebeat-7.6.2-x86_64.rpm & & rpm-ivh / opt/filebeat-7.6.2-x86_64.rpm # modify the kibana configuration file cp / etc/filebeat/filebeat.yml / etc/filebeat/filebeat.yml_bak cat > / Etc/filebeat/filebeat.yml / dev/null 2 > & 1 & echo-e "\ 033 [33m installation * complete Filebeat 7.6.2 installation * * *\ 033 [0m "cat > / tmp/filebeat7.log

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report