Custom source/sink configurations not getting recognized

天大地大妈咪最大 提交于 2020-01-14 07:40:12

问题


I've written my custom metrics source/sink for my Spark streaming app and I am trying to initialize it from metrics.properties - but that doesn't work from executors. I don't have control on the machines in Spark cluster, so I can't copy properties file in $SPARK_HOME/conf/ in the cluster. I have it in the fat jar where my app lives, but by the time my fat jar is downloaded on worker nodes in cluster, executors are already started and their Metrics system is already initialized - thus not picking my file with custom source configuration in it.

Following this post, I've specified 'spark.files = metrics.properties' and 'spark.metrics.conf=metrics.properties' but by the time 'metrics.properties' is shipped to executors, their metric system is already initialized.

If I initialize my own metrics system, it's picking up my file but then I'm missing master/executor level metrics/properties (eg. executor.sink.mySink.propName=myProp - can't read 'propName' from 'mySink') since they are initialized by Spark's metric system.

Is there a (programmatic) way to have 'metrics.properties' shipped before executors initialize their metrics system?

Update1: I am trying this on stand-alone Spark 2.0.0 cluster

Update2: Thought of hacks on achieving this - before starting your 'actual' spark job, start a dummy job to copy metrics.properties on each worker. Then start your actual job with pre-known file location. Cons - if a worker dies and another worker takes it's place, it won't have this file in pre-known path. Solution alternative - when a new worker machine starts, it pulls metrics.properties from your git-repo too and places it in pre-known path. Although, it may work, it's terribly hacky and a preferred solution is for Spark to support it internally.


回答1:


see Spark metrics on wordcount example Basically I believe you need to add --files to send the metrics.properties to all workers




回答2:


SparkConf only load local system properties if they start with the prefix spark., do you have tray to load your properties adding spark?



来源:https://stackoverflow.com/questions/39340080/custom-source-sink-configurations-not-getting-recognized

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!