Apache Flink Dynamically setting JVM_OPT env.java.opts

Viewed 4249

Is it possible to set the custom JVM Options env.java.opts when submitting a job without specifying it in the conf/flink-conf.yaml file?

The reason I am asking is I want to use some custom variables in my log4j. I am also running my job on YARN.

I have tried the following command using the CLI and it strips everything off from the = sign onwards

$ flink run -m yarn-cluster -yn 2 -yst -yD env.java.opts="-DappName=myapp -DcId=mycId"

enter image description here

2 Answers

A simple solution which I tried was passing the configuration parameters in application.properties as arguments like below,

~/flink/bin/flink run app.jar --Brokers=Broker1:9093 --TopicName=some-topic

Also you can also pass in the parameters as a properties file,

~/flink/bin/flink run app.jar -Dspring.config.name=<full-path>/application.properties
Related