Storm消费kafka写入华为云Hbase
来源:互联网 发布:国家网络安全法 编辑:程序博客网 时间:2024/05/21 11:02
最近遇到一个华为云Hbase的问题,在网上没有找到解决的方法,所以在这记录一下。
问题描述:
storm消费kafka数据写入Hbase。storm与kafka都是自己安装的,Hbase是华为云的。
如果按照正常的storm消费kafka然后直接存入hbase会出现zookeeper链接问题,因为这边用了两个zookeeper。
主要是在里面加上了init();和login();这两个方法
public static void init(){ Configuration conf = new Configuration(); String path =AttributeCommon.hbase_path; String conFilesPath =path + "conf" + File.separator; conf.addResource(new Path(conFilesPath + "core-site.xml")); conf.addResource(new Path(conFilesPath + "hdfs-site.xml")); conf.addResource(new Path(conFilesPath + "hbase-site.xml"));}public static void login(){ try { String path =AttributeCommon.hbase_path; String auth = path+ "auth" + File.separator; String userPrincipal = "dinfo"; String userKeytabPath = auth+"user.keytab"; String krb5ConfPath = auth+"krb5.conf"; String ZKServerPrincipal = "zookeeper/hadoop.hadoop.com"; String ZOOKEEPER_DEFAULT_LOGIN_CONTEXT_NAME = "Client"; String ZOOKEEPER_SERVER_PRINCIPAL_KEY = "zookeeper.server.principal"; Configuration hadoopConf = new Configuration(); LoginUtil.setJaasConf(ZOOKEEPER_DEFAULT_LOGIN_CONTEXT_NAME, userPrincipal, userKeytabPath); LoginUtil.setZookeeperServerPrincipal(ZOOKEEPER_SERVER_PRINCIPAL_KEY, ZKServerPrincipal); LoginUtil.login(userPrincipal, userKeytabPath, krb5ConfPath, hadoopConf); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } }
LoginUtil这个类在华为云的hbase的demo程序里有。
阅读全文
1 0
- Storm消费kafka写入华为云Hbase
- Spring boot 消费kafka 写入hbase
- storm消费kafka数据
- STORM整合kafka消费数据
- storm实时消费kafka数据
- Storm Kafka + Storm + HBase实例
- kafka+storm+hbase
- kafka+storm+hbase
- storm-kafka(storm spout作为kafka的消费端)
- storm消费kafka实现实时计算
- 使用storm trident消费kafka消息
- kafka+storm+hbase架构设计
- kafka+storm+hbase架构设计
- Storm-Kafka-Hbase 性能问题
- Storm、Kafka、Hbase 整合 java 例子
- kafka+storm+hbase整合试验(Wordcount)
- storm+kafka+hbase+mysql jar包
- kafka+storm+Hbase流式数据处理
- 登录失败次数限制(原生php代码实现)
- input radio按钮点击选择,点击另外一个,前一个不被选择
- 网络管理(十二)
- golang 常量的iota使用
- ASP.NET Core Razor页面 vs MVC
- Storm消费kafka写入华为云Hbase
- #ifdef __cplusplus的初步解释
- 大数据集群JVM调优&内存管理
- 树状数组的区间修改和区间查询模板
- 剑指offer_链表---从尾到头打印链表
- 让sublime text像IDE一样格式化任何类型代码,不是jsFormat
- hadoop distcp使用
- 天平
- spring 注解 AOP