创建docker-compose.yml
文件
version: '3'
services:
mysql-server:
image: mysql:5.7
container_name: mysql-server
restart: always
ports:
- 3306:3306
environment:
MYSQL_ROOT_PASSWORD: 123456
redis-server:
image: redis:latest
container_name: redis-server
command: redis-server --requirepass 123456
restart: always
ports:
- 6379:6379
rabbitmq-server:
image: rabbitmq:management
container_name: rabbitmq-server
restart: always
ports:
- 5672:5672
- 15672:15672
elasticsearch:
image: es-ik:6.6.2
container_name: elasticsearch
restart: always
environment:
- "cluster.name=elasticsearch"
- "discovery.type=single-node"
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ports:
- 9200:9200
- 9300:9300
kibana:
image: docker.elastic.co/kibana/kibana:6.6.2
container_name: kibana
environment:
- SERVER_NAME=kibana
- ELASTICSEARCH_URL=http://elasticsearch:9200
- XPACK_MONITORING_ENABLED=true
ports:
- 5601:5601
depends_on:
- elasticsearch
logstash:
image: logstash:6.6.2
container_name: logstash
volumes:
- ~/docker/mydata/logstash/logstash.conf:/usr/share/logstash/pipeline/logstash.conf
depends_on:
- elasticsearch
links:
- elasticsearch:es
ports:
- 4560:4560
启动容器:
docker-compose up -d
logstash.conf
input {
tcp {
mode => "server"
host => "0.0.0.0"
port => 4560
codec => json_lines
type => "business"
}
}
output {
elasticsearch {
hosts => ["es:9200"]
action => "index"
codec => json
index => "%{type}-%{+YYYY.MM.dd}"
template_name => "business"
}
}
说明!!! es-ik:6.6.2是自己创建的镜像,步骤: 创建带ik插件镜像