环境
- 主机IP 192.168.0.9
- Docker version 19.03.2
- docker-compose version 1.24.0-rc1
- elasticsearch version 6.6.1
- kibana version 6.6.1
- logstash version 6.6.1
一、ELK-dockerfile文件编写及配置文件
● elasticsearch
1、elasticsearch-dockerfile
FROM centos:latest ADD elasticsearch-6.6.1.tar.gz /usr/local/ COPY elasticsearch.yml /usr/local/elasticsearch-6.6.1/config/ COPY jdk1.8 /usr/local/ ENV JAVA_HOME=/usr/local/jdk1.8 ENV CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib ENV PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH:$HOME/bin RUN groupadd elsearch && useradd elsearch -g elsearch -p elasticsearch && chown -R elsearch:elsearch /usr/local/elasticsearch-6.6.1 && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo "Asia/shanghai" > /etc/timezone && yum install which -y && mkdir /opt/data && mkdir /opt/logs EXPOSE 9200 9300 #主要是切换到elsearch用户启动es USER elsearch WORKDIR /usr/local/elasticsearch-6.6.1/bin/ ENTRYPOINT ["./elasticsearch"]
2、elasticsearch.yml
[root@localhost elasticsearch]# egrep "^[^#]" elasticsearch.yml cluster.name: es-cluster node.name: node-1 path.data: /opt/data path.logs: /opt/logs network.host: 0.0.0.0 http.port: 9200 cluster.routing.allocation.disk.threshold_enabled: true cluster.routing.allocation.disk.watermark.low: 94% cluster.routing.allocation.disk.watermark.high: 96% cluster.routing.allocation.disk.watermark.flood_stage: 98% discovery.zen.minimum_master_nodes: 1
● logstash
1、logstash-dockerfile
FROM centos:latest ADD logstash-6.6.1.tar.gz /usr/local/ COPY logstash.yml /usr/local/logstash-6.6.1/config/ COPY logstash.conf /usr/local/logstash-6.6.1/config/ COPY jdk1.8 /usr/local/ COPY start.sh /start.sh ENV JAVA_HOME=/usr/local/jdk1.8 ENV CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib ENV PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH:$HOME/bin RUN mkdir /opt/data && mkdir /opt/logs && chmod +x /start.sh ENTRYPOINT ["/start.sh"]
2、logstash-start.sh
#!/bin/bash /usr/local/logstash-6.6.1/bin/logstash -f /usr/local/logstash-6.6.1/config/logstash.conf
3、logstash.yml
[root@localhost logstash]# egrep "^[^#]" logstash.yml path.data: /opt/data path.logs: /opt/logs pipeline.batch.size: 200
4、logstash.conf
input { file { path => "/usr/local/nginx/logs/access.log" type => "nginx" start_position => "beginning" sincedb_path => "/dev/null" } file { path => "/var/log/secure" type => "secure" start_position => "beginning" sincedb_path => "/dev/null" } } #详细说明可以查看我之前的博客 filter { grok { match => { "message" => '("(" ("(" "("' } remove_field => ["message","log","beat","offset","prospector","host","@version"] } } #output指向es容器 output { if [type] == "nginx" { elasticsearch { hosts => ["es:9200"] index => "nginx-%{+YYYY.MM.dd}" } } else if [type] == "secure" { elasticsearch { hosts => ["es:9200"] index => "secure-%{+YYYY.MM.dd}" } } }
● kibana
1、kibana-dockerfile
FROM centos:latest ADD kibana-6.6.1-linux-x86_64.tar.gz /usr/local/ COPY kibana.yml /usr/local/kibana-6.6.1-linux-x86_64/config/ COPY start.sh /start.sh RUN chmod +x /start.sh EXPOSE 5601 ENTRYPOINT ["/start.sh"]
2、kibana.yml
[root@localhost kibana]# egrep "^[^#]" kibana.yml server.port: 5601 server.host: "0.0.0.0" #指向es容器的9200端口 elasticsearch.hosts: ["http://es:9200"]
3、kibana-start.sh
#!/bin/bash /usr/local/kibana-6.6.1-linux-x86_64/bin/kibana
二、docker-compose,yml文件编写
[root@localhost elk_dockerfile]# cat docker-compose.yml
version: '3.7' services: elasticsearch: image: elasticsearch:elk container_name: es networks: - elk volumes: - /opt/data:/opt/data - /opt/logs:/opt/logs expose: - 9200 - 9300 restart: always depends_on: - logstash - kibana logstash: image: logstash:elk container_name: logstash networks: - elk volumes: - /opt/logstash/data/:/op/data - /opt/logstash/logs/:/opt/logs - /opt/elk/elk_dockerfile/logstash/logstash.conf:/usr/local/logstash-6.6.1/config/logstash.conf - /usr/local/nginx/logs:/usr/local/nginx/logs - /var/log/secure:/var/log/secure restart: always kibana: image: kibana:elk container_name: kibana ports: - 5601:5601 networks: - elk volumes: - /opt/elk/elk_dockerfile/kibana/kibana.yml:/usr/local/kibana-6.6.1-linux-x86_64/config/kibana.yml networks: elk:
compose文件version版本指向
三、访问界面
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
暂无评论...
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。
更新日志
2024年11月23日
2024年11月23日
- 凤飞飞《我们的主题曲》飞跃制作[正版原抓WAV+CUE]
- 刘嘉亮《亮情歌2》[WAV+CUE][1G]
- 红馆40·谭咏麟《歌者恋歌浓情30年演唱会》3CD[低速原抓WAV+CUE][1.8G]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[320K/MP3][193.25MB]
- 【轻音乐】曼托凡尼乐团《精选辑》2CD.1998[FLAC+CUE整轨]
- 邝美云《心中有爱》1989年香港DMIJP版1MTO东芝首版[WAV+CUE]
- 群星《情叹-发烧女声DSD》天籁女声发烧碟[WAV+CUE]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[FLAC/分轨][748.03MB]
- 理想混蛋《Origin Sessions》[320K/MP3][37.47MB]
- 公馆青少年《我其实一点都不酷》[320K/MP3][78.78MB]
- 群星《情叹-发烧男声DSD》最值得珍藏的完美男声[WAV+CUE]
- 群星《国韵飘香·贵妃醉酒HQCD黑胶王》2CD[WAV]
- 卫兰《DAUGHTER》【低速原抓WAV+CUE】
- 公馆青少年《我其实一点都不酷》[FLAC/分轨][398.22MB]
- ZWEI《迟暮的花 (Explicit)》[320K/MP3][57.16MB]