Hive synthetic hbase Two advantages table:
1. Implement data import to MySQL.
2. Implement the HBase table into another hbase table.
Three operation Links:
1.hbase Associated hive as an external table:
SQL code
- create external table hive_device_app (row_key string,genera_type string,install_type string,label string,meid string,model string,pkg_name string,specific_type string)
- stored by " Org.apache.hadoop.hive.hbase.HBaseStorageHandler '
- with SERDEPROPERTIES ( Span class= "string" style= "Color:blue" > "hbase.columns.mapping" = ": Key,cf:genera_type,cf:install_type,cf:label,cf:meid,cf:model,cf:pkg_name,cf:specific_type " )
- Tblproperties ("hbase.table.name" = "Tb_yl_device_app_info1");
2.hbase true associated hive,hive Insert update operations directly affect data in HBase
SQL code
- CREATE TABLE Hbase_device_app (row_key string,genera_type string,install_type string,label String,meid String,model String,pkg_name String,specific_type String)
- stored by " Org.apache.hadoop.hive.hbase.HBaseStorageHandler '
- with SERDEPROPERTIES ( Span class= "string" style= "Color:blue" > "hbase.columns.mapping" = ": Key,cf:genera_type,cf:install_type,cf:label,cf:meid,cf:model,cf:pkg_name,cf:specific_type " )
- Tblproperties ("hbase.table.name" = "Tb_yl_device_app_info2");
3. Create a hive table
SQL code
- CREATE TABLE hive_device_app_real (row_key string,genera_type string,install_type string,label String,meid String, Model String,pkg_name String,specific_type String)
4. External table data import into hive real table
SQL code
- Insert overwrite table hive_device_app_real Select * from Hive_device_app
5.sqoop exporting hive data to MySQL
SQL code
- sqoop export --connect jdbc:mysql://hadoop48/toplists -m 1 --table hive_device_app_ real --export-dir /user/hive/warehouse/hive_device_app_real/000000_0 --input-null-string " \\\\n " --input-null-non-string " \\\\n " --input-fields-terminated-by " \\01 " -- input-lines-terminated-by "\\n"
6.habse (Associated hive) One table goes to another table of course you can use the built-in functions of hive for data processing
SQL code
- insert overwrite table another_hive_hbase_related_table select * from hbase_device_app
exporting data from HBase to MySQL requires steps: 1345
HBase in one table to another table (in the middle can use hive for data processing of built-in functions): 226
HBase combines hive and sqoop to implement data guidance for MySQL