seatunnel
seatunnel copied to clipboard
waterdrop的配置文件application.properties中的参数值可不可以动态引入
举例: input中,使用kafkaStream ,其中的topic参数定义为‘helloTopic’,然后再定义filter的时候,使用sql,其中的tableName参数,想直接引用topic的值,可以吗? 怎么做可以?
或者 sql { sql = "select username, address from user_info", table_name = "user_info" } 中的 select后面的字段是动态的,比如从另一个文件中读取的,或者在运行的过程中动态指定的。
Waterdrop 中如何在配置中指定变量,之后在运行时,动态指定变量的值?
Waterdrop 从v1.2.4开始,支持在配置中指定变量,此功能常用于做定时或非定时的离线处理时,替换时间、日期等变量,用法如下:
在配置中,配置变量名称,比如:
...
filter {
sql {
table_name = "user_view"
sql = "select * from user_view where city ='"${city}"' and dt = '"${date}"'"
}
}
...
这里只是以sql filter举例,实际上,配置文件中任意位置的key = value中的value,都可以使用变量替换功能。
详细配置示例,请见variable substitution
启动命令如下:
# local 模式
./bin/start-waterdrop.sh -c ./config/your_app.conf -e client -m local[2] -i city=shanghai -i date=20190319
# yarn client 模式
./bin/start-waterdrop.sh -c ./config/your_app.conf -e client -m yarn -i city=shanghai -i date=20190319
# yarn cluster 模式
./bin/start-waterdrop.sh -c ./config/your_app.conf -e cluster -m yarn -i city=shanghai -i date=20190319
# mesos, spark standalone 启动方式相同。
可以用参数 -i 或者 --variable 后面指定 key=value来指定变量的值,其中key 需要与配置中的变量名相同。