标签:profile word eval from record export 方法 state 数据
条件 1.启动mysql service mysqld start 2.启动hadoop集群 start-all.sh
1.下载jar包(:http://mirrors.hust.edu.cn/apache/sqoop/1.4.6/)
2.上传安装包sqoop-1.4.6.bin__hadoop-2.0.4-alpha.tar.gz到/root/目录下
3.解压
tar -zxvf sqoop-1.4.6.bin__hadoop-2.0.4-alpha.tar.gz -C /usr/local/
3.重命名配置文件
在/usr/local/sqoop-1.4.6.bin__hadoop-2.0.4-alpha/conf/
template代表临时文件
mv sqoop-env-template.sh sqoop-env.sh mv sqoop-site-template.xml sqoop-site.xml (sqoop-site.xml如果存在的话就不用修改了)
4.修改配置文件 (根据自己情况进行修改)
vi sqoop-env.sh
export HADOOP_COMMON_HOME= /usr/local/hadoop-2.7.3 export HADOOP_MAPRED_HOME= /usr/local/hadoop-2.7.3 export HIVE_HOME= /usr/local/hive-2.3.4 export ZOOKEEPER_HOME= /usr/local/zookeeper-3.4.10 export ZOOCFGDIR= /usr/local/zookeeper-3.4.10/conf
5.拷贝jdbc驱动
将 mysql-connector-java-5.1.37/mysql-connector-java-8.0.11.jar 放到 sqoop的lib目录下哦
6.配置sqoop的环境变量
vi /etc/profile
记得更新 source vi /etc/profile
7.验证sqoop(可以省略)
我们可以通过某一个command来验证sqoop配置是否正确:
$ bin/sqoop help 出现一些Warning警告(警告信息已省略),并伴随着帮助命令的输出: Available commands: codegen Generate code to interact with database records create-hive-table Import a table definition into Hive eval Evaluate a SQL statement and display the results export Export an HDFS directory to a database table help List available commands import Import a table from a database to HDFS import-all-tables Import tables from a database to HDFS version Display version information ·····
8.测试sqoop是否能够成功连接数据库
mysql-connector-java-5.1.37
192.168.159.110 写自己的ip test1 写自己的连接
sqoop-list-database -connect jdbc:mysql://192.168.159.110:3306/test1 --username root --password 12345
mysql-connector-java-8.0.11.jar
sqoop-list-database --connect jdbc:mysql://192.168.150.110:3306/test1?serverTimezone=Asia/Shanghai --username root --password 123456
界面
出现如下输出:
information_schema
metastore
mysql
performance_schema
错误:
错误原因:mysql没有授权登录
解决方法:
1.登录mysql mysql -uroot -p
2.use mysql;
3.更新域属性
update user set host=‘%‘ where user=‘root‘;
4.执行以上语句后在进行更新语句
FLUSH PRIVILEGES;
5.执行授权语句
GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘WITH GRANT OPTION;
6.退出 exit;
7.再次登录 mysql -uroot -p
标签:profile word eval from record export 方法 state 数据
原文地址:https://www.cnblogs.com/wangshuang123/p/10985009.html