💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
软件存放目录 ``` [root@kafka73 elk6]# tree -L 2 /opt/ /opt/ ├── elk6 │   ├── all_conf │   ├── elasticsearch -> elasticsearch-6.1.2/ │   ├── elasticsearch-6.1.2 │   ├── elasticsearch-head │   ├── elk6_host.txt │   ├── elk6_install.sh │   ├── filebeat -> filebeat-6.1.2-linux-x86_64/ │   ├── filebeat-6.1.2-linux-x86_64 │   ├── kibana -> kibana-6.1.2-linux-x86_64 │   ├── kibana-6.1.2-linux-x86_64 │   ├── logstash -> logstash-6.1.2/ │   ├── logstash-6.1.2 │   └── soft ├── jdk -> /opt/jdk1.8.0_151/ └── jdk1.8.0_151 ├── bin ├── COPYRIGHT ├── db ├── include ├── javafx-src.zip ├── jre ├── lib ├── LICENSE ├── man ├── README.html ├── release ├── src.zip ├── THIRDPARTYLICENSEREADME-JAVAFX.txt └── THIRDPARTYLICENSEREADME.txt 20 directories, 10 files ``` 安装时候的配置文件目录 ``` [root@kafka73 ~]# tree /opt/elk6/all_conf/ /opt/elk6/all_conf/ ├── elasticsearch │   ├── elasticsearch │   ├── elasticsearch.service │   └── elasticsearch.yml ├── filebeat ├── kibana └── logstash 4 directories, 3 files ``` 安装包目录 ``` [root@kafka73 ~]# tree /opt/elk6/soft/ /opt/elk6/soft/ ├── elasticsearch-6.1.2.tar.gz ├── filebeat-6.1.2-linux-x86_64.tar.gz ├── jdk-8u151-linux-x64.tar.gz ├── kibana-6.1.2-linux-x86_64.tar.gz └── logstash-6.1.2.tar.gz 0 directories, 5 files ``` 主机hosts定义 ``` [root@kafka73 elk6]# cat elk6_host.txt 192.168.47.70 node1 192.168.47.71 node2 192.168.47.72 node3 192.168.47.73 node4 ``` 安装脚本 [root@kafka73 elk6]# cat elk6_install.sh ``` #!/bin/bash #Author:Alaska #Blog:null #Time:2018-03-15 17:51:12 #Name:elk6_install.sh #Version:V1.0 #Description:This is a test script. #拷贝后的配置文件位置 es_username='elasticsearch' es_path_dir=/opt/elk6 es_path_data=/data/elk6_data es_path_init=/etc/init.d/ es_path_systemd=/usr/lib/systemd/system/ es_path_yml=${es_path_dir}/elasticsearch/config/elasticsearch.yml es_path_head=${es_path_dir}/elasticsearch-head es_path_hosts=${es_path_dir}/elk6_host.txt #安装目录里需要拷贝的配置文件 es_all_conf=${es_path_dir}/all_conf/elasticsearch es_all_init=${es_all_conf}/elasticsearch es_all_systemd=${es_all_conf}/elasticsearch.service es_all_yml=${es_all_conf}/elasticsearch.yml es_ip=$(ifconfig eth0|awk -F"[: ]+" 'NR==2{print $4}') #读取host里的主机列表并修改配置文件里的hostsname和ip unset list_ip unset ip_a unset ip_b list_ip=($(awk '{print $1}' ${es_path_hosts})) list_name=($(awk '{print $2}' ${es_path_hosts})) list_line=$(cat ${es_path_hosts}|wc -l) list_num=$((${list_line} -1 )) es_node_name=$(grep "${es_ip}" ${es_path_hosts}|awk '{print $2}') es9_list(){ for num in $(seq 0 ${list_num}) do ip_a=$(echo \"${list_ip[${num}]}\",) ip_b=$(echo ${ip_b}${ip_a}) done ip_c=$(echo ${ip_b}|sed -r 's#.$##g') ip_d=$(sed -ri "/unicast/s#(^.*\[).*(\]$)#\1${ip_c[*]}\2#g" ${es_path_yml} ) echo ${ip_c} echo ${ip_d} } es0_java(){ echo java cd ${es_path_dir}/soft && tar zxf jdk-8u151-linux-x64.tar.gz -C /opt/ ln -s /opt/jdk1.8.0_151/ /opt/jdk sed -i.bak '$a export JAVA_HOME=/opt/jdk\nexport PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH\nexport . /etc/profile java -version } es1_mkdir(){ mkdir -p ${es_path_data} mkdir -p ${es_path_systemd} } es2_useradd(){ useradd ${es_username} } es3_elasticsearch(){ cp -a ${es_all_init} ${es_path_init} cp -a ${es_all_systemd} ${es_path_systemd} } es4_sed(){ sed -i "/network.host/s#192.168.47.70#${es_ip}#g" ${es_path_yml} } es5_chown(){ chown -R ${es_username}:${es_username} ${es_path_dir} chown -R ${es_username}:${es_username} ${es_path_data} chmod +x ${es_path_init} } es6_sysctl(){ echo "vm.max_map_count = 262144" >> /etc/sysctl.conf sysctl -p } es7_start(){ systemctl start elasticsearch systemctl status elasticsearch } es8_head(){ curl -sL https://deb.nodesource.com/setup_9.x |bash - apt-get install -y nodejs cd ${es_path_head} && npm run start & } main(){ es0_java es1_mkdir es2_useradd es3_elasticsearch es4_sed es5_chown es6_sysctl es7_start es8_head es9_list } main ``` 针对脚本里./etc/profile不生效可以使用 source elk.sh 来使其生效,当然还有很对不理解的地方