服务热线
135-6963-3175
通过docker-compose搭建elk
1、首先安装docker-compose,参考 docker-comose安装
2、新建文件docker-compose.yml
version: '3' services: elasticsearch: image: elasticsearch: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 #6.7以前不支持中文 container_name: kibana environment: - SERVER_NAME=kibana - ELASTICSEARCH_URL=http://192.168.1.7:9200 #注意此处要为ip不能为localhost;127.0.0.1未测试 - XPACK_MONITORING_ENABLED=true ports: - 5601:5601 depends_on: - elasticsearch logstash: image: logstash:6.6.2 container_name: logstash volumes: - /Users/zzx/Documents/elk/logstash.conf depends_on: - elasticsearch links: - elasticsearch:es ports: - 4560:4560
文件logstash.conf:
input { #input自由发挥,可kafka filebeat等 tcp { mode => "server" host => "0.0.0.0" port => 4560 codec => json_lines type => "business" } } output { elasticsearch { hosts => ["localhost:9200"] action => "index" codec => json index => "%{type}-%{+YYYY.MM.dd}" template_name => "business" } }
最后执行命令:
docker-compose -f docker-compose.yml up -d
等待...执行命令:
$ docker ps
status up状态
访问kibana: http://127.0.0.1:5601/
安装过程中可能出现的问题:
若kibana不能访问,出现Kibana server is not ready yet异常:
可通过命令docker logs xxx例如:docker info kibana查看日志异常等
出现该No living connections异常,发现连接es异常,可能原因localhost再容器不能访问,把kibana的(LASTICSEARCH_URL=http://192.168.1.7:9200)
es地址localhost改为本地局域网ip(127.0.0.1未测试)。
然后重新启动
docker-compose -f docker-compose.yml down
docker-compose -f docker-compose.yml up -d
然后访问kibana: http://127.0.0.1:5601/ 即可
附官方兼容性列表:
"elastic.co/cn/support/matrix#matrix_compatibility"
注意:兼容性问题列表:
Elasticsearch | Kibana | X-Pack | Beats^* | Elastic Agent^* | Logstash^* | ES-Hadoop (jar) | APM Server | App Search | Enterprise Search | Endpoint Security |
5.0.x | 5.0.x | 5.0.x | 1.3.x-5.6.x | 2.4.x-5.6.x | 5.0.x-5.6.x | |||||
5.1.x | 5.1.x | 5.1.x | 1.3.x-5.6.x | 2.4.x-5.6.x | 5.0.x-5.6.x | |||||
5.2.x | 5.2.x | 5.2.x | 1.3.x-5.6.x | 2.4.x-5.6.x | 5.0.x-5.6.x | |||||
5.3.x | 5.3.x | 5.3.x | 1.3.x-5.6.x | 2.4.x-5.6.x | 5.0.x-5.6.x | |||||
5.4.x | 5.4.x | 5.4.x | 1.3.x-5.6.x | 2.4.x-5.6.x | 5.0.x-5.6.x | |||||
5.5.x | 5.5.x | 5.5.x | 1.3.x-5.6.x | 2.4.x-5.6.x | 5.0.x-5.6.x | |||||
5.6.x | 5.6.x | 5.6.x | 1.3.x-6.0.x | 2.4.x-6.0.x | 5.0.x-6.0.x | |||||
6.0.x | 6.0.x | 6.0.x | 5.6.x-6.8.x | 5.6.x-6.8.x | 6.0.x-6.8.x | |||||
6.1.x | 6.1.x | 6.1.x | 5.6.x-6.8.x | 5.6.x-6.8.x | 6.0.x-6.8.x | |||||
6.2.x | 6.2.x | 6.2.x | 5.6.x-6.8.x | 5.6.x-6.8.x | 6.0.x-6.8.x | 6.2.x-6.8.x | ||||
6.3.x | 6.3.x | N/A** | 5.6.x-6.8.x | 5.6.x-6.8.x | 6.0.x-6.8.x | 6.2.x-6.8.x | ||||
6.4.x | 6.4.x | N/A** | 5.6.x-6.8.x | 5.6.x-6.8.x | 6.0.x-6.8.x | 6.2.x-6.8.x | ||||
6.5.x | 6.5.x | N/A** | 5.6.x-6.8.x | 5.6.x-6.8.x | 6.0.x-6.8.x | 6.2.x-6.8.x | ||||
6.6.x | 6.6.x | N/A** | 5.6.x-6.8.x | 5.6.x-6.8.x | 6.0.x-6.8.x | 6.2.x-6.8.x | ||||
6.7.x | 6.7.x | N/A** | 5.6.x-6.8.x | 5.6.x-6.8.x | 6.0.x-6.8.x | 6.2.x-6.8.x | ||||
6.8.x | 6.8.x | N/A** | 5.6.x-6.8.x | 5.6.x-6.8.x | 6.0.x-6.8.x | 6.2.x-6.8.x | ||||
7.0.x | 7.0.x | N/A** | 6.8.x-7.15.x | 6.8.x-7.15.x | 7.0.x-7.15.x | 7.0.x-7.15.x*** | 3.14.x - 3.18.x | |||
7.1.x | 7.1.x | N/A** | 6.8.x-7.15.x | 6.8.x-7.15.x | 7.0.x-7.15.x | 7.0.x-7.15.x*** | 3.14.x - 3.18.x | |||
7.2.x | 7.2.x | N/A** | 6.8.x-7.15.x | 6.8.x-7.15.x | 7.0.x-7.15.x | 7.0.x-7.15.x*** | 7.2.x | 3.14.x - 3.18.x | ||
7.3.x | 7.3.x | N/A** | 6.8.x-7.15.x | 6.8.x-7.15.x | 7.0.x-7.15.x | 7.0.x-7.15.x*** | 7.3.x | 3.14.x - 3.18.x | ||
7.4.x | 7.4.x | N/A** | 6.8.x-7.15.x | 6.8.x-7.15.x | 7.0.x-7.15.x | 7.0.x-7.15.x*** | 7.4.x | 3.14.x - 3.18.x | ||
7.5.x | 7.5.x | N/A** | 6.8.x-7.15.x | 6.8.x-7.15.x | 7.0.x-7.15.x | 7.0.x-7.15.x*** | 7.5.x | 3.14.x - 3.18.x | ||
7.6.x | 7.6.x | N/A** | 6.8.x-7.15.x | 6.8.x-7.15.x | 7.0.x-7.15.x | 7.0.x-7.15.x*** | 7.6.x | 3.14.x - 3.18.x | ||
7.7.x | 7.7.x | N/A** | 6.8.x-7.15.x | 6.8.x-7.15.x | 7.0.x-7.15.x | 7.0.x-7.15.x*** | N/A**** | 7.7.x | 3.14.x - 3.18.x | |
7.8.x | 7.8.x | N/A** | 6.8.x-7.15.x | 7.8.x | 6.8.x-7.15.x | 7.0.x-7.15.x | 7.0.x-7.15.x*** | N/A**** | 7.8.x | 3.14.x - 3.18.x |
7.9.x | 7.9.x | N/A** | 6.8.x-7.15.x | 7.9.x | 6.8.x-7.15.x | 7.0.x-7.15.x | 7.0.x-7.15.x*** | N/A**** | 7.9.x | 3.14.x - 3.19.x |
7.10.x | 7.10.x | N/A** | 6.8.x-7.15.x | 7.10.x | 6.8.x-7.15.x | 7.0.x-7.15.x | 7.0.x-7.15.x*** | N/A**** | 7.10.x | 3.14.x - 3.20.x |
7.11.x | 7.11.x | N/A** | 6.8.x-7.15.x | 7.11.x | 6.8.x-7.15.x | 7.0.x-7.15.x | 7.0.x-7.15.x*** | N/A**** | 7.11.x | 3.14.x - 3.21.x |
7.12.x | 7.12.x | N/A** | 6.8.x-7.15.x | 7.12.x | 6.8.x-7.15.x | 7.0.x-7.15.x | 7.0.x-7.15.x*** | N/A**** | 7.12.x | 3.14.x - 3.22.x |
7.13.x | 7.13.x | N/A** | 6.8.x-7.15.x | 7.13.x | 6.8.x-7.15.x | 7.0.x-7.15.x | 7.0.x-7.15.x*** | N/A**** | 7.13.x | 3.14.x - 3.23.x |
7.14.x | 7.14.x | N/A** | 6.8.x-7.15.x | 7.14.x | 6.8.x-7.15.x | 7.0.x-7.15.x | 7.0.x-7.15.x*** | N/A**** | 7.14.x | 3.14.x - 3.24.x |
7.15.x | 7.15.x | N/A** | 6.8.x-7.15.x | 7.15.x | 6.8.x-7.15.x | 7.0.x-7.15.x | 7.0.x-7.15.x*** | N/A**** | 7.15.x | 3.14.x - 3.24.x |