可以执行命令,也可以直接使用下载 压缩包
git clone https://github.com/foxiswho/docker-elk.git
cd docker-elk
官方DOCKER地址
https://www.docker.elastic.co/
使用说明,可以配合其他容器使用,也可以独立使用
在安装组件之前需要确保以下端口没有被占用:5601 (Kibana), 9200 (Elasticsearch), and 5044 (Logstash).
同时需要确保内核参数 vm_max_map_count 至少设置为262144:
sudo sysctl -w vm.max_map_count=262144
注意:词库 7.1.1 默认安装了,不需要安装了
https://github.com/medcl/elasticsearch-analysis-ik/releases
wget https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.1.1/elasticsearch-analysis-ik-7.1.1.zip
解压缩 到 elasticsearch/plugins目录中,并将文件名改为analysis-ik
配置 analysis-ik/config 目录下IKAnalyzer.cfg.xml文件
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
<comment>IK Analyzer 扩展配置</comment>
<!--用户可以在这里配置自己的扩展字典 -->
<entry key="ext_dict">main.dic;extra_main.dic;</entry>
<!--用户可以在这里配置自己的扩展停止词字典-->
<entry key="ext_stopwords"></entry>
<!--用户可以在这里配置远程扩展字典 -->
<!-- <entry key="remote_ext_dict">words_location</entry> -->
<!--用户可以在这里配置远程扩展停止词字典-->
<!-- <entry key="remote_ext_stopwords">words_location</entry> -->
</properties>
最后 修改配置文件 docker-xxxx.yml 选择你的配置文件,把如下一行 前面的#号删除
#- ./elasticsearch/plugins/analysis-ik:/usr/share/elasticsearch/plugins/analysis-ik
logstash/pipeline 目录下有默认案例,请自行设置。
真正执行的时候,请删除 案例,否则报错
#配置文件
/usr/share/elasticsearch/config/elasticsearch.yml
/usr/share/elasticsearch/config/synonyms.txt
#词库配置文件
/usr/share/elasticsearch/plugins/analysis-ik/config/IKAnalyzer.cfg.xml
#日志目录
/usr/share/elasticsearch/logs
#数据目录
/usr/share/elasticsearch/data
#配置文件
/usr/share/logstash/config/logstash.yml
#日志目录
/usr/share/logstash/logs
#多任务配置目录
/usr/share/logstash/pipeline
#配置文件
/usr/share/kibana/config/kibana.yml
建立数据存储目录,并目录设置 777 权限,否则启动不成功
chmod -R 777 ./elasticsearch/data
chmod -R 777 ./elasticsearch/logs
chmod -R 777 ./logstash/pipeline
chmod -R 777 ./logstash/logs
cd dc
./start.sh
例如:有个已经建立好的容器,他的网络是 other
docker-compose up -f docker-compose-cooperation.yml
例如:有个已经建立好的容器组 [ https://github.com/foxiswho/docker-compose-nginx-php-mysql ],
它网络是 swoole (查看所有网络命令:docker network ls),
docker-compose up -f docker-compose-cooperation-swoole.yml
说明:主要在配置文件docker-compose-cooperation-swoole.yml中 有以下参数
swoole:
external: true
docker network create my-lnmp
接 在创建容器时,直接加入网络my-lnmp (--net=my-lnmp --net-alias mariadb), 并设置该容器在网络内的别名是mariadb
docker run --name mariadb -p 3306:3306 --net=my-lnmp --net-alias mariadb -e MYSQL_ROOT_PASSWORD=root -d mariadb:10.3.5
对已经建立好的容器,加入到新的网络my-lnmp中
docker network connect my-lnmp mariadb
断开网络
docker network disconnect my-lnmp mariadb
那么请在 docker-compose.yml 文件中,按如下修改(去掉前面的#号)
# my-lnmp:
# aliases:
# - logstash
修改为:
my-lnmp:
aliases:
- logstash
example/test.sql
具体操作略
用户名:test
密码:test_password
具体操作略
README.md 同级目录 执行
$ docker-compose up -f docker-compose-my-lnmp.yml
根据拉取镜像的时间不同,创建的时间也不同。 如果 logstash 这个容器启动不成功,可以先执行下一步,然后再执行
docker start docker_elk_1
docker_elk_1 是你建立
logstash容器的名字
新 终端中,打开到本根目录执行
chmod -R +x logstash/sbin/*
logstash/sbin/goods_create.sh
http://localhost:9200/goods/_doc/_search
https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.45.tar.gz
或
https://cdn.mysql.com//Downloads/Connector-J/mysql-connector-java-5.1.45.tar.gz
下载并解压缩后,进入解压缩后目录把 mysql-connector-java-5.1.45-bin.jar 文件复制到logstash/pipeline目录下
如果 mysql 容器的网络是 默认的 bridge (docker network ls 可以查看所有网络,docker inspect xxxxx 可以查看xxxxx容器的配置信息),无法使用 docker-compose 的 networks 把指定的容器,直接加入xxxxx容器的网络网桥中链接起来,必须 extra_hostsip地址映射加入。
http://yukinami.github.io/2017/03/24/Docker-compose%E4%BD%BF%E7%94%A8%E9%BB%98%E8%AE%A4%E7%9A%84bridge%E7%BD%91%E7%BB%9C/
如果 mysql 容器的网络是 是自定义的网桥,那么可以通过 容器的 networks 配置后直接访问
原始容器来自 https://github.com/deviantony/docker-elk.git
Run the latest version of the Elastic stack with Docker and Docker Compose.
It will give you the ability to analyze any data set by using the searching/aggregation capabilities of Elasticsearch and the visualization power of Kibana.
Based on the official Docker images from Elastic:
Content type
Image
Digest
Size
472.7 MB
Last updated
over 5 years ago
docker pull foxiswho/elk:logstash-7.12.1