我已经在flink-conf.yaml中添加了以下行:
env.java.opts: "-Ddy.props.path=/PATH/TO/PROPS/FILE"
当启动jobmanager(jobmanager.sh start cluster)时,我可以在日志中看到jvm选项确实被识别了。
env.java.opts: "-Ddy.props.path=/PATH/TO/PROPS/FILE"
当启动jobmanager(jobmanager.sh start cluster)时,我可以在日志中看到jvm选项确实被识别了。
2017-02-20 12:19:23,536 INFO org.apache.flink.runtime.jobmanager.JobManager - JVM Options:
2017-02-20 12:19:23,536 INFO org.apache.flink.runtime.jobmanager.JobManager - -Xms256m
2017-02-20 12:19:23,536 INFO org.apache.flink.runtime.jobmanager.JobManager - -Xmx256m
2017-02-20 12:19:23,536 INFO org.apache.flink.runtime.jobmanager.JobManager - -XX:MaxPermSize=256m
2017-02-20 12:19:23,536 INFO org.apache.flink.runtime.jobmanager.JobManager - -Ddy.props.path=/srv/dy/stream-aggregators/aggregators.conf
2017-02-20 12:19:23,536 INFO org.apache.flink.runtime.jobmanager.JobManager - -Dlog.file=/srv/flink-1.2.0/log/flink-flink-jobmanager-0-flinkvm-master.log
2017-02-20 12:19:23,536 INFO org.apache.flink.runtime.jobmanager.JobManager - -Dlog4j.configuration=file:/srv/flink-1.2.0/conf/log4j.properties
2017-02-20 12:19:23,536 INFO org.apache.flink.runtime.jobmanager.JobManager - -Dlogback.configurationFile=file:/srv/flink-1.2.0/conf/logback.xml
但是,当我运行flink作业(flink run -d PROG.JAR)时,System.getProperty("dy.props.path")返回null(并且在打印系统属性时,我看到它确实不存在。)
问题实际上是 - 我该如何设置系统属性,以便在flink作业的代码中可用?