5. Validate the Installation

Use the following steps to validate your installation:

  1. 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

  2. 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>
        
  3. 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]Note

    You may receive the following error after running the su $HIVE_USER 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/nologin

    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.

  4. Smoke Test Hive.

    1. Open Hive command line shell.

      hive
    2. Run sample commands.

      show databases;
      create table test(col1 int, col2 string);
      show tables;
  5. 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/

  6. Smoke Test HiveServer2.

    1. Open Beeline command line shell to interact with HiveServer2.

      /usr/lib/hive/bin/beeline
    2. Establish connection to server.

      !connect jdbc:hive2://$hive.server.full.hostname:10000 $HIVE_USER password org.apache.hive.jdbc.HiveDriver
    3. 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.


loading table of contents...