• Home
  • Docker
  • Kubernetes
  • Java
  • Ubuntu
  • Maven
  • Big Data
  • CI
  • Install
  • Samples
  • Archived
Big Data | Install and configure Apache Hive (HiveServer, Hive MetaStore)
  1. References
  2. Create "hive" user
  3. Install Hive
  4. Create "warehouse" directory in hdfs
  5. Create Hive metastore database (PostgreSQL)
  6. Switch to "hive" user
  7. Update "~/.profile" file
  8. Configure "${HIVE_HOME}/conf/hive-site.xml"
  9. Configure "${HIVE_HOME}/bin/hive-config.sh"
  10. Create Hive schema (PostgreSQL)
  11. Start HiveServer
  12. Hive Ports/Web UIs
  13. HiveServer: status, log files
  14. Start Hive MetaStore
  15. Hive MetaStore: status, log files
  16. Launch Hive console
  17. Beeline – Command Line Shell

  1. References
    See these pages for more details about Apache Hive:
    https://cwiki.apache.org/confluence/display/Hive/GettingStarted
    https://cwiki.apache.org/confluence/display/Hive/LanguageManual
    https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF

    See these pages for more details about Apache Hadoop, PostgreSQL, MySQL installation:
    Install Apache Hadoop
    Install PostgreSQL (database)
    Install MySQL (database)
  2. Create "hive" user
  3. Install Hive
    Download Apache Hive: https://hive.apache.org/downloads.html

    Extract the file "apache-hive-3.1.2-bin.tar.gz" in the folder you want to install Hive: e.g. '/opt/apache-hive-3.1.2-bin'

    Note: In the following sections, the environment variable ${HIVE_HOME} will refer to this location '/opt/apache-hive-3.1.2-bin'
  4. Create "warehouse" directory in hdfs
  5. Create Hive metastore database (PostgreSQL)
    Create postgresql database "hivemetastoredb".
  6. Switch to "hive" user
  7. Update "~/.profile" file

    Load ".profile" environment variables:
  8. Configure "${HIVE_HOME}/conf/hive-site.xml"
    Note: Use this config if you are using PostgreSQL metastore:

    Note: If you are using MySQL metastore, then use these MySQL connection properties:
  9. Configure "${HIVE_HOME}/bin/hive-config.sh"
    Edit file "hive-config.sh" and export "HADOOP_HOME" environment variable.
  10. Create Hive schema (PostgreSQL)
    Create Hive schema.
    Note: You might get this error:
    Please see:
    https://issues.apache.org/jira/browse/HIVE-22915
    https://issues.apache.org/jira/browse/HIVE-22718

    To fix the issue, find guava installed with hadoop and hive:


    Replace Hive's guava-19.0.jar with Hadoop's guava-27.0-jre.jar:

    Note: To create Hive metastore database with MySQL:
  11. Start HiveServer

    Execute "hiveserver2":

    Execute "hive" to run hiveserver2 service:

    Start HiveServer using custom parameters:

    Check "nohup.out" file:
  12. Hive Ports/Web UIs
    Ports Used by Hive:
    ► HiveServer web UI: http://localhost:10002

    hive-web-ui
  13. HiveServer: status, log files
    Hive process info:
    • Java virtual machine process status tool: jps

    • Display process info: ps -fp <pid> | less

    Hive log files:
    • Hive log files can be found in "/tmp/hive/hive.log"
    • Hive jetty web app in "/tmp/jetty*"


  14. Start Hive MetaStore

    Start Hive MetaStore:
    Check "nohup.out" file:
  15. Hive MetaStore: status, log files
    Hive MetaStore process info:
    • Java virtual machine process status tool: jps

    • Display process info: ps -fp <pid> | less

    • Display process info: ps -aef | grep -i org.apache.hadoop.hive.metastore.HiveMetaStore

    • Display process info: lsof -i:9083
      See "hive.metastore.port" property setup in "${HIVE_HOME}/conf/hive-site.xml" (9083).

    • Telnet Hive MetaStore server: telnet localhost 9083

    Hive MetaStore log files:
    • Hive MetaStore log files can be found in "/tmp/hive/hive.log"
  16. Launch Hive console

    Launch Hive console using custom parameters:
    Use the command exit; to quit Hive console.

    Print Hive help:
    Some Hive commands:
    Using Hive commands from Linux Shell:
    Listing data of Hive HDFS directories:
  17. Beeline – Command Line Shell
    See this page for more details about Beeline:
    https://cwiki.apache.org/confluence/display/Hive/HiveServer2+Clients

    Launch Beeline:
    Use the command !exit to quit Beeline.

    Connect to Hive:

    You might get an error when you connect as hive user (you might get the same error with another user):

    To fix this error, you have to edit the file ${HADOOP_HOME}/etc/hadoop/core-site.xml and add the following:

    You should be able to connect to the Hive after applying the changes and restarting Hadoop:

    To connect directly to a specific database:

    Show Tables:
© 2025  mtitek