Docker-Compose搭建Graylog分布式日志采集系统
以下是一个简化版的docker-compose.yml
文件示例,用于搭建Graylog的基本分布式环境:
version: '2'
services:
mongo:
image: mongo:4.2
volumes:
- mongo_data:/data/db
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.8.10
environment:
- http.host=0.0.0.0
- transport.host=localhost
- network.host=0.0.0.0
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
volumes:
- es_data:/usr/share/elasticsearch/data
graylog:
image: graylog/graylog:4.0
environment:
- GRAYLOG_PASSWORD_SECRET=somepasswordpepper
- GRAYLOG_ROOT_PASSWORD_SHA2=yourpasswordhash
- GRAYLOG_HTTP_EXTERNAL_URI=http://localhost:9000/
links:
- mongo:mongo
- elasticsearch
depends_on:
- mongo
- elasticsearch
ports:
- "9000:9000"
- "12201:12201"
- "12201:12201/udp"
volumes:
mongo_data:
es_data:
这个docker-compose.yml
文件定义了Graylog、MongoDB和Elasticsearch服务。它设置了必要的环境变量,并将数据卷挂载到容器中,以确保数据持久性。这个配置可以根据实际需求进行调整,比如修改版本号、服务配置或卷配置。
评论已关闭