win:https://docker_practice.gitee.io/install/windows.html
Mac:https://docker_practice.gitee.io/install/mac.html
Centos:https://docker_practice.gitee.io/install/centos.html
win和mac的安装包里已经包含了docker-compose,无需单独安装,Linux环境需进行安装,详情参考:
https://docs.docker.com/compose/install/
1、percona(mysql)数据库
官方使用帮助:https://hub.docker.com/_/percona/
2、grafana
官方使用帮助:http://docs.grafana.org/installation/docker/
3、rocketmq
官方使用帮助:https://github.com/apache/rocketmq-externals/tree/master/rocketmq-docker
4、flink
官方使用帮助:https://hub.docker.com/_/flink
5、canal
官方使用帮助:https://github.com/alibaba/canal/wiki
已经配置好的docker-compose及必备配置文件已打包在此:打包的附件
只要docker-compose.yml内容的话在此
version: '2'
services:
grafana:
container_name: grafana
image: grafana/grafana
ports:
- 3000:3000
user: "472"
depends_on:
- target-mysql
jobmanager:
image: flink:1.7
container_name: flink_jobmanager
expose:
- "6123"
ports:
- "8081:8081"
command: jobmanager
environment:
- JOB_MANAGER_RPC_ADDRESS=jobmanager
depends_on:
- broker
taskmanager:
image: flink:1.7
container_name: flink_taskmanager
expose:
- "6121"
- "6122"
depends_on:
- jobmanager
command: taskmanager
environment:
- JOB_MANAGER_RPC_ADDRESS=jobmanager
depends_on:
- jobmanager
rmq-console:
image: styletang/rocketmq-console-ng
container_name: rmqconsole
ports:
- 8088:8080
environment:
JAVA_OPTS: -Drocketmq.config.namesrvAddr=namesrv:9876
volumes:
- ./rocketmq/console/logs:/root/logs
- ./rocketmq/console/store:/root/store
depends_on:
- namesrv
namesrv:
image: rocketmqinc/rocketmq:4.3.2
container_name: rmqnamesrv
ports:
- 9876:9876
volumes:
- ./rocketmq/namesrv/logs:/root/logs
- ./rocketmq/namesrv/store:/root/store
command: sh mqnamesrv
depends_on:
- canal-server
broker:
image: rocketmqinc/rocketmq:4.3.2
container_name: rmqbroker
ports:
- 10909:10909
- 10911:10911
volumes:
- ./rocketmq/broker/logs:/root/logs
- ./rocketmq/broker/store:/root/store
- ./rocketmq/broker/broker.conf:/opt/rocketmq-4.3.2/conf/broker.conf
command: sh mqbroker -n namesrv:9876 -c /opt/rocketmq-4.3.2/conf/broker.conf
depends_on:
- namesrv
canal-server:
image: canal/canal-server:v1.1.2
container_name: canal-server
ports:
- 11111:11111
depends_on:
- mysql
environment:
- canal.instance.master.address=mysql:3306
- canal.instance.dbUsername=canal
- canal.instance.dbPassword=canal
- canal.mq.topic=test
- canal.instance.filter.regex=artemis.out_order,artemis.out_order_details,artemis.out_order_cancel,wms.t_base_customer,wms.t_pick_order,wms.t_pick_order_detail,wms.t_pick_order_detail_sub,wms.t_pick_wave_detail,wms.t_pick_list,wms.t_pick_task,wms.t_workstation_user_detail,wms.t_workstation
volumes:
- ./canal-server/canal.properties:/home/admin/canal-server/conf/canal.properties
- ./canal-server/logs:/home/admin/canal-server/logs
mysql:
image: mysql:5.7
container_name: mysql
environment:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
volumes:
- ./mysql/data:/var/lib/mysql
- ./mysql/conf:/etc/mysql/conf.d
- ./mysql/logs:/logs/
target-mysql:
image: mysql:5.7
container_name: target-mysql
environment:
MYSQL_ROOT_PASSWORD: root
ports:
- 3307:3306
volumes:
- ./target-mysql/mysql:/var/lib/mysql
- ./target-mysql/logs:/logs/
1.使用说明:
2.各参数及配置项说明
1.docker-compose模板文件说明,详细可查询https://docker_practice.gitee.io/compose/compose_file.html ,下列为我们使用到的一些关键字
2.canal.properties配置文件主要是处理2点问题
参数canal.serverMode需指定为RocketMQ模式
参数canal.mq.servers需配置对应的rocketmq的namesrv的地址和端口
其余前缀为canal.mq的参数说明可参见https://github.com/alibaba/canal/wiki/Canal-Kafka-RocketMQ-QuickStart
3.my.cnf配置文件主要是申明mysql数据库为行模式,并且开启了binlog
4.broker.conf配置文件为mq的borker配置,主要是修改brokerIP1为宿主机的ip。以提供给外部访问
1.在附件解压的目录运行命令docker-compose up -d 启动,如最终出现下面画面,则容器创建成功
2.容器创建成功后,我们需要检查各个容器是否启动成功
数据库:按照配置项提供的端口号和默认密码,进行连接测试
mq:访问控制台http://localhost:8088/#/进行检查
fink:访问控制台http://localhost:8081/#/overview进行检查
grafana:访问页面http://localhost:3000/login进行检查
直接在 IDEA 中运行 main, 任务并没有提交到 本机 flink jobmanager 上
docker cp D:\workspace\odsetl\rocketmq-flink\target\rocketmq-flink-0.0.3-SNAPSHOT.jar 3595de91751
4:/opt/flink/
docker exec -it 3595de917514 flink run -c org.apache.rocketmq.flink.demo.OdsETLJob rocketmq-flink-
0.0.3-SNAPSHOT.jar
其中 3595de917514 表示 flink_jobmanager 的 containerId
win10 docker-compose 出错:ERROR: for mysql Cannot create container for service mysql: b'Drive has not been shared'
解决方法: Docker->Settings->Shared-Drives 勾选一个盘