metatool 使用说明
usage: metatool
-dryRun Perform a dry run of
updateLocation changes.When run
with the dryRun option
updateLocation changes are
displayed but not persisted.
dryRun is valid only with the
updateLocation option.
-executeJDOQL <query-string> execute the given JDOQL query
-help print this message
-listFSRoot print the current FS root
locations
-prepareAcidUpgrade <find-compactions> Generates a set Compaction
commands to run to prepare for
Hive 2.x to 3.0 upgrade
-serdePropKey <serde-prop-key> Specify the key for serde
property to be updated.
serdePropKey option is valid
only with updateLocation option.
-tablePropKey <table-prop-key> Specify the key for table
property to be updated.
tablePropKey option is valid
only with updateLocation option.
-updateLocation <new-loc> <old-loc> Update FS root location in the
metastore to new location.Both
new-loc and old-loc should be
valid URIs with valid host names
and schemes.When run with the
dryRun option changes are
displayed but are not persisted.
When run with the
serdepropKey/tablePropKey option
updateLocation looks for the
serde-prop-key/table-prop-key
that is specified and updates
its value if found.
-listFSRoot
列出所有数据库的地址
metatool -listFSRoot
执行结果如下:
hdfs://master-e812d44:8020/warehouse/tablespace/managed/hive/sys.db
hdfs://master-e812d44:8020/warehouse/tablespace/managed/hive
hdfs://master-e812d44:8020/warehouse/tablespace/managed/hive/information_schema.db
hdfs://master-e812d44:8020/warehouse/tablespace/managed/hive/test.db
-updateLocation
更改存储位置
metatool -updateLocation hdfs://master-e812d44:8020 hdfs://master-e812d44:8020/hive/new-location
更新 DBS 和 SDS 数据表中关于位置的字段。
Looking for LOCATION_URI field in DBS table to update..
Successfully updated the following locations..
old location: hdfs://master-e812d44:8020/warehouse/tablespace/managed/hive/test.db new location: hdfs://master-e812d44:8020/warehouse/tablespace/managed/hive/test.db
-- 省略详细信息
Updated 4 records in DBS table
Looking for LOCATION field in SDS table to update..
Successfully updated the following locations..
-- 省略详细信息
Updated 43 records in SDS table