GooseFS Table 管理能力用于管理结构化数据,为 SparkSQL、Hive、Presto 等上层计算应用提供数据库表管理能力,目前底层支持对接 Hive MetaStore。Table 管理能力能够帮助各类 SQL 引擎读取指定的数据内容,能够有效提升大数据场景下对数据的访问效率。
GooseFS Table 管理能力目前主要支持了以下特性:
GooseFS Table 管理能力通过 goosefs table 指令集实现,提供了 DB 的绑定和解绑、查询 DB 信息、查询表信息、数据加载、数据淘汰等能力。GooseFS Table 管理指令集如下所示:
$ goosefs table
Usage: goosefs table [generic options]
[attachdb [-o|--option <key=value>] [--db <goosefs db name>] [--ignore-sync-errors] <udb type> <udb connection uri> <udb db name>]
[detachdb <db name>]
[free <dbName> <tableName> [-p|--partition <partitionSpec>]]
[load <dbName> <tableName> [-g|--greedy] [--replication <num>] [-p|--partition <partitionSpec>]]
[ls [<db name> [<table name>]]]
[stat <dbName> <tableName>]
[sync <db name>]
上述指令集中各项指令的能力简述如下:
预热指定 Table 数据到 GooseFS 之前,需要将对应的 DB 挂载到 GooseFS 上。如下指令展示了将指定地址 metastore_host:port 中的数据库 goosefs_db_demo 挂载到 GooseFS 中,并将该 DB 在 GooseFS 中命名为 test_db:
$ goosefs table attachdb --db test_db hive thrift://metastore_host:port goosefs_db_demo
response of attachdb
注意:metastore_host:port 可以替换为任意合法可连接的 Hive MetaStore 地址。
绑定完数据库后,可以通过 ls 指令查看已挂载的 DB 和 Table 信息,如下指令展示了如何查询 test_db 中的 web_page 表信息:
$ goosefs table ls test_db web_page
OWNER: hadoop
DBNAME.TABLENAME: testdb.web_page (
wp_web_page_sk bigint,
wp_web_page_id string,
wp_rec_start_date string,
wp_rec_end_date string,
wp_creation_date_sk bigint,
wp_access_date_sk bigint,
wp_autogen_flag string,
wp_customer_sk bigint,
wp_url string,
wp_type string,
wp_char_count int,
wp_link_count int,
wp_image_count int,
wp_max_ad_count int,
)
PARTITIONED BY (
)
LOCATION (
gfs://metastore_host:port/myiNamespace/3000/web_page
)
PARTITION LIST (
{
partitionName: web_page
location: gfs://metastore_host:port/myNamespace/3000/web_page
}
)
预热 Table 的指令下发后会在后台发起一个异步作业,GooseFS 会在启动作业后返回一个作业 ID,可以通过 job stat <id>
指令查询任务的运行状态,同时可以通过 table stat
指令查看预热百分比。预热指令如下:
$ goosefs table load test_db web_page
Asynchronous job submitted successfully, jobId: 1615966078836
通过 job stat
指令可以查看预热 Table 作业的执行进度。当状态为 COMPLETED 时,整个预热过程完成,如果状态为 FAILED,可以在 master.log 文件中查看日志记录,排查预热错误的原因:
$ goosefs job stat 1615966078836
COMPLETED
当 Table 完成预热后,可以通过 stat 指令查看指定 Table 的概况。
$ goosefs table stat test_db web_page
detail
通过以下指令可以从 GooseFS 中释放指定 Table 数据缓存:
$ goosefs table free test_db web_page
detail
通过以下指令可以从 GooseFS 中卸载指定 DB:
$ goosefs table detachdb test_db
detail
本页内容是否解决了您的问题?