How to pass external configuration properties to storm topology?

How to pass external configuration properties to storm topology?

I want to pass some custom configuration properties to storm topology that are not part of storm yaml, how can I pass it.

https://community.hortonworks.com/questions/36969/how-to-pass-external-configuration-properties-to-s.html

https://stackoverflow.com/questions/18061332/storm-topology-configuration

------------------------------------------------------------------------------------------------------------------------------------------------------

you can use following ways to get the external configuration inside the topplogy

  

1:

pass the arguments like this

storm jar storm-jar topology-name -c sKey=sValue -c key1=value1 -c key2=value2 >/tmp/storm.txt

2:

Create a simple java resource file (properties files) and pass it as arguments to your topology main class, in main method read the properties from the main file

and build the storm configuration object using conf.put()

3:

create separate yaml file read it through the Utils method provided by storm api,look for more documentation https://nathanmarz.github.io/storm/doc/backtype/storm/utils/Utils.html

Utils.findAndReadConfigFile()

--------------------------

You can use

Config conf = new Config();

conf.put(key, val);

conf.put(key1, val1);

e.g redis config, etc.

and then you can use this in prepare method of bolts(in case of trident in functions/ filters, etc).

Hope this helps.

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值