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/lib/hive
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_USER nohup hive --service metastore -hiveconf hive.log.file=hivemetastore.log >$HIVE_LOG_DIR/hive.out 2>$HIVE_LOG_DIR/hive.log &
Where
$HIVE_LOG_DIR
is the location of the Hive log directory, for example/var/log/hive/
Note You may receive the following error after running the
su
command:$HIVE_USER
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 inetc/passwd
:hive:x:493:493:Hive:/var/lib/hive:/sbin/nologin
This indicates that the
$HIVE_USER
is assigned to thesbin/nologin
shell, which blocks access. You can use the following command to assign the$HIVE_USER
to thebin/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
command.$HIVE_USER
Smoke Test Hive.
Open Hive command line shell.
hive
Run sample commands.
show databases; create table test(col1 int, col2 string); show tables;
Start HiveServer2.
su $HIVE_USER /usr/lib/hive/bin/hiveserver2 -hiveconf hive.metasture.uris=" " -hiveconf hive.log.file=hiveserver2.log >$HIVE_LOG_DIR/hiveserver2.out 2> $HIVE_LOG_DIR/hiveserver2.log &
Where
$HIVE_LOG_DIR
is the location of the Hive log directory, for example/var/log/hive/
Smoke Test HiveServer2.
Open Beeline command line shell to interact with HiveServer2.
/usr/lib/hive/bin/beeline
Establish connection to server.
!connect jdbc:hive2://$hive.server.full.hostname:10000 $HIVE_USER password org.apache.hive.jdbc.HiveDriver
Run sample commands.
show databases; create table test2(a int, b string); show tables;
where:
$HIVE_USER
is the user that owns the HIVE services. For example,hive
.$HIVE_LOG_DIR
is the directory for storing the Hive Server logs. This directory name is a combination of a directory and the$HIVE_USER
.