sqoop导入导出数据库文件
2015-12-27 14:18
375 查看
3 导入导出数据库
1)列出mysql数据库中的所有数据库命令
# sqoop list-databases --connect jdbc:mysql://localhost:3306/ --username root --password 123456
2)连接mysql并列出数据库中的表命令
# sqoop list-tables --connect jdbc:mysql://localhost:3306/test --username root --password 123456
命令中的test为mysql数据库中的test数据库名称 username password分别为mysql数据库的用户密码
3)将关系型数据的表结构复制到hive中
sqoop create-hive-table --connect jdbc:mysql://localhost:3306/test --table username --username root --password 123456 --hive-table test
其中 --table username为mysql中的数据库test中的表 --hive-table test 为hive中新建的表名称
4)从关系数据库导入文件到hive中
sqoop import --connect jdbc:mysql://localhost:3306/test --username root --password mysql-password --table t1 --hive-import
注意:这里只能原样导入,不能重新指定新的名字,导入到hive中名字不变。
1)列出mysql数据库中的所有数据库命令
# sqoop list-databases --connect jdbc:mysql://localhost:3306/ --username root --password 123456
2)连接mysql并列出数据库中的表命令
# sqoop list-tables --connect jdbc:mysql://localhost:3306/test --username root --password 123456
命令中的test为mysql数据库中的test数据库名称 username password分别为mysql数据库的用户密码
3)将关系型数据的表结构复制到hive中
sqoop create-hive-table --connect jdbc:mysql://localhost:3306/test --table username --username root --password 123456 --hive-table test
其中 --table username为mysql中的数据库test中的表 --hive-table test 为hive中新建的表名称
4)从关系数据库导入文件到hive中
sqoop import --connect jdbc:mysql://localhost:3306/test --username root --password mysql-password --table t1 --hive-import
注意:这里只能原样导入,不能重新指定新的名字,导入到hive中名字不变。
相关文章推荐
- Redis发布订阅模式
- windows2012安装oracle 12c r1
- MySQL外键设置中的的 Cascade、NO ACTION、Restrict、SET NULL
- mysql jdbc驱动源码分析(获取链接 connection)
- mysql数据库下载和创建
- Redis排序相关
- C#程序调用cmd执行命令-MySql备份还原
- Redis生存时间
- ERROR 1813 -Mysql:Tablespace for table 'xxx`.'xxx` exists.
- C#实现数据库的递归查询
- mysql系列一
- Redis中的事务
- Oracle 乐观锁、悲观锁
- 自己用的一个mysql存储过程
- mysql实现增量备份
- mysql的外键约束条件及注意事项
- mysql proxy
- SQL Server 触发器
- mysql存储过程详解
- SQLServer 维护脚本分享(11)部分DBCC及系统存储过程