Install and configure hive
1. Prerequisites
To install hadoop first, see the http://blog.csdn.net/hwwn2009/article/details/39889465 for Installation Details
2. Install hive
1) download hive. Note that the hive version is compatible with the hadoop version.
wget http://apache.fayea.com/apache-mirror/hive/hive-0.13.1/apache-hive-0.13.1-bin.tar.gz
2) decompress
tar xzf apache-hive-0.13.1-bin.tar.gz
3) modify the/etc/profile file and add the following:
export HIVE_HOME=/home/hadooper/hadoop/hive-0.13.1export CLASSPATH=.:$JAVA_HOME/lib:$HADOOP_HOME/lib:$HIVE_HOME/lib:$CLASSPATHexport PATH=$JAVA_HOME/bin:$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$HIVE_HOME/bin:$PATH
3. Install mysql
Because hive metadata may be updated, modified, and read frequently, it is not suitable to be stored in hadoop hdfs, but in RDBMS. There are two main types:
① Embedded Derby database (default): Only one session connection is allowed, which is only applicable to simple tests.
② MySQL database (commonly used): supports multi-user sessions.
This article replaces derby with mysql, as follows:
1) install mysql
yum install mysql-server
2) Start mysql
service mysqld start
3) initialize mysql
[hadooper@MasterServer hive-0.13.1]$/usr/bin/mysql_secure_installation
[...]Enter current password for root (enter for none):OK, successfully used password, moving on...[...]Set root password? [Y/n] yNew password:Re-enter new password:Remove anonymous users? [Y/n] Y[...]Disallow root login remotely? [Y/n] N[...]Remove test database and access to it [Y/n] Y[...]Reload privilege tables now? [Y/n] YAll done!
3) use root to log on to mysql and create a mysql account for hive
[hadooper@MasterServer hive-0.13.1]$ mysql -u root -pmysql> create user 'hive' identified by '1234';mysql> GRANT ALL PRIVILEGES ON *.* TO 'hive'@'localhost' IDENTIFIED BY '1234' WITH GRANT OPTION; mysql> flush privileges;mysql> exit
4) log on to MySQL using the hive account
mysql -u hive -p
5) create a dedicated hive Database
mysql>create database hive;
6) download the JDBC driver package and copy it to the lib under the hive root directory.
yum install mysql-connector-javaln -s /usr/share/java/mysql-connector-java.jar /home/hadooper/hadoop/hive-0.13.1/lib/mysql-connector-java.jar
(Please note: Reproduced http://blog.csdn.net/hwwn2009/article/details/39934089)
4. hive Configuration
Copy the hive-default.xml.template under the conf directory of hive and name it the hive-site.xml. Modify the following content:
<property> <name>javax.jdo.option.ConnectionURL</name> <value>jdbc:mysql://localhost:3306/hive?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>hive</value></property><property> <name>javax.jdo.option.ConnectionPassword</name> <value>1234</value></property>
5. hive Testing
Reprinted Please note: http://blog.csdn.net/hwwn2009/article/details/39934089