Hadoop High Availability
Also available as:
PDF
loading table of contents...

Adding an Additional HiveServer2 to Your Cluster Manually

  1. Install Hive on the new node. For example, use one of the following commands in RHEL/CentOS/Oracle Linux environments:

    • If the new node is part of a cluster where Hadoop and HDFS have not been installed, use the following command:

      yum install hive-hcatalog hadoop hadoop-hdfs hadoop-libhdfs hadoop-yarn hadoop-mapreduce hadoop-client openssl

      For information about installing on other operating systems, see "Installing the Hive-HCatalog Package" and "Install the Hadoop Packages" in the Non-Ambari Cluster Installation Guide.

    • If the new node is part of a cluster where Hadoop and HDFS are installed, you need only install the hive-hcatalog package. For example, in RHEL/CentOS/Oracle Linux environments use the following command:

      yum install hive-hcatalog

      For information about installing on other operating systems, see "Installing the Hive-HCatalog Package" in the Non-Ambari Cluster Installation Guide.

    [Note]Note

    For HDP-1.3.x, you must install HCatalog separately because HCatalog and Hive are not merged in that release.

  2. Copy the following configuration files from your existing HS2 instance to the new HS2 instance:

    • Under /etc/hive/conf, copy the hive-site.xml file.

      For HDP version 2.2 and later, you must also copy the hiveserver2-site.xml file.

    • Under /etc/hadoop/conf, copy the core-site.xml, hdfs-site.xml, mapred-site.xml, and yarn-site.xml files.

  3. Copy the database driver file for the metastore database from the /usr/hdp/current/hive-server2/lib folder of the existing HS2 instance to the /usr/hdp/current/hive-server2/lib folder of the new instance. For example, postgresql-jdbc.jar is the database driver file for a PostgreSQL database, and mysql-connector-java.jar is the database driver file for a MySQL database.

    [Note]Note

    Before HDP version 2.2.0, the database driver file for the metastore database is located in the /usr/lib folder.

  4. Start the HS2 service:

    su $HIVE_USER
    /usr/lib/hive/bin/hiveserver2 -hiveconf hive.metastore.uris=" "
    -hiveconf hive.log.file=hiveserver2.log
    >$HIVE_LOG_DIR/hiveserver2.out 2
    >$HIVE_LOG_DIR/hiveserver2.log &

    If you are using HDP 2.1.15 and earlier, the HS2 service startup script is located in the /usr/lib/hive/bin directory. For more information about starting the HS2 service, see the

    [Note]Note
    • If you are using HDP 2.1.15 and earlier, the HS2 service startup script is located in the /usr/lib/hive/bin directory.

    • Specifying –hiveconf hive.metastore.uris=" " when you start the HS2 service causes HS2 to use an embedded metastore, which improves the performance when HS2 retrieves data from the back-end data store (RDBMS). If you are using HDP 2.3.0 or later and have added the hive.metastore.uris=" " property to the hiveserver2-site.xml file, it is not necessary to specify it on the command line when you start the service.

  5. Validate your installation by connecting to the new HS2 instance using Beeline.

    1. Open Beeline command-line shell to interact with HS2:

      /usr/hdp/current/hive-server2/bin/beeline
    2. Establish a connection to HS2:

      !connect jdbc:hive2://$hive.server.full.hostname:<port_number> $HIVE_USER password org.apache.hive.jdbc.HiveDriver
    3. Run sample commands:

      show databases;
      create table test2(a int, b string);
      show tables;

    This completes the manual installation of an additional HiveServer2 on a cluster.