First, the system environment
Os:ubuntu 16.04 LTS 64bitjdk:1.8.0_161hadoop:2.6.4
mysql:5.7.21hive:2.1.0
Before you configure hive, you configure Hadoop first.
Second, installation steps
1, the installation and configuration of hive
Installation of 1.1 hive
Download hive2.1.0 and install to/usr/local using the following command
1.2 Configuring environment variables
Add the following code:
Export Hive_home=/usr/local/hiveexport hcat_home= $HIVE _home/hcatalogexport hive_conf= $HIVE _home/confexport PATH=$ PATH: $HIVE _home/bin
Save, and then
1.3 Configuring Hive-site.xml
The following actions are performed by default in the Hive installation directory/usr/local/hive
CP Conf/hive-default.xml.template Conf/hive-site.xml
Then modify some of the content in the Hive-site.xml, and modify the corresponding name to the following value:
< Property> <name>Javax.jdo.option.ConnectionURL</name> <value>Jdbc:mysql://localhost:3306/hive?characterencoding=utf-8&Createdatabaseifnotexist=true</value> <Description>JDBC connect string for a jdbc Metastore. To use SSL-encrypt/authenticate the connection, provide database-specific SSL flag in the connection URL. For example, jdbc:postgresql://myhost/db?ssl=true for Postgres database. </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>
Replace All ${system:java.io.tmpdir} in Hvie-site.xml with/usr/local/hive/tmp, replace ${system:user.name} with ${user.name}
2. Install and configure MySQL
2.1 Installing MySQL
Running sudo apt-get install mysql-server , installing MySQL, you will be prompted to enter the login password during installation.
Start MySQL Services service MySQL start
Download the MYSQL-JDBC package, I downloaded the mysql-connector-java-5.1.45.tar.gz, and then do the following:
2.2 Creating a hive User
Mysql-uroot-prootcreate user ' hive ' identified by ' Hive ', grant all privileges on *. * to ' hive ' @ ' localhost ' identified by ' Hive ';
2.3 Using a hive user to create a database named hive in MySQL
mysql-uhive-phivemysql> CREATE DATABASE hive;
3. Start Hive
$ start-dfs.sh
$ hive
There may be problems
This problem occurs because the metabase is not initialized and uses the command
Schematool-dbtype Mysql-initschema
Then use the command $ hive to successfully enter
Third, reference
1, http://dblab.xmu.edu.cn/blog/install-hive/
2, https://sjq597.github.io/2016/07/20/Ubuntu-16-04-Hive-%E6%9C%AC%E5%9C%B0%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/
Installation and configuration of hive under Ubuntu16.04