主要应用于logstash采集mysql的(输入)数据输出到elasticsearch,并通过ik分词器以便于搜索
docker-compose.yml #我是在宿主机的/opt/elk目录下创建,docker-compose版本1.24.1
编辑以下内容:
version: '3.1'
services:
elasticsearch:
image: elasticsearch:6.8.12
container_name: elasticsearch
restart: always
environment:
- cluster.name=elasticsearch #集群名称为elasticsearch
- xpack.security.enabled=false
- "ES_JAVA_OPTS=-Xms512m -Xmx512m" #jvm内存分配为512MB
- "discovery.type=single-node" #单节点启动
- "TZ=Asia/Shanghai"
volumes:
- /opt/elasticsearch/data:/usr/share/elasticsearch/data
- /opt/elasticsearch/logs:/usr/share/elasticsearch/logs
- /opt/elasticsearch/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
ports:
- 9200:9200
- 9300:9300
kibana:
image: kibana:6.8.12
container_name: kibana
links:
- elasticsearch:es #配置elasticsearch域名为es
depends_on:
- elasticsearch
environment:
- "elasticsearch.hosts=http://es:9200" #因为上面配置了域名,所以这里可以简写为http: