create table student(id int,name varchar(255),score int ,home varchar(255));
insert into student VALUES(1,‘yang’,90,‘beijing’);
insert into student VALUES(2,‘chong’,90,‘hanghzou’);
与mysql相比,只是改变了数据库连接的方式
hbase表不存在会自动创建
–hbase-create-table \
无批次
sqoop import
–connect jdbc:sqlserver://al-node3:1433;database=test
–username root
–password root
–table student
–hbase-table hbase_student
–column-family info
–hbase-create-table
–hbase-row-key id
有批次 会先写到hdfs的一个临时目录,在自己进行转移
sqoop import
–connect jdbc:sqlserver://al-node3:1433;database=test
–username root
–password root
–table student
–hbase-table hbase_student_bulk
–column-family info
–hbase-create-table \
–hbase-row-key id
–hbase-bulkload
增量
sqoop import \
–connect jdbc:sqlserver://al-node3:1433;database=test \
–username username
–password password
–table tablename
–hbase-table namespace:tablename
–column-family columnfamily
–hbase-create-table
–incremental append
–check-column ‘id’
–last-value 0