All Products
Search
Document Center

Realtime Compute for Apache Flink:Manage Hive catalogs

Last Updated:Aug 06, 2026

After configuring a Hive catalog, you can directly read Hive metadata in the development console of Realtime Compute for Apache Flink without manually registering Hive tables. This improves job development efficiency and ensures data accuracy. This topic explains how to configure Hive metadata and create and use a Hive catalog.

Background

To configure a Hive catalog in the development console of Realtime Compute for Apache Flink, first store the Hive catalog configuration file and Hadoop dependencies in a specified directory in the Object Storage Service (OSS) console. After the Hive catalog is configured, you can use DML statements to create business logic and retrieve Hive table metadata directly in the development console, eliminating the need to use DDL statements to declare the tables. Hive catalog tables can serve as source or result tables for both streaming and batch deployments.

Realtime Compute for Apache Flink supports either a Hive metastore or Alibaba Cloud Data Lake Formation (DLF) as the metadata center for Hive catalogs. This topic describes the following operations for managing Hive catalogs:

Prerequisites

To use Hive MetaStore or Alibaba Cloud DLF as the metadata management center for a Hive Catalog, complete the following configurations:

  • Using Hive MetaStore as the metadata management center for a Hive Catalog

    Requirement

    Description

    Enable the Hive MetaStore service.

    Use the following commands:

    • To start the Hive MetaStore service: hive --service metastore

    • To check whether the Hive MetaStore service is enabled: netstat -ln | grep 9083

      The default port number for Hive MetaStore is 9083. If you configured a different port number in the hive-site.xml file, replace 9083 with the correct port number.

    Configure a whitelist on Hive MetaStore to allow access from Flink.

    To obtain the CIDR blocks for Flink, see Configure a whitelist. To configure the Hive MetaStore whitelist, see Add a security group rule.

  • Using Alibaba Cloud DLF as the metadata management center for a Hive Catalog

    Activate Alibaba Cloud DLF.

Limitations

  • Only self-managed Hive metastores are supported.

  • Only Ververica Runtime (VVR) 6.x supports Hive 1.x, 2.1.x, and 2.2.x, as support for these versions is deprecated in Apache Flink 1.16 and later.

  • If a Hive catalog uses Data Lake Formation (DLF) as its metastore, only Ververica Runtime (VVR) 8.0.6 or later supports creating non-Hive tables.

  • Only Ververica Runtime (VVR) 8.0.6 or later supports writing data to OSS-HDFS.

Configure Hive metadata

  1. Connect the Virtual Private Cloud (VPC) of the Hadoop cluster to the VPC of Realtime Compute for Apache Flink.

    Connect the VPCs using Alibaba Cloud DNS PrivateZone. For more information, see Resolver. Once the network is connected, Realtime Compute for Apache Flink uses the Hadoop cluster's configuration files to access it.

  2. A Hive catalog can use either Hive MetaStore or Data Lake Formation (DLF) for metadata management. The following sections describe the required configurations.

    Hive MetaStore

    Ensure the hive.metastore.uris parameter in the hive-site.xml configuration file is configured correctly.

    <property>
        <name>hive.metastore.uris</name>
        <value>thrift://xx.yy.zz.mm:9083</value>
        <description>Thrift URI for the remote metastore. Used by metastore client to connect to remote metastore.</description>
     </property>

    In the preceding example, xx.yy.zz.mm is the internal IP address or public IP address of the Hive MetaStore.

    Note

    If you set hive.metastore.uris to a hostname, you must configure a domain name resolution service. Otherwise, when the Flink development console remotely accesses Hive, the value of the hive.metastore.uris parameter cannot be resolved, and an UnknownHostException error is reported. For more information about how to configure a domain name resolution service, see Add a PrivateZone record.

    Data Lake Formation (DLF)

    To allow the Hive catalog to access DLF, add the following properties to the hive-site.xml configuration file.

    Note

    If your hive-site.xml file contains the dlf.catalog.akMode property, you must delete it. Otherwise, the Hive catalog cannot access DLF.

    <property>
      <name>hive.imetastoreclient.factory.class</name>
      <value>com.aliyun.datalake.metastore.hive2.DlfMetaStoreClientFactory</value>
    </property>
    <property>
      <name>dlf.catalog.uid</name>
      <value>${YOUR_DLF_CATALOG_UID}</value>
    </property>
    <property>
      <name>dlf.catalog.endpoint</name>
      <value>${YOUR_DLF_ENDPOINT}</value>
    </property>
    <property>
      <name>dlf.catalog.region</name>
      <value>${YOUR_DLF_CATALOG_REGION}</value>
    </property>
    <property>
      <name>dlf.catalog.accessKeyId</name>
      <value>${YOUR_ACCESS_KEY_ID}</value>
    </property>
    <property>
      <name>dlf.catalog.accessKeySecret</name>
      <value>${YOUR_ACCESS_KEY_SECRET}</value>
    </property>

    Parameter

    Description

    Remarks

    dlf.catalog.uid

    Your Alibaba Cloud account ID.

    For your account information, go to the User Information page.

    dlf.catalog.endpoint

    The DLF service endpoint.

    For more information, see Regions and endpoints.

    Note
    • We recommend that you set the dlf.catalog.endpoint parameter to the VPC endpoint of DLF. For example, if your selected region is China (Hangzhou), set the dlf.catalog.endpoint parameter to dlf-vpc.cn-hangzhou.aliyuncs.com.

    • To access DLF across VPCs, see How do I access services across VPCs?.

    dlf.catalog.region

    The region of the DLF service.

    For more information, see Regions and endpoints.

    Note

    Ensure this region matches the one specified in the dlf.catalog.endpoint parameter.

    dlf.catalog.accessKeyId

    Your Alibaba Cloud AccessKey ID.

    For more information, see Obtain an AccessKey pair.

    dlf.catalog.accessKeySecret

    Your Alibaba Cloud AccessKey secret.

    For more information, see Obtain an AccessKey pair.

  3. A Hive catalog can store tables in Object Storage Service (OSS) or the OSS-HDFS service. The following sections describe the required configurations.

    OSS

    To allow the Hive catalog to access OSS, add the following properties to the hive-site.xml configuration file.

    <property>
      <name>fs.oss.impl.disable.cache</name>
      <value>true</value>
    </property>
    <property>
      <name>fs.oss.impl</name>
      <value>org.apache.hadoop.fs.aliyun.oss.AliyunOSSFileSystem</value>
    </property>
    <property>
      <name>hive.metastore.warehouse.dir</name>
      <value>${YOUR_OSS_WAREHOUSE_DIR}</value>
    </property>
    <property>
      <name>fs.oss.endpoint</name>
      <value>${YOUR_OSS_ENDPOINT}</value>
    </property>
    <property>
      <name>fs.oss.accessKeyId</name>
      <value>${YOUR_ACCESS_KEY_ID}</value>
    </property>
    <property>
      <name>fs.oss.accessKeySecret</name>
      <value>${YOUR_ACCESS_KEY_SECRET}</value>
    </property>
    <property>
      <name>fs.defaultFS</name>
      <value>oss://${YOUR_OSS_BUCKET_DOMIN}</value>
    </property>

    The following table describes the parameters.

    Parameter

    Description

    Remarks

    hive.metastore.warehouse.dir

    The storage path for table data.

    fs.oss.endpoint

    The Object Storage Service (OSS) endpoint.

    For more information, see Regions and endpoints.

    fs.oss.accessKeyId

    Your Alibaba Cloud AccessKey ID.

    For more information, see Obtain an AccessKey pair.

    fs.oss.accessKeySecret

    Your Alibaba Cloud AccessKey secret.

    For more information, see Obtain an AccessKey pair.

    fs.defaultFS

    The default file system for table data.

    Specify your OSS bucket as the default file system. For example, oss://your-bucket-name.

    OSS-HDFS

    1. To allow the Hive catalog to access the OSS-HDFS service, add the following properties to the hive-site.xml configuration file.

      <property>
        <name>fs.jindo.impl</name>
        <value>com.aliyun.jindodata.jindo.JindoFileSystem</value>
      </property>
      <property>
        <name>hive.metastore.warehouse.dir</name>
        <value>${YOUR_OSS_WAREHOUSE_DIR}</value>
      </property>
      <property>
        <name>fs.oss.endpoint</name>
        <value>${YOUR_OSS_ENDPOINT}</value>
      </property>
      <property>
        <name>fs.oss.accessKeyId</name>
        <value>${YOUR_ACCESS_KEY_ID}</value>
      </property>
      <property>
        <name>fs.oss.accessKeySecret</name>
        <value>${YOUR_ACCESS_KEY_SECRET}</value>
      </property>
      <property>
        <name>fs.defaultFS</name>
        <value>oss://${YOUR_OSS_HDFS_BUCKET_DOMIN}</value>
      </property>

      Parameter

      Description

      Remarks

      hive.metastore.warehouse.dir

      The storage path for table data.

      fs.oss.endpoint

      The Object Storage Service (OSS) endpoint.

      For more information, see Regions and endpoints.

      fs.oss.accessKeyId

      Your Alibaba Cloud AccessKey ID.

      For more information, see Obtain an AccessKey pair.

      fs.oss.accessKeySecret

      Your Alibaba Cloud AccessKey secret.

      For more information, see Obtain an AccessKey pair.

      fs.defaultFS

      The default file system for table data.

      Specify your OSS bucket as the default file system. For example, oss://your-bucket-name.

    2. (Optional) To read Parquet-formatted Hive tables from the OSS-HDFS service, add the following parameters to the Realtime Compute for Apache Flink configuration file:

      fs.oss.jindo.accessKeyId: ${YOUR_ACCESS_KEY_ID}
      fs.oss.jindo.accessKeySecret: ${YOUR_ACCESS_KEY_SECRET}
      fs.oss.jindo.endpoint: ${YOUR_JINODO_ENDPOINT}
      fs.oss.jindo.buckets: ${YOUR_JINDO_BUCKETS}

      For more information about the parameters, see Write data to OSS-HDFS.

    Note

    If you use the fully managed storage feature of Realtime Compute for Apache Flink, you do not need to perform the following steps. You can proceed directly to Create a Hive catalog.

  4. In the OSS console, create directories and upload the Hive configuration files and Hadoop dependencies to the target paths.

    1. Log on to the OSS console.

    2. In the left-side navigation pane, click Buckets.

    3. Click the name of the target bucket.

    4. In the oss://${bucket}/artifacts/namespaces/${ns}/ path, create a directory named ${hms}.

      For more information about how to create a directory in the OSS console, see Create directories. The following table describes the variables in the path.

      Parameter

      Description

      ${bucket}

      The name of the bucket used by Realtime Compute for Apache Flink.

      ${ns}

      The workspace where you will use the Hive catalog.

      ${hms}

      We recommend using the same name as the Hive catalog you plan to create.

      Note

      After you activate a workspace, Realtime Compute for Apache Flink automatically creates the /artifacts/namespaces/${ns}/ directory in the specified bucket to store data such as JAR packages. If you do not find this directory in the OSS console, go to the Artifacts page in the development console and upload a file to trigger directory creation.

    5. In the oss://${bucket}/artifacts/namespaces/${ns}/${hms} path, create two directories: hive-conf-dir and hadoop-conf-dir. For more information, see Create directories.

      Store the following files in the hive-conf-dir and hadoop-conf-dir directories:

      • The oss://${bucket}/artifacts/namespaces/${ns}/${hms}/hive-conf-dir/ directory stores the Hive configuration file hive-site.xml.

      • The oss://${bucket}/artifacts/namespaces/${ns}/${hms}/hadoop-conf-dir/ directory stores Hadoop configuration files, including core-site.xml, hdfs-site.xml, yarn-site.xml, and mapred-site.xml.

      After creating the directories, you can view them and copy their OSS URLs on the Files page.

    6. Upload your Hive configuration file (hive-site.xml) to the hive-conf-dir directory. For more information, see Upload objects.

    7. Upload the following configuration files to the hadoop-conf-dir directory. For more information, see Upload objects.

      • core-site.xml

      • hdfs-site.xml

      • mapred-site.xml

      • Other files, such as compressed packages used by Hive jobs.

Create a Hive catalog

After you configure the Hive metadata, you can create a Hive catalog. You can create a catalog by using the UI or by running SQL commands. We recommend that you use the UI.

UI

  1. Go to the Catalogs page.

    1. Log on to the Realtime Compute for Apache Flink console. In the Actions column of the target workspace, click Console.

    2. In the left-side navigation pane, click Catalogs.

  2. Click Create Catalog. On the page that appears, select Hive and then click Next.

  3. Configure the parameters.

    Important

    You cannot modify the configuration parameters after creating the catalog. To make changes, you must drop the existing catalog and create a new one.

    Parameter

    Description

    Catalog name

    The name of the Hive catalog.

    hive-version

    The version of the Hive metastore.

    Realtime Compute for Apache Flink supports Hive versions 2.0.0 to 2.3.9 and 3.1.0 to 3.1.3. When you create a Hive catalog, set the hive-version parameter as follows:

    • For Hive 2.0.x and 2.1.x, set this parameter to 2.2.0.

    • For Hive 2.2.x, 2.3.x, and 3.1.x, set this parameter to 2.2.0, 2.3.6, and 3.1.2, respectively.

    default-database

    The name of the default database.

    hive-conf-dir

    • OSS: The directory where the Hive configuration files are stored. You must create the hive-conf-dir directory in advance. For more information, see Configure Hive metadata.

    • fully managed storage: Upload the corresponding files as prompted in the console.

    hadoop-conf-dir

    • OSS: The directory where the Hadoop dependencies are stored. You must create the hadoop-conf-dir directory in advance. For more information, see Configure Hive metadata.

    • fully managed storage: Upload the corresponding files as prompted in the console.

    hive-kerberos

    Enables Kerberos authentication. You need to configure the registered Kerberos cluster and principal. If you have not registered a Kerberos cluster, see Register a Kerberized Hive cluster.

  4. Click Confirm.

  5. In the Catalogs section on the left, view the created catalog.

SQL

  1. In the editor on the Scripts page, enter the following statement.

    CREATE CATALOG ${HMS Name} WITH (
        'type' = 'hive',
        'default-database' = 'default',
        'hive-version' = '<hive-version>',
        'hive-conf-dir' = '<hive-conf-dir>',
        'hadoop-conf-dir' = '<hadoop-conf-dir>'
    );

    Parameter

    Description

    ${HMS Name}

    The name of the Hive catalog.

    type

    The connector type. The value must be hive.

    default-database

    The name of the default database.

    hive-version

    The version of the Hive metastore.

    Realtime Compute for Apache Flink supports Hive versions 2.0.0 to 2.3.9 and 3.1.0 to 3.1.3. When you create a Hive catalog, set the hive-version parameter as follows:

    • For Hive 2.0.x and 2.1.x, set this parameter to 2.2.0.

    • For Hive 2.2.x, 2.3.x, and 3.1.x, set this parameter to 2.2.0, 2.3.6, and 3.1.2, respectively.

    hive-conf-dir

    The directory where the Hive configuration files are stored. You must create the hive-conf-dir directory in advance. For more information, see Configure Hive metadata.

    hadoop-conf-dir

    The directory where the Hadoop dependencies are stored. You must create the hadoop-conf-dir directory in advance. For more information, see Configure Hive metadata.

  2. Select the CREATE CATALOG statement and click Run to the left of the line numbers.

    After you configure the Hive catalog, you can reference its tables in your jobs as result tables and dimension tables without declaring them in DDL statements. The table name must be in the ${hive-catalog-name}.${hive-db-name}.${hive-table-name} format.

    To stop using the Hive catalog, see Drop a Hive catalog.

Use a Hive catalog

Create a Hive table

UI

  1. Go to the Catalogs page.

    1. Log on to the Realtime Compute for Apache Flink console. In the Actions column for the desired workspace, click Console.

    2. In the navigation pane on the left, click Catalogs.

  2. Find the desired catalog and click View in the Actions column.

  3. Find the desired database and click View in the Actions column.

  4. Click Create Table.

  5. On the Built-in tab, select a connector and click Next.

  6. Enter the CREATE TABLE statement and configure its parameters.

    CREATE TABLE `${catalog_name}`.`${db_name}`.`${table_name}` (
      id INT,
      name STRING
    ) WITH (
      'connector' = 'hive'
    );
  7. Click OK.

SQL commands

  1. In the Scripts editor, enter the following command:

    CREATE TABLE `${catalog_name}`.`${db_name}`.`${table_name}` (
      id INT,
      name STRING
    ) WITH (
      'connector' = 'hive'
    );
  2. Select the statement and click Run to the left of the line numbers.

Example:

-- Create the flink_hive_test table in the flinkhive database of the flinkexporthive catalog.
CREATE TABLE `flinkexporthive`.`flinkhive`.`flink_hive_test` (
  id INT,
  name STRING
) WITH (
  'connector' = 'hive'
);

Modify a Hive table

In the Scripts editor, enter the following commands.

-- Add a column to the Hive table.
ALTER TABLE `${catalog_name}`.`${db_name}`.`${table_name}` 
ADD column type-column;
-- Drop a column from the Hive table.
ALTER TABLE `${catalog_name}`.`${db_name}`.`${table_name}` 
DROP column;

Example:

-- Add the color column to the Hive table.
ALTER TABLE `flinkexporthive`.`flinkhive`.`flink_hive_test` 
ADD color STRING;
-- Drop the color column from the Hive table.
ALTER TABLE `flinkexporthive`.`flinkhive`.`flink_hive_test` 
DROP color;

Read data from a Hive table

INSERT INTO ${other_sink_table}
SELECT ...
FROM `${catalog_name}`.`${db_name}`.`${table_name}`;

Write data to a Hive table

INSERT INTO `${catalog_name}`.`${db_name}`.`${table_name}`
SELECT ... 
FROM ${other_source_table};

Drop a Hive table

UI

  1. Go to the Catalogs page.

    1. Log on to the Realtime Compute for Apache Flink console. In the Actions column for the desired workspace, click Console.

    2. In the navigation pane on the left, click Catalogs.

  2. In the Catalogs pane, expand the desired catalog and database, then click the table you want to drop.

  3. On the table details page, click Delete Table.

  4. In the confirmation dialog box, click OK.

SQL commands

In the Scripts editor, enter the following command:

-- Drop the Hive table.
DROP TABLE `${catalog_name}`.`${db_name}`.`${table_name}`;

Example:

-- Drop the Hive table.
DROP TABLE `flinkexporthive`.`flinkhive`.`flink_hive_test`;

View Hive catalog

  1. Go to the Catalogs page.

    1. Log in to the Realtime Compute for Apache Flink console.

    2. In the Actions column of the target workspace, click Console.

    3. Click Catalogs.

  2. On the Catalog List page, check the Name and Type columns.

    Note

    To view the databases and tables in a catalog, click View in the Actions column.

Delete a Hive catalog

Warning

Deleting a Hive catalog does not affect running deployments. However, it affects offline deployments or any that need to be paused and resumed. Please proceed with caution.

UI

  1. Navigate to the Catalog List page.

    1. Log in to the Realtime Compute for Apache Flink console, and in the Actions column of the target workspace, click Console.

    2. Click Catalogs.

  2. On the Catalog List page, find the catalog you want to delete and click Delete in the Actions column.

  3. In the confirmation dialog box, click Delete.

  4. In the Catalogs area on the left, verify that the catalog has been removed.

SQL command

  1. In the script editor, enter the following command.

    DROP CATALOG ${HMS Name};

    In this command, ${HMS Name} is the name of the Hive catalog to delete.

  2. Select the command, right-click, and then select Run.

  3. In the Catalogs area on the left, verify that the catalog has been removed.