Adding an 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
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 For HDP-1.3.x, you must install HCatalog separately because HCatalog and Hive are not merged in that release.
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.
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.Note Before 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 theNote 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.
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.