内容简介:版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/kongxx/article/details/86531083
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/kongxx/article/details/86531083
接前面的文章 “使用Sqoop从Postgresql中导入数据到Hive中”,今天看看怎样从 Postgresql 入数据到 HBase 中。
这里有一点需要注意的是 Sqoop 1.4.7 目前不支持 HBase 2.x,所以准备了一个 hbase 1.4.9 的环境来做测试。
进入 sqoop 的 conf 目录,修改 sqoop-env.sh 文件,如下:
#Set path to where bin/hadoop is available export HADOOP_COMMON_HOME=/apps/hadoop-2.7.7 #Set path to where hadoop-*-core.jar is available export HADOOP_MAPRED_HOME=/apps/hadoop-2.7.7 #set the path to where bin/hbase is available export HBASE_HOME=/apps/hbase-1.4.9 #Set the path to where bin/hive is available export HIVE_HOME=/apps/apache-hive-2.3.2-bin #Set the path for where zookeper config dir is export ZOOCFGDIR=/apps/zookeeper-3.4.10/conf
从 postgresql 向 HBase 导入数据
使用项目的命令来向 HBase 导入数据
$ bin/sqoop import --connect jdbc:postgresql://localhost:5432/test --username test --password test --table users --hbase-table user --column-family base --hbase-row-key id --hbase-create-table --m 1
导入数据后,登录到 hbase 中查看一下结果
$ bin/hbase shell hbase(main):001:0> list TABLE user 1 row(s) in 0.0330 seconds => Hbase::Table - user hbase(main):002:0> scan 'user' ROW COLUMN+CELL 1 column=base:name, timestamp=1547609241178, value=user1 1 column=base:password, timestamp=1547609241178, value=password1 2 column=base:name, timestamp=1547609241178, value=user2 2 column=base:password, timestamp=1547609241178, value=password2 3 column=base:name, timestamp=1547609241178, value=user3 3 column=base:password, timestamp=1547609241178, value=password3 3 row(s) in 0.1540 seconds
其它导入参数可以参考
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
猜你喜欢:- 如何使用Azure数据迁移将数据移动到云端
- iOS数据持久化:使用NSKeyedArchiver进行数据归档
- WordPress插件开发 -- 在插件使用数据库存储数据
- 使用Pig清洗数据
- 使用“数据驱动测试”之前
- 数据安全治理中的开发测试环境数据安全使用技术
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
家事的撫慰(下冊)
Cheryl Mendelson / 甘錫安 / 大家出版社 / 2014-1-28 / NT$520
家事界暢銷參考書籍 各大媒體一致盛讚 亞馬遜讀者四星半高度評鑑 誠品、博客來、香港誠品 三選書 家務界經典暢銷書│各大媒體一致盛讚│讀者四星半高度評鑑 「這個世代最重要的家事著作!」──《大西洋月刊》 恢復家務打理者應有的地位,賦予應有的尊嚴和價值。 以生理的勞動、心力的投入,以及正確的持家知識,換得情感上的溫暖與安全。 .家裡空氣有異味,用香味來......一起来看看 《家事的撫慰(下冊)》 这本书的介绍吧!