Post-Upgrade Steps for Hive

Complete the following steps after you upgrade Hive with or without the MapR Installer.

  1. Migrate Hive Configuration.
    Migrate any custom configuration settings into the new default files in the /opt/mapr/hive/hive-<version>/conf/ directory.
  2. Update the Hive Metastore.
    For upgrades from old version of Hive to new version, run the schematool command with the -upgradeSchema option.
    /opt/mapr/hive/hive-<version>/bin/schematool -dbType <metastore_database> -upgradeSchema
    For example, for upgrades from Hive 1.2 to 2.1 on MySql, run the following command:
    /opt/mapr/hive/hive-2.1/bin/schematool -dbType mysql -upgradeSchema
    Note: Review and, if necessary, perform the steps described in Troubleshooting before running this command.
  3. Run configure.sh. If you installed the mapr-hivewebhcat package, run configure.sh with the -R option on the node where you installed the mapr-hivewebhcat package.
    /opt/mapr/server/configure.sh -R
    This step enables Warden to recognize the newly installed service.
  4. Restart Hive Services.
    1. Make a list of nodes on which Hive Metastore and HiveServer2 Services are configured.
    2. Issue the maprcli node services command, specifying the nodes on which the Hive services are configured.
      maprcli node services -name hivemeta -action restart -nodes <space delimited list of nodes>
      maprcli node services -name hs2 -action restart -nodes <space delimited list of nodes>
  5. Verify that the metastore database update completed successfully. For example, use these diagnostic tests:
    • Run the show tables command in Hive and make sure it returns a complete list of all your Hive tables.
    • Perform simple SELECT operations on Hive tables that existed before the upgrade.
    • Perform filtered SELECT operations on Hive tables that existed before the upgrade.

Troubleshooting

Inconsistencies in the underlying database after creating tables with datanucleus.schema.autoCreateAll property.

The datanucleus.schema.autoCreateAll property creates tables gradually. After creating tables using this property, if you upgrade to Hive 2.1 using schematool, the schematool command will not be able to verify all the necessary tables because all the necessary tables were not created by the datanucleus.schema.autoCreateAll property.

Perform the following steps as a precondition.

  1. Determine the version from which you are upgrading.
  2. Start MySQL.
    mysql -u<user> -p<password> 
  3. Run the following commands in MYSQL command line. For upgrade from:
    • Hive 0.13:
      USE metastore;
      SOURCE /opt/mapr/hive/hive-2.1/scripts/metastore/upgrade/mysql/hive-schema-0.13.0.mysql.sql; 
    • Hive 1.0:
      USE metastore; 
      SOURCE /opt/mapr/hive/hive-2.1/scripts/metastore/upgrade/mysql/hive-schema-0.14.0.mysql.sql; 
    • Hive 1.2:
      USE metastore; 
      SOURCE /opt/mapr/hive/hive-2.1/scripts/metastore/upgrade/mysql/hive-schema-1.2.0.mysql.sql;
      SOURCE /opt/mapr/hive/hive-2.1/scripts/metastore/upgrade/mysql/hive-txn-schema-0.13.0.mysql.sql; 
    Running SOURCE for the version before the upgrade makes the underlying database consistent for running schematool command with the -upgradeSchema option.