Configuring Fault Tolerance
Also available as:
PDF
loading table of contents...

Adding an Additional HiveServer2 to Your Cluster Manually

You must add the 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:
    1. 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
    2. 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:
  2. Copy the following configuration files from your existing HS2 instance to the new HS2 instance:
    1. 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.

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

    1. If you are using HDP 2.1.15 and earlier, the HS2 service startup script is located in the /usr/lib/hive/bin directory.
    2. 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.