我正在使用 flink-1.4.0 docker,如下所示:
version: '3'
services:
jobmanager:
image: ${FLINK_DOCKER_IMAGE_NAME:-flink}
expose:
- "6123"
ports:
- "8081:8081"
command: jobmanager
volumes:
- /home/yeyunlong/work/flink/flink-jar:/var/log/mongodb
environment:
- JOB_MANAGER_RPC_ADDRESS=jobmanager
taskmanager:
image: ${FLINK_DOCKER_IMAGE_NAME:-flink}
expose:
- "6121"
- "6122"
depends_on:
- jobmanager
command: taskmanager
links:
- "jobmanager:jobmanager"
environment:
- JOB_MANAGER_RPC_ADDRESS=jobmanager
在 docker 中,dir/opt/flink/log 是空的,但是使用 docker logs $(containerId)
,我可以获取所有的日志信息。
我应该怎么做才能使登录/opt/flink/log
。谢谢!
我正在使用docker-flink镜像,它使用bin/flink-console.sh 来启动JM或TM。该脚本依赖于 conf/log4j-console.properties 中的设置。
我使用下面的docker-compose.yaml来设置我自己的Log4j属性文件版本。从docker-compose.yaml,我可以设置要使用的文件,并从Log4j的属性文件中控制输出。
version: "2.1"
services:
jobmanager:
image: flink
expose:
- "6123"
ports:
- "8081:8081"
command: jobmanager
volumes:
- /c/Users/XYZ/playground/flink/shared/log4j.properties:/opt/flink/conf/log4j-console.properties
environment:
- JOB_MANAGER_RPC_ADDRESS=jobmanager
- FLINK_ENV_JAVA_OPTS=-Dlog.file=/opt/flink/log/jobmanager.log
taskmanager:
image: flink
expose:
- "6121"
- "6122"
depends_on:
- jobmanager
command: taskmanager
links:
- jobmanager:jobmanager
volumes:
- /c/Users/XYZ/playground/flink/shared/log4j.properties:/opt/flink/conf/log4j-console.properties
environment:
- JOB_MANAGER_RPC_ADDRESS=jobmanager
- FLINK_ENV_JAVA_OPTS=-Dlog.file=/opt/flink/log/taskmanager.log