Validating the Installation
Use the following steps to validate your installation:
Initialize the Hive Metastore database schema:
$HIVE_HOME/bin/schematool -initSchema -dbType $databaseType
The value for $databaseType can be derby, mysql, oracle, mssql, or postgres.
$HIVE_HOME is by default configured to usr/hdp/current/hive.
Turn off autocreation of schemas. Edit hive-site.xml to set the value of datanucleus.autoCreateSchema to false:
<property> <name>datanucleus.autoCreateSchema</name> <value>false</value> <description>Creates necessary schema on a startup if one doesn't exist</ description> </property>
Start the Hive Metastore service.
su - hive nohup /usr/hdp/current/hive-metastore/bin/hive --service metastore>/var/log/hive/hive.out 2>/var/log/hive/hive.log &
Note You may receive the following error after running the
su - hive
command:su hive This account is currently not available.
If you get this error, you may need to reassign the $HIVE_USER shell. You can confirm this by looking for the following line in etc/passwd:
hive:x:493:493:Hive:/var/lib/hive:/sbin/nologin63
This indicates that the $HIVE_USER is assigned to the sbin/nologin shell, which blocks access. You can use the following command to assign the $HIVE_USER to the bin/bash shell.
sudo chsh -s /bin/bash hive
This command should return the following:
Changing shell for hive. Shell changed.
You should then be able to successfully run the su $HIVE_USER command.
Smoke test Hive.
Open Hive command line shell by entering the following in a terminal window:
hive
Run sample commands:
show databases;create table test(col1 int, col2 string); show tables;
Start HiveServer2:
su - hive /usr/hdp/current/hive-server2/bin/hiveserver2 >/var/log/hive/hiveserver2.out 2> /var/log/hive/hiveserver2.log &
Smoke test HiveServer2:
Open Beeline command line shell to interact with HiveServer2:
/usr/hdp/current/hive/bin/beeline
Establish connection to server:
!connect jdbc:hive2://$hive.server.full.hostname:10000 $HIVE_USERpassword org.apache.hive.jdbc.HiveDriver
Run sample commands:
show databases; create table test2(a int, b string); show tables;