原创转载请注明出处:https://www.cnblogs.com/agilestyle/p/15071269.html
MySQL Configuration
拉取 image
docker pull mysql:5.7.35
创建 container
docker run --name mysql5 -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.7.35
查看容器是否开启 binlog
docker exec -it mysql5 bash mysql -uroot -p123456 show variables like '%log_bin%';
退出 bash 后,开启 binlog
docker exec mysql5 bash -c "echo 'log-bin=/var/lib/mysql/mysql-bin' >> /etc/mysql/mysql.conf.d/mysqld.cnf" docker exec mysql5 bash -c "echo 'binlog-format=ROW' >> /etc/mysql/mysql.conf.d/mysqld.cnf" docker exec mysql5 bash -c "echo 'server-id=1' >> /etc/mysql/mysql.conf.d/mysqld.cnf" docker restart mysql5
重启后,再次执行
show variables like '%log_bin%';
也可以登录宿主机查看
cd /var/lib/mysql ls -lrth
在数据库中创建一个数据库、表,插入一些数据,查看 binlog
show binlog events in 'mysql-bin.000001';
ElasticSearch Configuration
拉取 image
docker pull elasticsearch:7.13.4
创建自定义网络
docker network create esnetwork
创建 container
docker run --name elasticsearch --net esnetwork -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" -d elasticsearch:7.13.4
查看是否启动成功
curl http://localhost:9200/
Kibana Configuration
拉取 image
docker pull kibana:7.13.4
创建自定义网络
docker network create esnetwork
Note:由于安装 ES 的时候已经创建过,这步可以省略
创建 container
docker run --name kibana --net esnetwork -p 5601:5601 -d kibana:7.13.4
查看是否启动成功,浏览器打开 http://localhost:5601/
Reference
https://hub.docker.com/_/mysql
https://hub.docker.com/_/elasticsearch
https://hub.docker.com/_/kibana
欢迎点赞关注和收藏