metatool 使用说明
usage: metatool-dryRun Perform a dry run ofupdateLocation changes.When runwith the dryRun optionupdateLocation changes aredisplayed but not persisted.dryRun is valid only with theupdateLocation option.-executeJDOQL <query-string> execute the given JDOQL query-help print this message-listFSRoot print the current FS rootlocations-prepareAcidUpgrade <find-compactions> Generates a set Compactioncommands to run to prepare forHive 2.x to 3.0 upgrade-serdePropKey <serde-prop-key> Specify the key for serdeproperty to be updated.serdePropKey option is validonly with updateLocation option.-tablePropKey <table-prop-key> Specify the key for tableproperty to be updated.tablePropKey option is validonly with updateLocation option.-updateLocation <new-loc> <old-loc> Update FS root location in themetastore to new location.Bothnew-loc and old-loc should bevalid URIs with valid host namesand schemes.When run with thedryRun option changes aredisplayed but are not persisted.When run with theserdepropKey/tablePropKey optionupdateLocation looks for theserde-prop-key/table-prop-keythat is specified and updatesits 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