<强> 强>
<强> 强>
Logstash: Logstash服务器端用来搜集日志;
Elasticsearch:存储各类日志;
<强> 强>
<强> 强>
自定义shell脚本名称vim Autoinstall_ELK_V1.3.sh 复制粘贴一下内容执行。
# !/bin/bash #邮箱:lishilong@co-mall.com #数据:2019/1/9 # AutoInstall ELK 脚本 #软件:elasticsearch-5.4.1/logstash-5.4.1 filebeat-5.4.1/kibana-5.4.1 清晰的 echo “# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #”; echo “#,,,,,,,,,,,, Auto Install 麋鹿只,,,,,,,,,,,,,,,,# #“,,,, echo “#,,,,,,,,,,,, Press Ctrl + C 用cancel ,,,,,,,,,,,,,,,,, # #“,,,, echo “#,,,,,,,,,,,, Any key 用continue ,,,,,,,,,,,,,, # #,,,, echo “#, Softwae: elasticsearch-5.4.1/logstash-5.4.1 filebeat-5.4.1/kibana-5.4.1 , # #“; echo “# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #”; read -n 1 software_dir=?usr/地方/software" elasticsearch_url=癶ttps://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.4.1.tar.gz" kibana_url=癶ttps://artifacts.elastic.co/downloads/kibana/kibana-5.4.1-linux-x86_64.tar.gz" logstash_url=癶ttps://artifacts.elastic.co/downloads/logstash/logstash-5.4.1.tar.gz" filebeat_url=癶ttps://artifacts.elastic.co/downloads/beats/filebeat/filebeat-5.4.1-linux-x86_64.tar.gz" sys_version=' cat /etc/redhat-release | awk & # 39; {print 4美元}& # 39;| cut - d只f1的 IP=' ip addr | grep “inet “| grep -v 127.0.0.1 | awk & # 39; {print $ 2} & # 39; | cut - d/, f1的 jvm_conf=?usr/地方/elasticsearch/config/jvm.options" sys_mem=' free - m | grep Mem: | awk & # 39; {print $ 2} & # 39; | awk & # 39;{总和+=$ 1},最终获得{print 金额/1024}& # 39;| cut - d只f1的 # wget 软件 wget_fun (), { if [!大敌;-d $ {software_dir},); ,,,mkdir -p $ {software_dir},,,, cd $ {software_dir} 其他的 ,,,cd $ {software_dir} fi for software  elasticsearch_url 美元;拷贝kibana_url 美元;logstash_url filebeat_url美元 做 ,,wget -c $软件 完成 清晰的 } # initial 系统:install java  wget; set 主机名;disable firewalld init_sys (), { [,-f /etc/摆在functions ),,,,只/etc/摆在/功能 (,“$ {sys_version},, !=,“7”,),,,, echo “错误:却;能够Scripts Support Centos7.xx",,, exit 1 (,(id - u)美元!=,“0“,),,,,echo “错误:,你must be root 用run 却;能够script",,, exit 1 sed 我;“s/SELINUX=执行/SELINUX=禁用/?/etc/SELINUX/config setenforce 0 yum install  -y java-1.8.0-openjdk  wget hostnamectl set-hostname  elk-server ,,,,,,,,, systemctl stop  firewalld ,cat 的在在/etc/安全/limits.conf<& lt; EOF *,soft nofile 65536, *,hard nofile 65536, *,soft nGproc 65536, *,hard nproc 65536年 EOF } # install elasticsearch install_elasticsearch (), { cd software_dir美元 tar zxf  elasticsearch-5.4.1.tar.gz mv elasticsearch-5.4.1 /usr/地方/elasticsearch mkdir -p /usr/地方/elasticsearch/data /usr/地方/elasticsearch/日志 useradd elasticsearch chown -R  elasticsearch: elasticsearch /usr/地方/elasticsearch echo “vm.max_map_count =, 655360“,在在/etc/sysctl.conf ,, sysctl - p if [, $ {sys_mem}, -eq 0,); ,,,sed 我;“年代#“grep “^ -Xmx", $ {jvm_conf} ' #“-Xmx512m" # g", $ {jvm_conf} ,,,sed 我;“年代#“grep “^ -Xms", $ {jvm_conf} ' #“-Xms512m" # g", $ {jvm_conf} 其他的 null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null null麋鹿自动部署脚本