Premise: a virtual machine can access, hadoop cluster and build a successful start.
Note: the path of each line of code is executed.
First, install MySQL
1, line installation MySQL yum install mysql-server
installation is complete
2, start the MySQL service mysqld Start Service
3, set the MySQL root user password
(1), there is no default password, so press Enter to go directly to MySQL.
(2), enter the command to set the root password password for root @ localhost the SET = password ( 'root');
MySQL:
User: root
Password: root
(3), Exit (exit;) re-login (mysql -u root -p)
4. create a hive account.
(1) Create the User hive account the Create 'hive' IDENTIFIED by 'hive';
(2), the MySQL account all rights authorized hive All ON Grant . To 'hive' @ 'yb'identified by' hive ';
(3) the above command to take effect flush privileges;
then use the MySQL database to hive account login -h Yb -u hive -p MySQL
(4), to create a hive database create database hive;
Second, the installation hive
1, upload extract the hive
Note: Make sure the red box permissions for the hadoop! If root, the root user may enter a command to modify hadoop: chown -R hadoop: hadoop apache- hive-1.0.0-bin.tar.gz, then re-enter the user decompress hadoop
2, the apache-hive-1.0. 0-bin weight hive mv apache-hive-1.0.0- bin named hive3、修改hive配置文件
由于hive-site.xml文件不存在,首先需要使用命令复制一份:cp hive-default.xml.template hive-site.xml
(1),修改配置文件hive-site.xml
配置驱动连接名为com.mysql.jdbc.Driver
注意:需要找到文件中的对应内容
修改MySQL的URL
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://192.168.1.68:3306/hive</value>
</property>
修改数据库的用户名和密码
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>root</value>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>123456</value>
</property>
4、配置hive坏境变量 vi /etc/profile
注意:切换到root用户下
使配置生效 source /etc/profile
5、下载mysql-connector-java-5.1.38.jar,并上传到hive的lib目录下
创建hive相关目录
6、修改hive-site.xml相关文件
<property>
<name>hive.querylog.location</name>
<value>/home/hadoop/app/hive/iotmp</value>
<description>Location of Hive run time structured log file</description>
</property>
<property>
<name>hive.exec.local.scratchdir</name>
<value>/home/hadoop/app/hive/iotmp</value>
<description>Local scratch space for Hive jobs</description>
</property>
<property>
<name>hive.downloaded.resources.dir</name>
<value>/home/hadoop/app/hive/iotmp</value>
<description>Temporary local directory for added resources in the remote file system.</description>
</property>
7, script execution hive
Note: Before performing start hadoop cluster
8, check whether the hive
so far hive installation is complete! ! !