Prerequisites:
1. A virtual machine configured with a Hadoop environment. Hadoop Environment Build Tutorial: Add later
2. There is a Hadoop account. There is no new Hadoop account that can be installed to configure Hadoop.
Installation Tutorials:
One, MySQL installation
1, install the MySQL command: Yum install mysql-server-y (-y parameter for all need to enter the place of Yes default Yes)
2. Open MySQL Services: Service mysqld start
3, set up the MySQL service boot from start (also can not set, boot manual start): Chkconfig–add mysqld
4. Go to MySQL command line: mysql-u root-p (Root is the account is not required root) the first time to enter does not need to lose the password can be directly: MySQL command into MySQL
5. Set password-The first time no password is set: mysqladmin-u root password qixiao123
--If not in the 5th step setting, you can also change the password under the MySQL command line (go to MySQL first): Update user set Password=password (' New password ') where user= ' root ' FLUSH Privileges
Here you can enter a few MySQL commands to test:
Display database: show databases;
Using the database: use MySQL;
Show table: Show tables;
Second, the installation and deployment of hive
1. First download the Hive installation package: Hive-0.12.tar.gz upload the installation package to the directory that will be installed on the virtual machine
2, use the command to extract the installation package: TAR–ZXVF hive-0.12.tar.gz
3. Modify the file in the home directory. Bash_profile (can: ll-a command view): Vi. bash_profile
4. Add Hive environment variable
Here the Hive_home directory is written according to its own installation path, where hive is installed in the/home/hadoop/hadoop/hive-0.12.0 directory
Modify finish Save->esc->:wq carriage return
Input command: source. bash_profile Update File
! The above steps can be configured in the. bashrc file, and then the source. BASHRC command is updated, changed. BASHRC, and the change. bash_profile file effect is the same.
5, switch directories to $hive_home/conf/;
6, modify default.xml.template and Hive-env.sh.template file name is Hive-site.xml and hive-env.sh. The command is as follows (CP or MV command can be used):
CP hive-default.xml.template hive-site.xml Command and CP hive-env.sh.template hive-env.sh command;
7. Modify hive-env.sh to write your own Hadoop directory
This is changed to its own Hadoop installation directory;
8, modify the above Hive-site.xml file contents: VI hive-site.xml
In about 2000 lines about VI command: to 2000 (Jump to 2000 lines)
Modify </auth> change to </value> match value label
9. Hive Startup method: Direct input in command line mode: Hive carriage return
If it appears:
Indicates that there is no problem with the Hive environment variable and configuration. To this, the basic installation and deployment of hive has been completed;
Hive Log Location:/usr/local/share/applications/hive/hive-0.12.0/logs/hive.log
Iii. Hive integrated MySQL as meta data
MySQL is used in hive and needs to be uploaded to the Hive/lib directory, and MySQL packages can be downloaded from the Hive website.
Upload the downloaded MySQL jar package to the Hive/lib directory, using SSH or any of the remote connection tools for uploading the jar package
Perform a view of the Lib directory to see the uploaded jar package: [[email protected] lib]$ ll-a
1, modify the hive-env.sh file under/hive-0.12.0/conf
# Set Hadoop_home to point to a specific HADOOP install directory
hadoop_home=/home/hadoop/app/hadoop-2.6.2
# Hive Configuration Directory can be controlled by:
Export hive_conf_dir=/home/hadoop/app/hive-0.12.0/conf
Here follow your own installation directory to modify.
2,/hive-0.12.0/conf under the Hive-site.xml file modification
Change the contents of the content to:
1 <?xml version= "1.0"?> 2 <?xml-stylesheet type= "text/xsl" href= "configuration.xsl"?> 3 <configuration > 4 <property> 5 <name>javax.jdo.option.ConnectionURL</name> 6 <value>jdbc :mysql://localhost:3306/hive?createdatabaseifnotexist=true</value> 7 <description>jdbc Connect String for a JDBC metastore</description> 8 </property> 9 <property>10 <name> Javax.jdo.option.connectionusername</name>11 <value>hive</value>12 <description >username to use against Metastore database</description>13 </property>14 <property> <name>javax.jdo.option.connectionpassword</name>16 <value>hive</value>17 <description>password to use against Metastore database</description>18 </property>19 </configuration>
From the front we know that our "hive-site.xml" is a "hive-default.xml.template" of a copy, the configuration parameters are very many, but not what we all need, we know, The hive system will load two configuration files with a default profile "Hive-default.xml" and the other is the user-defined file "Hive-site.xml". When the value of the configuration parameter in "Hive-site.xml" is inconsistent with the "hive-default.xml" file, the user-defined will prevail. So we're going to remove all the parameters we don't need, leaving only the content shown above.
Note: In fact, modify the configuration file here if it is very troublesome under the Linux, altogether we have set up the FTP, why not, so the above configuration file download down, according to the requirements of the modification, such a file in Windows to operate is very convenient, and then upload it up, Overwrite the original can.
3, here Our configuration is over, into the Hive Environment: command line Input: Hive
Hive>show databases;
Hive>show tables;
The database table can be changed and deleted in Hive.
The End!
Hive installation and deployment integration MySQL