Creating a Hive Metastore Secret

This section describes how to create a secret with MySQL credentials in HPE Ezmeral Runtime Enterprise.

Prerequisites

  1. Running MySQL server and its endpoint and user credentials.

About this task

Create a secret with MySQL server credentials in HPE Ezmeral Runtime Enterprise.

Procedure

  1. Create an XML file containing username, password, service endpoint, and driver name.
  2. To create a secret, run the following command:
    kubectl create secret generic <hivemeta-secret-name> --from-file=hive-site.xml=<local-xml-file-name> -n <tenant-namespace>
    

Example

Example of a XML file name example.xml:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
  <property>
    <name>javax.jdo.option.ConnectionUserName</name>
    <value>user</value>
    <description>USERNAME-FOR-MYSQL-SERVER-CONNECTION</description>
  </property>
  <property>
    <name>javax.jdo.option.ConnectionPassword</name>
    <value>password</value>
    <description>PASSWORD-FOR-MYSQL-SERVER-CONNECTION</description>
  </property>
  <property>
    <name>javax.jdo.option.ConnectionURL</name>
    <value>jdbc:mysql://"SVC_NAME.POD_NAMESPACE.svc.DNS_DOMAIN":MYSQL_PORT/metastore_db?createDatabaseIfNotExist=true</value>
    <description>MYSQL-SERVICE-ENDPOINT-FOR-SERVER-CONNECTION</description>
  </property>
  <property>
    <name>javax.jdo.option.ConnectionDriverName</name>
    <value>com.mysql.cj.jdbc.Driver</value>
  </property>
</configuration>
To create a secret named hivemeta-secret using example.xml file in a sampletenant namespace, run the following command:
kubectl create secret generic hivemeta-secret  --from-file=hive-site.xml=example.xml -n sampletenant