当前位置:网站首页>Flink passes in custom parameters or profiles
Flink passes in custom parameters or profiles
2022-06-12 08:53:00 【//Continuous margin_ documentary】
List of articles
One 、Flink Introduction to the dynamic parameter input method
Flink Provide ParameterTool class , Read parameters from different sources
1.fromArgs Method
2.fromPropertiesFile Method
3.fromSystemProperties Method
Two 、Flink Dynamic parameter practice
1.fromArgs Method
Read the parameters passed on the command line , Pay attention to the transmission of ginseng The format is key value ,key Must be - perhaps – start , Such as --key1 value1 --key2 value2 -key3 value3
eg: The format of parameter transfer is --type:“stock” --markType:“101” Space interval

- Dynamic parameter receiving code
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
// Get the parameters passed in
ParameterTool parameterTool = ParameterTool.fromArgs(args);
// Register to environment variables
env.getConfig().setGlobalJobParameters(parameterTool);
// Get the registered configuration
ExecutionConfig.GlobalJobParameters parameters = env.getConfig().getGlobalJobParameters();
Map<String, String> map = parameters.toMap();
String markType = map.get("markType");
// Failed to set task restart Maximum number of task failures allowed 3 Time
env.setRestartStrategy(RestartStrategies.failureRateRestart(3,
// The time when the task failed and the interval between starts
Time.of(2, TimeUnit.SECONDS),
// Allow task delay time 3s
Time.of(3, TimeUnit.SECONDS))
);
2.fromPropertiesFile Method
- The configuration file Flink-conf.yarml Compiling mode
#hbase Connection address
hbase_zookeeper_quorum: localhost
hbase_zookeeper_client_port: 2181
#kafka Connection address
kafka_source_quorum:
kafka_source_topic:
kafka_source_group:
Remember yml file The colon ":" And address Add a space in the middle !
- Dynamic parameter receiving code
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
ParameterTool parameterTool = ParameterTool.fromPropertiesFile(" Profile directory ");
// Register to environment variables
env.getConfig().setGlobalJobParameters(parameterTool);
// Get the registered configuration
ExecutionConfig.GlobalJobParameters parameters = env.getConfig().getGlobalJobParameters();
// Set static class calls
new FlinkConf(parameters);
public class FlinkConf {
// Static class
public static String HBASE_SERVER ;
public static String KAFKA_SERVER ;
public FlinkConf(ExecutionConfig.GlobalJobParameters parameters){
Map<String, String> map = parameters.toMap();
HBASE_SERVER = map.get("hbase_zookeeper_quorum");
KAFKA_SERVER = map.get("kafka_quorum");
}
}
边栏推荐
- [new planning]
- (node:22344) [DEP0123] DeprecationWarning: Setting the TLS ServerName to an IP address is not permit
- Analysis of 43 cases of MATLAB neural network: Chapter 8 prediction of GRNN Network - Freight Volume Prediction Based on generalized regression neural network
- Composition of box model
- Use NVM to dynamically adjust the nodejs version to solve the problem that the project cannot be run and packaged because the node version is too high or too low
- What is the difference between ERP production management and MES management system?
- Error: ER_ NOT_ SUPPORTED_ AUTH_ MODE: Client does not support authentication protocol requested ... ...
- Box model border
- 了结非对称密钥
- 第三章 寄存器 (内存访问)
猜你喜欢
![[advanced pointer I] character array & array pointer & pointer array](/img/ea/150b2162e4e1641eee7e852935d101.png)
[advanced pointer I] character array & array pointer & pointer array
![[new planning]](/img/8e/0e15e0f3ee08002eaceea1fe8948ec.jpg)
[new planning]
![[compilation principle] understand BNF](/img/64/9a0e7507606781336fdc44116ba423.jpg)
[compilation principle] understand BNF

【无标题】Task3 多路召回
![(node:22344) [DEP0123] DeprecationWarning: Setting the TLS ServerName to an IP address is not permit](/img/c1/d56ec09663857afa52f20848aeadac.png)
(node:22344) [DEP0123] DeprecationWarning: Setting the TLS ServerName to an IP address is not permit

第三章 寄存器 (内存访问)
![[essence] explain in detail the memory management mechanism in QT](/img/7d/0d83158c6b0574dd3b3547b47af67e.jpg)
[essence] explain in detail the memory management mechanism in QT

第八章-数据处理的两个基本问题

处理异常数据

域名映射到指定IP
随机推荐
Knowledge points of 2022 system integration project management engineer examination: project cost management
Webrtc series - mobile terminal hardware coding supports simulcast
Make a simple page with the websql database of HTML5:
【进阶指针一】字符数组&数组指针&指针数组
【sklearn学习】LightGBM
(p21-p24) unified data initialization method: List initialization, initializing objects of non aggregate type with initialization list, initializer_ Use of Lisy template class
Background fixing effect
When the uniapp page jumps with complex data parameters.
(P13) use of final keyword
[advanced pointer III] implement C language quick sorting function qsort & callback function
Loading circling effect during loading
Background position position NOUN
When converting tensor to ndarray in tensorflow, the run or Eval function is constantly called in the loop, and the code runs more and more slowly!
The difference between deep copy and shallow copy
动态创建表单并提交
[advanced pointer I] character array & array pointer & pointer array
利用nvm动态调整nodejs版本,解决因为node版本过高或过低导致项目无法运行和打包
第五章-[bx]和Loop指令
【数据存储】浮点型数据在内存中的存储
Redis installation test