Adding an Additional HiveServer2 to Your Cluster Manually
You must add the additional HiveServer2 to your cluster manually.
- 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
-
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:
-
If the new node is part of a cluster where Hadoop and HDFS have not been installed, use
the following command:
- Copy the following configuration files from your existing HS2 instance to the new HS2 instance:
- Under
/etc/hive/conf
, copy thehive-site.xml
file.For HDP version 2.2 and later, you must also copy the
hiveserver2-site.xml
file. - Under
/etc/hadoop/conf
, copy thecore-site.xml
,hdfs-site.xml
,mapred-site.xml
, andyarn-site.xml
files.
- Under
-
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, andmysql-connector-java.jar
is the database driver file for a MySQL database.NoteBefore HDP version 2.2.0, the database driver file for the Metastore database is located in the
/usr/lib
folder. - 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- 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 thehive.metastore.uris=" "
property to thehiveserver2-site.xml
file, it is not necessary to specify it on the command line when you start the service.
- If you are using HDP 2.1.15 and earlier, the HS2 service startup script is located in the
- Validate your installation by connecting to the new HS2 instance using Beeline.
- Open Beeline command-line shell to interact with HS2:
/usr/hdp/current/hive-server2/bin/beeline
- Establish a connection to HS2:
!connect jdbc:hive2://$hive.server.full.hostname:<port_number> $HIVE_USER password org.apache.hive.jdbc.HiveDriver
- 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. - Open Beeline command-line shell to interact with HS2: