自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

基于Centos7系統(tǒng)一鍵部署EFK服務(wù),值得收藏

系統(tǒng) Linux
最近平臺EFK版本均作了升級,平臺采用EFK(ElasticSearch-7.6.2 + FileBeat-7.6.2 + Kibana-7.6.2)架構(gòu)。這里建議三個組件主次版本保持一致??紤]到服務(wù)器比較多,所以寫成腳本來批量部署。

 最近平臺EFK版本均作了升級,平臺采用EFK(ElasticSearch-7.6.2 + FileBeat-7.6.2 + Kibana-7.6.2)架構(gòu)。這里建議三個組件主次版本保持一致??紤]到服務(wù)器比較多,所以寫成腳本來批量部署。

[[326087]]

腳本內(nèi)容大家看一下function就行了..

架構(gòu)

EFK采用集中式的日志管理架構(gòu)

  • elasticsearch:一個開源分布式搜索引擎,提供搜集、分析、存儲數(shù)據(jù)三大功能。它的特點有:分布式,零配置,自動發(fā)現(xiàn),索引自動分片,索引副本機制,restful風格接口,多數(shù)據(jù)源,自動搜索負載等。
  • kibana:可以為Logstash 、Beats和ElasticSearch提供友好的日志分析Web 界面,可以幫助匯總、分析和搜索重要數(shù)據(jù)日志。
  • filebeat:輕量級日志采集器。需要在每個應(yīng)用服務(wù)器配置filebeat,來采集日志,并輸出到elasticsearch

 

基于centos7系統(tǒng)一鍵部署EFK服務(wù),值得收藏

 

一鍵部署KIBANA腳本

  1. function install_es7_el7()  
  2.     echo "" 
  3.   echo -e "\033[33m****************************************************安裝ElasticSearch 7.6.2*****************************************************\033[0m"  
  4.   #action "********初始化JAVA環(huán)境********" /bin/true 
  5.   #install_jdk 
  6.  
  7.   #下載包 
  8.     if [ -f /opt/elasticsearch-7.6.2-x86_64.rpm ] && [ -f /opt/elasticsearch-analysis-ik-7.6.2.zip ] ;then 
  9.         echo "*****存在ElasticSearch 7.6.2安裝包,無需下載*****" 
  10.     else 
  11.       ping -c 4 artifacts.elastic.co >/dev/null 2>&1 
  12.       if [ $? -eq 0 ];then 
  13.         wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.6.2-x86_64.rpm -O /opt/elasticsearch-7.6.2-x86_64.rpm 
  14.         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    
  15.       else 
  16.         echo "please download ES7 package manual !" 
  17.         exit $? 
  18.       fi  
  19.   fi 
  20.  
  21.   #安裝es7.6  
  22.   action "********安裝ElasticSearch 7.6.2服務(wù)********" /bin/true 
  23.   chmod u+x /opt/elasticsearch-7.6.2-x86_64.rpm && rpm -ivh /opt/elasticsearch-7.6.2-x86_64.rpm 
  24.    
  25.   #建目錄及授權(quán) 
  26.   mkdir -p $ES_HOME/data &&  mkdir -p $ES_HOME/log 
  27.   chown -R elasticsearch:elasticsearch $ES_HOME && chmod -R 755 $ES_HOME 
  28.    
  29.   #修改ES配置文件 
  30.   cp /etc/elasticsearch/elasticsearch.yml /etc/elasticsearch/elasticsearch.yml_bak &>/dev/null  
  31. cat > /etc/elasticsearch/elasticsearch.yml << EOF  
  32. cluster.name: es-cluster 
  33. # 設(shè)定本機節(jié)點名  
  34. node.name: es_node 
  35. # 設(shè)定集群主節(jié)點清單 
  36. cluster.initial_master_nodes: ["es_node"]  
  37. path.data: ${ES_HOME}/data 
  38. path.logs: ${ES_HOME}/log 
  39. bootstrap.memory_lock: false 
  40. bootstrap.system_call_filter: false 
  41. # 允許從其它機器訪問 
  42. network.host: 0.0.0.0 
  43. http.port: ${ES_PORT} 
  44. discovery.zen.ping.unicast.hosts: ["${ES_IP}:${ES_PORT}"
  45. EOF 
  46.     
  47.   #安裝分詞器:ik-analyzer插件 
  48.   #默認情況下,ES使用內(nèi)置的標準分詞器,對文本進行解析。但是對于中文,其會拆解為一個一個的漢字,最終失去了分詞的意義,所以安裝分詞器:ik-analyzer插件 
  49.   action "********安裝ik-analyzer插件********" /bin/true 
  50.   mkdir -p /usr/share/elasticsearch/plugins/ik 
  51.   unzip /opt/elasticsearch-analysis-ik-7.6.2.zip -d /usr/share/elasticsearch/plugins/ik/ &>/dev/null  
  52.   chown -R elasticsearch:elasticsearch /usr/share/elasticsearch/plugins/ &&  chmod -R 755  /usr/share/elasticsearch/plugins/ 
  53.   sleep 2 
  54. #在filebeat配置文件中為索引模板添加默認分詞器屬性。未來新創(chuàng)建的索引均引用此屬性: 
  55. #setup.template.settings: 
  56. #  index.analysis.analyzer.default.type: "ik_max_word" 
  57. #  index.analysis.analyzer.default_search.type: "ik_max_word" 
  58. #setup.template.overwrite: true 
  59. #在Linux終端中執(zhí)行如下命令,為現(xiàn)有所有索引,設(shè)置默認分詞器屬性: 
  60. #curl -X POST "172.16.20.143:9200/_all/_close" 
  61. #curl -X PUT  -H'Content-Type: application/json' 'http://172.16.20.143:9200/_all/_settings?preserve_existing=true' -d '{ 
  62. #  "index.analysis.analyzer.default.type" : "ik_max_word"
  63. #  "index.analysis.analyzer.default_search.type" : "ik_max_word" 
  64. #}' 
  65. #curl -X POST "172.16.20.143:9200/_all/_open" 
  66.  
  67.  
  68.   #啟動ES并初始化數(shù)據(jù) 
  69.   action "********啟動es并初始化數(shù)據(jù)********" /bin/true 
  70.   systemctl daemon-reload && systemctl enable elasticsearch.service  
  71.   systemctl restart elasticsearch.service 
  72.   es_version=`curl -XGET ${ES_IP}:${ES_PORT}` 
  73.   echo -e "\033[33m**************************************************完成ElasticSearch 7.6.2安裝***************************************************\033[0m" 
  74. cat > /tmp/es7.log  << EOF 
  75. ES服務(wù)器IP: ${ES_IP} 
  76. ES服務(wù)器端口:${ES_PORT} 
  77. ES數(shù)據(jù)目錄: ${ES_HOME}/data 
  78. ES日志目錄: ${ES_HOME}/log 
  79. ES詳細信息: ${es_version} 
  80. EOF 
  81.   cat /tmp/es7.log 
  82.   echo -e "\e[1;31m 以上信息10秒后消失,保存在/tmp/es7.log文件下 \e[0m" 
  83.   echo -e "\033[33m************************************************************************************************************************\033[0m" 
  84.   echo "" 
  85.   sleep 10 

 

基于centos7系統(tǒng)一鍵部署EFK服務(wù),值得收藏

 

一鍵部署Elasticsearch腳本

  1. function install_es7_el7()  
  2.     echo "" 
  3.   echo -e "\033[33m****************************************************安裝ElasticSearch 7.6.2*****************************************************\033[0m"  
  4.   #action "********初始化JAVA環(huán)境********" /bin/true 
  5.   #install_jdk 
  6.  
  7.   #下載包 
  8.     if [ -f /opt/elasticsearch-7.6.2-x86_64.rpm ] && [ -f /opt/elasticsearch-analysis-ik-7.6.2.zip ] ;then 
  9.         echo "*****存在ElasticSearch 7.6.2安裝包,無需下載*****" 
  10.     else 
  11.       ping -c 4 artifacts.elastic.co >/dev/null 2>&1 
  12.       if [ $? -eq 0 ];then 
  13.         wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.6.2-x86_64.rpm -O /opt/elasticsearch-7.6.2-x86_64.rpm 
  14.         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    
  15.       else 
  16.         echo "please download ES7 package manual !" 
  17.         exit $? 
  18.       fi  
  19.   fi 
  20.  
  21.   #安裝es7.6  
  22.   action "********安裝ElasticSearch 7.6.2服務(wù)********" /bin/true 
  23.   chmod u+x /opt/elasticsearch-7.6.2-x86_64.rpm && rpm -ivh /opt/elasticsearch-7.6.2-x86_64.rpm 
  24.    
  25.   #建目錄及授權(quán) 
  26.   mkdir -p $ES_HOME/data &&  mkdir -p $ES_HOME/log 
  27.   chown -R elasticsearch:elasticsearch $ES_HOME && chmod -R 755 $ES_HOME 
  28.    
  29.   #修改ES配置文件 
  30.   cp /etc/elasticsearch/elasticsearch.yml /etc/elasticsearch/elasticsearch.yml_bak &>/dev/null  
  31. cat > /etc/elasticsearch/elasticsearch.yml << EOF  
  32. cluster.name: es-cluster 
  33. # 設(shè)定本機節(jié)點名  
  34. node.name: es_node 
  35. # 設(shè)定集群主節(jié)點清單 
  36. cluster.initial_master_nodes: ["es_node"]  
  37. path.data: ${ES_HOME}/data 
  38. path.logs: ${ES_HOME}/log 
  39. bootstrap.memory_lock: false 
  40. bootstrap.system_call_filter: false 
  41. # 允許從其它機器訪問 
  42. network.host: 0.0.0.0 
  43. http.port: ${ES_PORT} 
  44. discovery.zen.ping.unicast.hosts: ["${ES_IP}:${ES_PORT}"
  45. EOF 
  46.     
  47.   #安裝分詞器:ik-analyzer插件 
  48.   #默認情況下,ES使用內(nèi)置的標準分詞器,對文本進行解析。但是對于中文,其會拆解為一個一個的漢字,最終失去了分詞的意義,所以安裝分詞器:ik-analyzer插件 
  49.   action "********安裝ik-analyzer插件********" /bin/true 
  50.   mkdir -p /usr/share/elasticsearch/plugins/ik 
  51.   unzip /opt/elasticsearch-analysis-ik-7.6.2.zip -d /usr/share/elasticsearch/plugins/ik/ &>/dev/null  
  52.   chown -R elasticsearch:elasticsearch /usr/share/elasticsearch/plugins/ &&  chmod -R 755  /usr/share/elasticsearch/plugins/ 
  53.   sleep 2 
  54. #在filebeat配置文件中為索引模板添加默認分詞器屬性。未來新創(chuàng)建的索引均引用此屬性: 
  55. #setup.template.settings: 
  56. #  index.analysis.analyzer.default.type: "ik_max_word" 
  57. #  index.analysis.analyzer.default_search.type: "ik_max_word" 
  58. #setup.template.overwrite: true 
  59. #在Linux終端中執(zhí)行如下命令,為現(xiàn)有所有索引,設(shè)置默認分詞器屬性: 
  60. #curl -X POST "172.16.20.143:9200/_all/_close" 
  61. #curl -X PUT  -H'Content-Type: application/json' 'http://172.16.20.143:9200/_all/_settings?preserve_existing=true' -d '{ 
  62. #  "index.analysis.analyzer.default.type" : "ik_max_word"
  63. #  "index.analysis.analyzer.default_search.type" : "ik_max_word" 
  64. #}' 
  65. #curl -X POST "172.16.20.143:9200/_all/_open" 
  66.  
  67.  
  68.   #啟動ES并初始化數(shù)據(jù) 
  69.   action "********啟動es并初始化數(shù)據(jù)********" /bin/true 
  70.   systemctl daemon-reload && systemctl enable elasticsearch.service  
  71.   systemctl restart elasticsearch.service 
  72.   es_version=`curl -XGET ${ES_IP}:${ES_PORT}` 
  73.   echo -e "\033[33m**************************************************完成ElasticSearch 7.6.2安裝***************************************************\033[0m" 
  74. cat > /tmp/es7.log  << EOF 
  75. ES服務(wù)器IP: ${ES_IP} 
  76. ES服務(wù)器端口:${ES_PORT} 
  77. ES數(shù)據(jù)目錄: ${ES_HOME}/data 
  78. ES日志目錄: ${ES_HOME}/log 
  79. ES詳細信息: ${es_version} 
  80. EOF 
  81.   cat /tmp/es7.log 
  82.   echo -e "\e[1;31m 以上信息10秒后消失,保存在/tmp/es7.log文件下 \e[0m" 
  83.   echo -e "\033[33m************************************************************************************************************************\033[0m" 
  84.   echo "" 
  85.   sleep 10 

 

基于centos7系統(tǒng)一鍵部署EFK服務(wù),值得收藏

 

一鍵部署filebeat腳本

  1. function install_filebeat7_el7()  
  2.     echo "" 
  3.   echo -e "\033[33m****************************************************安裝Filebeat 7.6.2*****************************************************\033[0m"  
  4.  
  5.   #下載包 
  6.     if [ -f /opt/filebeat-7.6.2-x86_64.rpm ] ;then 
  7.         echo "*****存在Filebeat 7.6.2安裝包,無需下載*****" 
  8.     else 
  9.       ping -c 4 artifacts.elastic.co >/dev/null 2>&1 
  10.       if [ $? -eq 0 ];then 
  11.         wget https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.6.2-x86_64.rpm -O /opt/filebeat-7.6.2-x86_64.rpm 
  12.       else 
  13.         echo "please download Filebeat7.6 package manual !" 
  14.         exit $? 
  15.       fi  
  16.   fi 
  17.  
  18.   #安裝filebeat7.6  
  19.   action "********安裝filebeat 7.6.2服務(wù)********" /bin/true 
  20.   chmod u+x /opt/filebeat-7.6.2-x86_64.rpm && rpm -ivh /opt/filebeat-7.6.2-x86_64.rpm 
  21.    
  22.   #修改kibana配置文件 
  23.   cp /etc/filebeat/filebeat.yml /etc/filebeat/filebeat.yml_bak  
  24. cat > /etc/filebeat/filebeat.yml << EOF  
  25. filebeat.inputs: 
  26. - type: log 
  27.   enabled: true 
  28.   paths: 
  29.     - /lcp_logs/*.log 
  30. filebeat.config.modules: 
  31.   path: /etc/filebeat/modules.d/*.yml 
  32.   reload.enabled: false 
  33. setup.template.settings: 
  34.   #number_of_shards  是數(shù)據(jù)分片數(shù),默認為5,有時候設(shè)置為3 
  35.   index.number_of_shards: 3 
  36.   index.analysis.analyzer.default.type: "ik_max_word" 
  37.   index.analysis.analyzer.default_search.type: "ik_max_word" 
  38. setup.template.overwrite: true 
  39. setup.kibana: 
  40.   host: "${KIBANA_IP}:${KIBANA_PORT}" 
  41. output.elasticsearch: 
  42.   hosts: ["${ES_IP}:${ES_PORT}"
  43.   ilm.enabled: true 
  44.   ilm.rollover_alias: "fsl_uat.prod1" 
  45.   ilm.pattern: "{now/d}-000001" 
  46. processors: 
  47.   - add_host_metadata: ~ 
  48.   - add_cloud_metadata: ~ 
  49. EOF 
  50.  
  51.   #啟動filebeat并初始化數(shù)據(jù) 
  52.   action "********啟動filebeat并初始化數(shù)據(jù)********" /bin/true 
  53.   systemctl daemon-reload && systemctl enable filebeat.service  
  54.   systemctl restart filebeat.service 
  55.   #nohup ./filebeat -e -c filebeat.yml >/dev/null 2>&1 & 
  56.    
  57.   echo -e "\033[33m**************************************************完成Filebeat 7.6.2安裝***************************************************\033[0m" 
  58. cat > /tmp/filebeat7.log << EOF 
  59. filebeat版本:   7.6.2 
  60. filebeat路徑:    /usr/bin/filebeat 
  61. filebeat配置kibana: ${KIBANA_IP}:${KIBANA_PORT} 
  62. filebeat配置elasticsearch: ${ES_IP}:${ES_PORT} 
  63. EOF 
  64.   cat /tmp/filebeat7.log 
  65.   echo -e "\e[1;31m 以上信息10秒后消失,保存在/tmp/filebeat7.log文件下 \e[0m" 
  66.   echo -e "\033[33m************************************************************************************************************************\033[0m" 
  67.   echo "" 
  68.   sleep 10 

 

基于centos7系統(tǒng)一鍵部署EFK服務(wù),值得收藏

 

 

責任編輯:武曉燕 來源: 今日頭條
相關(guān)推薦

2019-12-02 08:58:09

SQL腳本語言MySQL

2022-05-23 07:48:10

zabbix監(jiān)控CentOS7

2019-06-27 10:17:40

Centos7Pinpoint監(jiān)控

2025-04-02 09:10:00

LinuxShell腳本

2011-09-15 19:05:49

windows 7一鍵關(guān)機

2019-09-03 09:22:08

數(shù)據(jù)庫Redis算法

2021-04-30 06:12:28

Windows10操作系統(tǒng)微軟

2021-04-30 23:52:41

Windows 10Windows微軟

2022-02-14 07:47:30

巡風CentOS7漏洞掃描

2014-04-01 15:31:14

2020-03-31 15:03:56

Spring Boot代碼Java

2023-06-15 10:00:00

Jenkins任務(wù)操作

2023-09-12 07:06:04

2024-04-08 13:59:03

大模型Replicate

2021-08-03 15:25:09

數(shù)據(jù)庫Sharding SpSQL

2021-12-02 07:50:29

分支服務(wù)git worktre

2023-09-14 20:55:52

NodeJSDocker

2015-02-09 15:25:52

換膚

2015-06-09 10:36:13

Cloud FoundAzurePaaS
點贊
收藏

51CTO技術(shù)棧公眾號