Steps for hbase database migration

Source: Internet
Author: User
Tags hadoop fs
1. Export data
hbase org.apache.hadoop.hbase.mapreduce.Export t_zyzx_grzyfwtjxxb         /hbase/data_backup/20181030/t_zyzx_grzyfwtjxxb    hbase org.apache.hadoop.hbase.mapreduce.Export t_zyzx_jrrz                /hbase/data_backup/20181030/t_zyzx_jrrz                                hbase org.apache.hadoop.hbase.mapreduce.Export t_zyzx_kcxxmxb             /hbase/data_backup/20181030/t_zyzx_kcxxmxbhbase org.apache.hadoop.hbase.mapreduce.Export t_zyzx_tob_zyfwtjxxb       /hbase/data_backup/20181030/t_zyzx_tob_zyfwtjxxbhbase org.apache.hadoop.hbase.mapreduce.Export t_zyzx_twfile              /hbase/data_backup/20181030/t_zyzx_twfilehbase org.apache.hadoop.hbase.mapreduce.Export t_zyzx_zyfwtjxxb           /hbase/data_backup/20181030/t_zyzx_zyfwtjxxbhbase org.apache.hadoop.hbase.mapreduce.Export t_zyzx_zyjs_gjc            /hbase/data_backup/20181030/t_zyzx_zyjs_gjchbase org.apache.hadoop.hbase.mapreduce.Export t_zyzx_zyllmxb             /hbase/data_backup/20181030/t_zyzx_zyllmxbhbase org.apache.hadoop.hbase.mapreduce.Export t_zyzx_zypjmxb             /hbase/data_backup/20181030/t_zyzx_zypjmxbhbase org.apache.hadoop.hbase.mapreduce.Export t_zyzx_zyscmxb             /hbase/data_backup/20181030/t_zyzx_zyscmxbhbase org.apache.hadoop.hbase.mapreduce.Export t_zyzx_zysh                /hbase/data_backup/20181030/t_zyzx_zyshhbase org.apache.hadoop.hbase.mapreduce.Export t_zyzx_zyxzmxb             /hbase/data_backup/20181030/t_zyzx_zyxzmxb
2. Get the hbase file as a local readable File
hadoop fs -get /hbase/data_backup/20181030/t_zyzx_grzyfwtjxxb         /wdcloud/data/hbase/data_backup/20181030/t_zyzx_grzyfwtjxxb        hadoop fs -get /hbase/data_backup/20181030/t_zyzx_jrrz         /wdcloud/data/hbase/data_backup/20181030/t_zyzx_jrrzhadoop fs -get /hbase/data_backup/20181030/t_zyzx_kcxxmxb         /wdcloud/data/hbase/data_backup/20181030/t_zyzx_kcxxmxbhadoop fs -get /hbase/data_backup/20181030/t_zyzx_tob_zyfwtjxxb         /wdcloud/data/hbase/data_backup/20181030/t_zyzx_tob_zyfwtjxxbhadoop fs -get /hbase/data_backup/20181030/t_zyzx_twfile         /wdcloud/data/hbase/data_backup/20181030/t_zyzx_twfilehadoop fs -get /hbase/data_backup/20181030/t_zyzx_zyfwtjxxb         /wdcloud/data/hbase/data_backup/20181030/t_zyzx_zyfwtjxxbhadoop fs -get /hbase/data_backup/20181030/t_zyzx_zyjs_gjc         /wdcloud/data/hbase/data_backup/20181030/t_zyzx_zyjs_gjchadoop fs -get /hbase/data_backup/20181030/t_zyzx_zyllmxb         /wdcloud/data/hbase/data_backup/20181030/t_zyzx_zyllmxbhadoop fs -get /hbase/data_backup/20181030/t_zyzx_zypjmxb         /wdcloud/data/hbase/data_backup/20181030/t_zyzx_zypjmxbhadoop fs -get /hbase/data_backup/20181030/t_zyzx_zyscmxb         /wdcloud/data/hbase/data_backup/20181030/t_zyzx_zyscmxbhadoop fs -get /hbase/data_backup/20181030/t_zyzx_zysh         /wdcloud/data/hbase/data_backup/20181030/t_zyzx_zyshhadoop fs -get /hbase/data_backup/20181030/t_zyzx_zyxzmxb         /wdcloud/data/hbase/data_backup/20181030/t_zyzx_zyxzmxb
3. Compress and export Exported Files
tar -cf 20181030.tar  /wdcloud/data/hbase/data_backup/20181030/gzip 20181030.tar
4. Import the exported file to the new guide server and decompress it.
tar -zxvf 20181030.tar
5. Create a table in the new hbase Database
create ‘t_zyzx_grzyfwtjxxb‘,‘info‘ create ‘t_zyzx_jrrz‘,‘info‘ create ‘t_zyzx_kcxxmxb‘,‘info‘ create ‘t_zyzx_tob_zyfwtjxxb‘,‘info‘ create ‘t_zyzx_twfile‘,‘info‘ create ‘t_zyzx_zyfwtjxxb‘,‘info‘ create ‘t_zyzx_zyjs_gjc‘,‘info‘ create ‘t_zyzx_zyllmxb‘,‘info‘ create ‘t_zyzx_zypjmxb‘,‘info‘ create ‘t_zyzx_zyscmxb‘,‘info‘ create ‘t_zyzx_zysh‘,‘info‘ create ‘t_zyzx_zyxzmxb‘,‘info‘ 
6. Create an hbase path
# View hbase path hadoop FS-ls/# create hbase path hadoop FS-mkdir/tmp/zyzx/20181031/
7. Convert the file into an hbase readable File
hadoop fs -put /wdcloud/data/hbase/20181030/t_zyzx_grzyfwtjxxb  /tmp/zyzx/20181031/t_zyzx_grzyfwtjxxbhadoop fs -put /wdcloud/data/hbase/20181030/t_zyzx_jrrz  /tmp/zyzx/20181031/t_zyzx_jrrzhadoop fs -put /wdcloud/data/hbase/20181030/t_zyzx_kcxxmxb  /tmp/zyzx/20181031/t_zyzx_kcxxmxbhadoop fs -put /wdcloud/data/hbase/20181030/t_zyzx_tob_zyfwtjxxb  /tmp/zyzx/20181031/t_zyzx_tob_zyfwtjxxbhadoop fs -put /wdcloud/data/hbase/20181030/t_zyzx_twfile  /tmp/zyzx/20181031/t_zyzx_twfilehadoop fs -put /wdcloud/data/hbase/20181030/t_zyzx_zyfwtjxxb  /tmp/zyzx/20181031/t_zyzx_zyfwtjxxbhadoop fs -put /wdcloud/data/hbase/20181030/t_zyzx_zyjs_gjc  /tmp/zyzx/20181031/t_zyzx_zyjs_gjchadoop fs -put /wdcloud/data/hbase/20181030/t_zyzx_zyllmxb  /tmp/zyzx/20181031/t_zyzx_zyllmxbhadoop fs -put /wdcloud/data/hbase/20181030/t_zyzx_zypjmxb  /tmp/zyzx/20181031/t_zyzx_zypjmxbhadoop fs -put /wdcloud/data/hbase/20181030/t_zyzx_zyscmxb  /tmp/zyzx/20181031/t_zyzx_zyscmxbhadoop fs -put /wdcloud/data/hbase/20181030/t_zyzx_zysh  /tmp/zyzx/20181031/t_zyzx_zyshhadoop fs -put /wdcloud/data/hbase/20181030/t_zyzx_zyxzmxb  /tmp/zyzx/20181031/t_zyzx_zyxzmxb
8. Import files
hbase org.apache.hadoop.hbase.mapreduce.Import t_zyzx_grzyfwtjxxb /tmp/zyzx/20181031/t_zyzx_grzyfwtjxxb  hbase org.apache.hadoop.hbase.mapreduce.Import t_zyzx_jrrz  /tmp/zyzx/20181031/t_zyzx_jrrz hbase org.apache.hadoop.hbase.mapreduce.Import t_zyzx_kcxxmxb /tmp/zyzx/20181031/t_zyzx_kcxxmxbhbase org.apache.hadoop.hbase.mapreduce.Import t_zyzx_tob_zyfwtjxxb /tmp/zyzx/20181031/t_zyzx_tob_zyfwtjxxbhbase org.apache.hadoop.hbase.mapreduce.Import t_zyzx_zyfwtjxxb /tmp/zyzx/20181031/t_zyzx_zyfwtjxxbhbase org.apache.hadoop.hbase.mapreduce.Import t_zyzx_zyjs_gjc /tmp/zyzx/20181031/t_zyzx_zyjs_gjchbase org.apache.hadoop.hbase.mapreduce.Import t_zyzx_zyllmxb /tmp/zyzx/20181031/t_zyzx_zyllmxbhbase org.apache.hadoop.hbase.mapreduce.Import t_zyzx_zypjmxb /tmp/zyzx/20181031/t_zyzx_zypjmxbhbase org.apache.hadoop.hbase.mapreduce.Import t_zyzx_zyscmxb /tmp/zyzx/20181031/t_zyzx_zyscmxbhbase org.apache.hadoop.hbase.mapreduce.Import t_zyzx_zysh /tmp/zyzx/20181031/t_zyzx_zyshhbase org.apache.hadoop.hbase.mapreduce.Import t_zyzx_zyxzmxb /tmp/zyzx/20181031/t_zyzx_zyxzmxbhbase org.apache.hadoop.hbase.mapreduce.Import t_zyzx_twfile /tmp/zyzx/20181031/t_zyzx_twfile
9. hbase basic commands
# Switching hadoop user su hadoop # entering command line hbase shell # viewing table data describe 't_zyzx_grzyfwtjxxb' # viewing all table lists # viewing table count 't_zyzx_zyxzmxb'

Steps for hbase database migration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.