docker-compose部署ELK(亲测)
具体的配置可以参考上面一篇:docker部署ELK
以下是做了一些修改的地方:
kibana.yml
[ config]# cat kibana.yml server.host: "0.0.0.0" elasticsearch.url: http://elasticsearch01:9200 xpack: apm.ui.enabled: false graph.enabled: false ml.enabled: false monitoring.enabled: false reporting.enabled: false security.enabled: false grokdebugger.enabled: false searchprofiler.enabled: false [root@topcheer config]#
logstash的conf
[ pipeline]# cat logstash-test.conf input { file { path => ["/usr/share/logstash/pipeline/logs/test.log"] start_position => "beginning" } } output { elasticsearch { hosts => ["elasticsearch01:9200"] } } [root@topcheer pipeline]#
别的配置都没有变,然后新增docker-compose.yml
[ config]# cat docker-compose.yml version: ‘2‘ services: elasticsearch01: #服务名称(不是容器名,名称最好不要含有特殊字符,碰到过用下划线时运行出错) image: docker.elastic.co/elasticsearch/elasticsearch:6.4.3 container_name: elasticsearch01 #容器名称 volumes: #挂载文件 - ./elasticsearch/logs/:/usr/share/logs/ - /elk/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml:ro ports: - "9200:9200" #暴露的端口信息和docker run -d -p 80:80一样 - "9300:9300" environment: #设置镜像变量,它可以保存变量到镜像里面 ES_JAVA_OPTS: "-Xmx512m -Xms512m" networks: #加入指定网络 - elk logstash_test: image: docker.elastic.co/logstash/logstash:6.4.3 container_name: logstash01 volumes: - /elk/config/logstash/config/:/usr/share/logstash/config/:ro - /elk/config/logstash/pipeline/:/usr/share/logstash/pipeline/ ports: - "5044:5044" - "9600:9600" environment: LS_JAVA_OPTS: "-Xmx512m -Xms512m" networks: - elk depends_on: #标签解决了容器的依赖、启动先后的问题 - elasticsearch01 kibana_test: image: docker.elastic.co/kibana/kibana:6.4.3 container_name: kibana01 volumes: - /elk/config/kibana.yml:/usr/share/kibana/config/kibana.yml ports: - "5601:5601" networks: - elk depends_on: - elasticsearch01 networks: elk: driver: bridge [root@topcheer config]#
然后执行docker-compose up -d
[ config]# docker-compose ps Name Command State Ports --------------------------------------------------------------------------------------------------------- elasticsearch01 /usr/local/bin/docker-entr ... Up 0.0.0.0:9200->9200/tcp, 0.0.0.0:9300->9300/tcp kibana01 /usr/local/bin/kibana-docker Up 0.0.0.0:5601->5601/tcp logstash01 /usr/local/bin/docker-entr ... Up 0.0.0.0:5044->5044/tcp, 0.0.0.0:9600->9600/tcp [root@topcheer config]#
发现都很快的起起来了,docker的kibana真的很慢,但是更推荐k8s去部署,后面再写。
相关推荐
技术与更多 2020-04-15
链块学院 2020-11-06
afanti 2020-09-14
白开水 2020-07-19
liyansring 2020-07-18
shenzhenzsw 2020-07-18
啦啦啦啦啦 2020-06-28
yangliuhbhd 2020-06-12
小爷有点狂 2020-06-12
无风的雨 2020-06-12
changecan 2020-06-11
蒜蓉粉丝蒸扇贝 2020-06-10
lihongtai 2020-06-08
liaochaowu 2020-06-06
zwt00 2020-06-05
scmrpu 2020-06-02
kuzilala 2020-05-14