阿里云Flink链接阿里云Kafka的三种方式

1、实时写入Kafka可以参考阿里云官网链接,本次是记录解决使用Kafka另外两类接入点,默认为网络VPC
阿里云官网实操链接
在这里插入图片描述
2、SASL_SSL 配置记录
由于Flink默认没有提供公网访问的能力
1)想要打通首先需要通过这个方式打通网络
https://help.aliyun.com/zh/flink/support/faq-about-network-connectivity?spm=a2c4g.11174283.0.i2
2)在Kafka中新增用户
在这里插入图片描述
3)with中的配置

 connector' = 'kafka'
    ,'properties.bootstrap.servers' = 'ip:port'
    ,'topic' = 'topic'
    ,'format' = 'json'
    ,'properties.enable.idempotence' = 'false'
    ,'properties.security.protocol' = 'SASL_SSL'
    ,'properties.ssl.truststore.location' = '/flink/usrlib/mix.4096.client.truststore.jks'
    ,'properties.ssl.endpoint.identification.algorithm' = ''
    ,'properties.sasl.mechanism' = 'SCRAM-SHA-256'
    ,'properties.sasl.jaas.config' = 'org.apache.flink.kafka.shaded.org.apache.kafka.common.security.scram.ScramLoginModule required username="username" password="password";'

官网文档链接
看完官网文档会发现,我写的配置会少几行
如果是使用了Flink提供的JKS,默认没有密码
4)上传资源包
在这里插入图片描述
5)在代码中引入依赖,不然依然会报错找不到jks
在这里插入图片描述

3、SASL_PLAINTEXT 配置记录
1)去Kafka中新增用户
在这里插入图片描述
2) 代码中增加配置

,'properties.security.protocol' = 'SASL_PLAINTEXT'
    ,'properties.sasl.mechanism' = 'PLAIN'
    ,'properties.sasl.jaas.config' = 'org.apache.flink.kafka.shaded.org.apache.kafka.common.security.plain.PlainLoginModule required username="username" password="password";'
  • 13
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值