Inceptor 的元数据库管理

  使用配置
内容纲要

概要描述


元数据库是用来记录存储在Hive中的数据的描述信息。 一般包含表名、表的列、分区、以及属性值、表的属性(内外表,表类型等)、表数据所在的目录; Hive默认的metastore是存储在derby中,数据存储目录不固定,数据库是跟着hive走的,不方便管理;所以TDH 中的Inceptor Metastore 配置了自己的数据库;
本案例简单介绍两种 Inceptor Metastore 的查看方式;
本案例环境:TDH 5.2.2、TDH 4.8.0

详细说明


TDH中的Inceptor将元数据存储到自己搭建的数据库中,在TDH 4.x版本中,inceptor元数据是以mysql数据库存储,在TDH 5.x版本中,inceptor是以 TXSQL 数据库存储元数据;两个版本下metastore的登录方式如下:

  • 4.x 版本中通过配置文件直接获取登录信息
  • 5.x 版本中通过查看 txsql 配置信息和 pod 的描述信息获取登录信息

操作步骤

  1. 获取登录信息
  2. 登录 Metastore

4.x 版本登录 Metastore

从 Inceptor 的配置信息中获取 Metastore 登录信息,对应的 Inceptor 配置文件为:/etc/inceptorsql1/conf/hive-site.xml
mysql 的连接 URL 中包含了登录主机名、metastore 端口、登录用户(user)、登录密码(password),如下图所示;

file

$ grep password /etc/inceptorsql1/conf/hive-site.xml -C 3
    
    
        javax.jdo.option.ConnectionPassword
        password
    
    
        hive.server2.enable.doAs
--
    
    
        hive.stats.dbconnectionstring
        jdbc:mysql://tdh-42:3306/metastore_inceptorsql1?createDatabaseIfNotExist=true&user=hiveuser&password=password&characterEncoding=UTF-8
    
    
        hive.security.authorization.enabled

使用该连接串中获取的信息 mysql -htdh-42 -P3306 -uhiveuser -ppassword,即可登录 Inceptor metastore 数据库,如下图所示,其中 metastore_inceptorsql1 库就是 inceptorsql 的 metastore 数据库:

file

$ mysql -htdh-42 -P3306 -uhiveuser -ppassword
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 1056
Server version: 5.5.44-MariaDB-log MariaDB Server
Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> show databases;
+------------------------+
| Database               |
+------------------------+
| information_schema     |
| metastore_inceptorsql1 |
| test                   |
+------------------------+
3 rows in set (0.00 sec)

MariaDB [(none)]> 

5.x 版本登录 Metastore

通过 TXSQL pod 里的工具进入 Inceptor Metastore ,对应的 pod 为 txsql-server 的 pod,用命令 kubectl get pods |grep txsql-server-txsql 获取 txsql-server 的 pod 信息
选择状态为 1/1 Running 的 txsql-server 的 pod,然后执行命令 kubectl exec -ti {pod-name} bash 进入该 pod 的终端,然后执行脚本 /usr/bin/txsql/tools/txsql.sh localshell即可登录 Metastore 的数据库,查看 metastore_inceptor1 库就是 inceptor 的 metastore 数据库;

file

$ kubectl exec -ti txsql-server-txsql1-3619959039-lcp6s bash
[root@tdh-03 /]# /usr/bin/txsql/tools/txsql.sh localshell
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2912696
Server version: 5.6.31-77.0-log Source distribution

Copyright (c) 2009-2016 Percona LLC and/or its affiliates
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+----------------------------+
| Database                   |
+----------------------------+
| information_schema         |
| metastore_inceptor1        |
| mysql                      |
| performance_schema         |
| tdt_transporter1           |
| test                       |
| tmp_txsql_function_test    |
+----------------------------+
7 rows in set (0.09 sec)

mysql>

至此两个版本下 Inceptor Metastore 的登录方式介绍完毕,可以通过 sql 查看数据库里面的表获取元数据信息。

这篇文章对您有帮助吗?

平均评分 0 / 5. 次数: 0

尚无评价,您可以第一个评哦!

非常抱歉,这篇文章对您没有帮助.

烦请您告诉我们您的建议与意见,以便我们改进,谢谢您。