將HBase中的表資料匯入到hive中

2021-10-25 13:12:07 字數 3798 閱讀 4483

--------------------user_friend-----------------

建立hb_user_friend外部表:

create external table events.hb_user_friend(

row_key string

,user_id string

,friend_id string)

stored by

'org.apache.hadoop.hive.hbase.hbasestoragehandler'

with serdeproperties(

=':key,

uf:userid,

uf:friendid'

) tblproperties(

'hbase.table.name'

='events_db:user_friend'

);

建立user_friend內部表:

create

table user_friend

stored as orc as

select

*from hb_user_friend;

------------------------------event_attendee-----------------------------

建立hb_event_attendee外部表:

create external table events.hb_event_attendee(row_key string,event_id string,user_id string,attend_type string) 

stored by

'org.apache.hadoop.hive.hbase.hbasestoragehandler'

with serdeproperties(

=':key,euat:eventid,euat:userid,euat:state'

) tblproperties(

'hbase.table.name'

='events_db:event_attendee'

);

建立event_attendee內部表:

create

table event_attendee

stored as orc as

select

*from hb_event_attendee;

------------------------------events---------------------------------

建立hb_events外部表:

create external table events.hb_events(

event_id string,

start_time string,

city string,

state string,

zip string,

country string,

lat string,

lng string,

user_id string,

common_words string)

stored by

'org.apache.hadoop.hive.hbase.hbasestoragehandler'

with serdeproperties(

=':key,

creator:user_id,

schedule:start_time,

location:city,

location:state,

location:zip,

location:country,

location:lat,

location:lng,

remark:common_words'

) tblproperties(

'hbase.table.name'

='events_db:events'

);

建立events內部表:

create

table events

stored as orc as

select

*from hb_events;

-----------------------------------train---------------------------------

建立hb_train外部表:

create external table events.hb_train(row_key string,

user_id string,

event_id string,

invited string,

timestamp string,

interested string,

not_interested string

) stored by

'org.apache.hadoop.hive.hbase.hbasestoragehandler'

with serdeproperties(

=':key,

eu:user,

eu:event,

eu:invited,

eu:timestamp,

eu:interested,

eu:not_interested')

tblproperties(

'hbase.table.name'

='events_db:train'

);

建立train內部表:

create

table train

stored as orc as

select

*from hb_train;

----------------------users------------------------

建立hb_users外部表:

create external table events.hb_users(

user_id string,

birthyear string,

gender string,

locale string,

location string,

timezone string,

joined_at string

) stored by

'org.apache.hadoop.hive.hbase.hbasestoragehandler'

with serdeproperties(

=':key,

profile:locale,

profile:birthyear,

region:gender,

registration:joinedat,

region:location,

region:timezone')

tblproperties(

'hbase.table.name'

='events_db:users'

);

建立users內部表:

create

table users

stored as orc as

select

*from hb_users;

將資料從hbase匯入到hive

選定test0721表 hbase main 001 0 list table system.catalog system.function system.log system.mutex system.sequence system.stats test0721 7row s in 0.1500 ...

sqoop將oracle匯入到hbase經驗之談

之前公司有個專案,通過sqoop,將oracle的資料匯入到hbase。真個過程出現過很多問題,現在我將我匯入的過程跟遇到的問題和解決方法寫下來,希望能幫助大家 先測試sqoop是否能連線到oracle sqoop list tables connect jdbc oracle thin ip 15...

將hdfs資料匯入到hbase中的官方案例

首先我們在本地建立乙個檔案資料,資料中間是tab分隔符 root hdp 4 vi mrhbase.tsv 1002 pear yellow 將資料put到hdfs上 root hdp 4 hadoop fs put root mrhbase.tsv 建立hbase表 hbase main 016 ...