How to pass external configuration properties to storm topology?

本文介绍了如何将自定义配置属性传递给Storm拓扑的方法,包括通过命令行参数、使用Java资源文件及读取YAML文件等方式,并提供了具体实现步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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、付费专栏及课程。

余额充值