- Apache Hive Essentials
- Dayong Du
- 444字
- 2021-07-23 20:25:29
Installing Hive from Apache
To introduce the Hive installation, we use Hive version 1.0.0 as an example. The pre-installation requirements for this installation are as follows:
- JDK 1.7.0_51
- Hadoop 0.20.x, 0.23.x.y, 1.x.y, or 2.x.y
- Ubuntu 14.04/CentOS 6.2
Note
Since we focus on Hive in this book, the installation steps for Java and Hadoop are not provided here. For steps on installing them, please refer to https://www.java.com/en/download/help/download_options.xml and http://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-common/ClusterSetup.html.
The following steps describe how to install Hive from Apache through the Linux command line:
- Download Hive from Apache Hive and unpack it:
bash-4.1$ wget http://apache.mirror.rafal.ca/hive/hive-1.0.0/apache-hive-1.0.0-bin.tar.gz bash-4.1$ tar -zxvf apache-hive-1.0.0-bin.tar.gz
- Add Hive to the system path by opening
/etc/profile
or~/.bashrc
and add the following two rows:export HIVE_HOME=/home/hivebooks/apache-hive-1.0.0-bin export PATH=$PATH:$HIVE_HOME/bin:$HIVE_HOME/conf
- Enable the settings immediately:
bash-4.1$ source /etc/profile
- Create the configuration files:
bash-4.1$ cd apache-hive-1.0.0-bin/conf bash-4.1$ cp hive-default.xml.template hive-site.xml bash-4.1$ cp hive-env.sh.template hive-env.sh bash-4.1$ cp hive-exec-log4j.properties.template hive-exec-log4j.properties bash-4.1$ cp hive-log4j.properties.template hive-log4j.properties
- Modify the configuration file at
$HIVE_HOME/conf/hive-env.sh
:#Set HADOOP_HOME to point to a specific Hadoop install directory export HADOOP_HOME=/home/hivebooks/hadoop-2.2.0 #Hive Configuration Directory can be accessed at: export HIVE_CONF_DIR=/home/hivebooks/apache-hive-1.0.0-bin/conf
- Modify the configuration file at
$HIVE_HOME/conf/hive-site.xml
. There are some important parameters that need special attention:hive.metastore.warehourse.dir
: This is the path for Hive warehouse storage. By default it is/user/hive/warehouse
.hive.exec.scratchdir
: This is the temporary data file path. By default it is/tmp/hive-${user.name}
.
By default, Hive uses the Derby (http://db.apache.org/derby/) database as the metadata store. Hive can also use other databases, such as PostgreSQL (http://www.postgresql.org/) or MySQL (http://www.mysql.com/) as the metadata store. To configure Hive to use other databases, the following parameters should be configured:
javax.jdo.option.ConnectionURL // the database URL javax.jdo.option.ConnectionDriverName // the JDBC driver name javax.jdo.option.ConnectionUserName // database username javax.jdo.option.ConnectionPassword // database password
The following is an example setting using MySQL as the metastore database:
<property> <name>javax.jdo.option.ConnectionURL</name> <value>jdbc:mysql://myhost:3306/hive?createDatabase IfNotExist=true</value> <description>JDBC connect string for a JDBC metastore</description> </property> <property> <name>javax.jdo.option.ConnectionDriverName</name> <value>com.mysql.jdbc.Driver</value> <description>Driver class name for a JDBC metastore</description> </property> <property> <name>javax.jdo.option.ConnectionUserName</name> <value>hive</value> <description>username to use against metastore database</description> </property> <property> <name>javax.jdo.option.ConnectionPassword</name> <value>hive</value> <description>password to use against metastore database</description> </property>
Make sure the MySQL JDBC driver is available at $HIVE_HOME/lib
.
Create folders and grant proper write permissions to the user group in the HDFS folder:
bash-4.1$ hdfs dfs –mkdir /tmp bash-4.1$ hdfs dfs –mkdir /user/hive/warehouse bash-4.1$ hdfs dfs -chmod g+w /tmp bash-4.1$ hdfs dfs -chmod g+w /user/hive/warehouse
That's all about Apache Hive installation. In one of the Hive nodes installed, type hive
to enter the Hive command-line environment (hive>
), which verifies Hive is successfully installed.
- 嵌入式軟件系統(tǒng)測試:基于形式化方法的自動(dòng)化測試解決方案
- Monkey Game Development:Beginner's Guide
- 假如C語言是我發(fā)明的:講給孩子聽的大師編程課
- Visual FoxPro程序設(shè)計(jì)
- Java程序員面試筆試寶典(第2版)
- UI設(shè)計(jì)全書(全彩)
- Raspberry Pi Robotic Blueprints
- Python機(jī)器學(xué)習(xí)算法與應(yīng)用
- Mastering OpenStack
- Laravel Design Patterns and Best Practices
- Java面試一戰(zhàn)到底(基礎(chǔ)卷)
- jMonkeyEngine 3.0 Beginner’s Guide
- 深度剖析ApacheDubbo核心技術(shù)內(nèi)幕
- The Java Workshop
- Instant OpenCV for iOS