![9451d2e845ea36c122c72615b0e87491.png](https://img-blog.csdnimg.cn/img_convert/9451d2e845ea36c122c72615b0e87491.png)
准备工具
![908dea080bf38cf173710b96fc4d21a7.png](https://img-blog.csdnimg.cn/img_convert/908dea080bf38cf173710b96fc4d21a7.png)
解压缩文件
tar -zxvf apache-hive-1.2.1-hbase.tar.gz -C /opt/bigdata/
tar -zxvf sqoop-1.4.7.tar.gz -C /opt/bigdata/
![d1d578b466a7a409aac6679d074269e1.png](https://img-blog.csdnimg.cn/img_convert/d1d578b466a7a409aac6679d074269e1.png)
安装mysql
检查下是否已下载还有卸载残留
rpm -qa | grep mysql
find / -name mysql
![842d985a1ebff3fc99b95794afe37e57.png](https://img-blog.csdnimg.cn/img_convert/842d985a1ebff3fc99b95794afe37e57.png)
过rm -rf将以上目录删掉即可,另外顺便把配置文件/etc/my.cnf也删掉吧,用rm –f
rm -rf /usr/share/mysql/
rm -rf /usr/lib64/mysql
rm -f /etc/my.cnf
![9367635a692850177cfd60976d0b8936.png](https://img-blog.csdnimg.cn/img_convert/9367635a692850177cfd60976d0b8936.png)
执行命令
yum -y install mysql mysql-server
![2609a7758622fb17b05618c0607bab1b.png](https://img-blog.csdnimg.cn/img_convert/2609a7758622fb17b05618c0607bab1b.png)
安装mysql扩展
yum -y install mysql-connector-odbc mysql-devel libdbi-dbd-mysql
设置开启启动: chkconfig mysqld on
启动mysql
service mysqld start
![f2245ceba2181986e76b47f8512d7fa0.png](https://img-blog.csdnimg.cn/img_convert/f2245ceba2181986e76b47f8512d7fa0.png)
检查下
chkconfig | grep mysql
![78abe0aef53e2b0bb3b54e97d9100154.png](https://img-blog.csdnimg.cn/img_convert/78abe0aef53e2b0bb3b54e97d9100154.png)
设置登录密码:mysqladmin -u root password 'password'
![011941f8d1b9ea9b32c51c9be257d41e.png](https://img-blog.csdnimg.cn/img_convert/011941f8d1b9ea9b32c51c9be257d41e.png)
进入数据库,查询用户信息
mysql -hlocalhost -uroot -ppassword
![2a67cd30d5b1ded0ab1a31fb4e1444b8.png](https://img-blog.csdnimg.cn/img_convert/2a67cd30d5b1ded0ab1a31fb4e1444b8.png)
设置远程登录权限
grant all privileges on *.* to 'root'@'%' identified by 'password' with grant option;
![09fb919c542f78793a4f9b2bb276dbf6.png](https://img-blog.csdnimg.cn/img_convert/09fb919c542f78793a4f9b2bb276dbf6.png)
删除用户信息
delete from user where user='root' and host='127.0.0.1';
![fa245302c9af8e43a3b643a41e79bf29.png](https://img-blog.csdnimg.cn/img_convert/fa245302c9af8e43a3b643a41e79bf29.png)
刷新信息
flush privileges;
![dbb82b7a905e07d37e3846cd88878bec.png](https://img-blog.csdnimg.cn/img_convert/dbb82b7a905e07d37e3846cd88878bec.png)
update user set password = password("password") where user ="root" and host = "masterhbase";
![30679a8c6aa024605e08c69033ee6c87.png](https://img-blog.csdnimg.cn/img_convert/30679a8c6aa024605e08c69033ee6c87.png)
退出重启mysqld服务
service mysqld restart
![c687af1bdbf6d3a51de7f348ac62cad0.png](https://img-blog.csdnimg.cn/img_convert/c687af1bdbf6d3a51de7f348ac62cad0.png)
进入解压的hive目录中配置文件目录
![bee54d1f745e7d7787bb4f1bbe7abfae.png](https://img-blog.csdnimg.cn/img_convert/bee54d1f745e7d7787bb4f1bbe7abfae.png)
先重命名hive-default.xml.template
mv hive-default.xml.template hive-site.xml
![946ce4472097737eff0190cdef96c3c5.png](https://img-blog.csdnimg.cn/img_convert/946ce4472097737eff0190cdef96c3c5.png)
再重命名hive-env.sh.template
mv hive-env.sh.template hive-env.sh
![d4dfe73f0728a47b48736001bcee1d3e.png](https://img-blog.csdnimg.cn/img_convert/d4dfe73f0728a47b48736001bcee1d3e.png)
再重命名hive-log4j.properties.template
mv hive-log4j.properties.template hive-log4j.properties
![8b371e8e6d69a46dd26d52f2305bc3e5.png](https://img-blog.csdnimg.cn/img_convert/8b371e8e6d69a46dd26d52f2305bc3e5.png)
依次配置
首先编辑hive-env.sh
HADOOP_HOME=/opt/bigdata/hadoop-2.7.3
export HIVE_CONF_DIR=/opt/bigdata/apache-hive-1.2.1-bin/conf
![0fa5a86854477b8001f999bea52abbdd.png](https://img-blog.csdnimg.cn/img_convert/0fa5a86854477b8001f999bea52abbdd.png)
编辑hive-site.xml,情况补充以下内容
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://masterhbase:3306/hbasehivemetastore?createDatabaseIfNotExist=true</value>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>root</value>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>password</value>
</property>
<property>
<name>hive.cli.print.current.db</name>
<value>true</value>
</property>
<property>
<name>hive.cli.print.header</name>
<value>true</value>
</property>
</configuration>
![c7ff1580e1a915423b903b9f9d1edb76.png](https://img-blog.csdnimg.cn/img_convert/c7ff1580e1a915423b903b9f9d1edb76.png)
配置hive-log4j.properties
hive.log.dir=/opt/bigdata/apache-hive-1.2.1-bin/logs
![1a23c9ab24d65700ba837d54fee7fc19.png](https://img-blog.csdnimg.cn/img_convert/1a23c9ab24d65700ba837d54fee7fc19.png)
将jar包上传
![ce94bcfacf0c2e15ae8d51f206fcca82.png](https://img-blog.csdnimg.cn/img_convert/ce94bcfacf0c2e15ae8d51f206fcca82.png)
拷贝到lib目录下
cp mysql-connector-java-5.1.44-bin.jar /opt/bigdata/apache-hive-1.2.1-bin/lib/
![49c9ff9d5cfcf9ef3f1307884554c399.png](https://img-blog.csdnimg.cn/img_convert/49c9ff9d5cfcf9ef3f1307884554c399.png)
切换到Hadoop目录,建立目录,并修改权限
/user/hive/warehouse为Hive存放数据的目录
bin/hdfs dfs -mkdir -p /user/hive/warehouse
bin/hdfs dfs -chmod g+w /user/hive/warehouse
![5567a6bc37201152fd71c8d4c0c0bbb8.png](https://img-blog.csdnimg.cn/img_convert/5567a6bc37201152fd71c8d4c0c0bbb8.png)
bin/hdfs dfs -mkdir -p /tmp
bin/hdfs dfs -chmod g+w /tmp
![155302bacc432e652db9fef53a9ed202.png](https://img-blog.csdnimg.cn/img_convert/155302bacc432e652db9fef53a9ed202.png)
启动客户端使用Hive bin/hive就可以了
![8fc247705038dd489bd087ce1be5a6dc.png](https://img-blog.csdnimg.cn/img_convert/8fc247705038dd489bd087ce1be5a6dc.png)
进入sqoop目录
配置conf/sqoop-env.sh
复制: cp -a sqoop-env-template.sh sqoop-env.sh
或直接重命名重命名hive-env.sh (去掉.template)
![5135c1e9a858227172b689056b0da4cb.png](https://img-blog.csdnimg.cn/img_convert/5135c1e9a858227172b689056b0da4cb.png)
编辑文件sqoop-env.sh
export HADOOP_COMMON_HOME=/opt/bigdata/hadoop-2.7.3
export HADOOP_MAPRED_HOME=/opt/bigdata/hadoop-2.7.3
export HIVE_HOME=/opt/bigdata/apache-hive-1.2.1-bin
![94c0c0a609a58285763f431e9acd2864.png](https://img-blog.csdnimg.cn/img_convert/94c0c0a609a58285763f431e9acd2864.png)
拷贝jdbc驱动包达到lib目录
cp mysql-connector-java-5.1.44-bin.jar /opt/bigdata/sqoop-1.4.7/lib/
![baa1a4a03095a2210df04ffc7bc3151d.png](https://img-blog.csdnimg.cn/img_convert/baa1a4a03095a2210df04ffc7bc3151d.png)
cp sqoop-1.4.7.jar /opt/bigdata/sqoop-1.4.7/lib/
![417ad3b5ebf5278b3670bb15001d1c39.png](https://img-blog.csdnimg.cn/img_convert/417ad3b5ebf5278b3670bb15001d1c39.png)
查看帮助信息:bin/sqoop help
![7565fdb7412c2ba0b41a7290c5308cc6.png](https://img-blog.csdnimg.cn/img_convert/7565fdb7412c2ba0b41a7290c5308cc6.png)
测试:sqoop连接mysql
bin/sqoop list-databases --connect jdbc:mysql://masterhbase:3306/ --username root --password password
![694840237554113a0b6688e508ccb92f.png](https://img-blog.csdnimg.cn/img_convert/694840237554113a0b6688e508ccb92f.png)
解决办法上传jar包
avro-1.8.1.jar
![181a597dcff962b6e14583fc7adc6b09.png](https://img-blog.csdnimg.cn/img_convert/181a597dcff962b6e14583fc7adc6b09.png)
再连接可以了
![21f0a272da85e5038b3ef660fea6c248.png](https://img-blog.csdnimg.cn/img_convert/21f0a272da85e5038b3ef660fea6c248.png)