Hive 1.1.0 的 schematool 元存储验证失败
schematool failing metastore validation for Hive 1.1.0
我刚刚部署了 Cloudera 5.12,并且正在安装 Hive。按照说明,我 运行
\i /usr/lib/hive/scripts/metastore/upgrade/postgres/hive-schema-1.1.0.postgres.sql
作为最后一步,创建 Metastore。当我 运行 schematool validation
schematool -dbType postgres -validate
我收到一个错误:
Validating metastore schema tables
Table(s) [ [compaction_queue, completed_txn_components, hive_locks, next_compaction_queue_id, next_lock_id, next_txn_id, txn_components, txns] ] are missing from the metastore database schema.
Failed in schema table validation.
[FAIL]
其他一切都很成功,我可以毫无问题地访问 Hive 数据库。我该如何解决这个错误?
我认为这是一个错误。这是我发现的:
$ find . -name "*.sql" -print |xargs grep compaction_queue
./postgres/hive-txn-schema-0.14.0.postgres.sql:CREATE TABLE "compaction_queue" (
./postgres/hive-txn-schema-0.14.0.postgres.sql:CREATE TABLE "next_compaction_queue_id" (
./postgres/hive-txn-schema-0.14.0.postgres.sql:INSERT INTO "next_compaction_queue_id" VALUES(1);
./postgres/hive-schema-0.14.0.postgres.sql:CREATE TABLE "compaction_queue" (
./postgres/hive-schema-0.14.0.postgres.sql:CREATE TABLE "next_compaction_queue_id" (
./postgres/hive-schema-0.14.0.postgres.sql:INSERT INTO "next_compaction_queue_id" VALUES(1);
如您所见,table next_compaction_queue_id
仅存在于 postgresql 的模式版本 0.14 中。它不存在于任何其他版本或任何其他数据库类型中。我不相信这些是用过的。如果您有 Cloudera 支持,请创建支持案例并请求支持创建 jira。
解决方法是在 hive-schema-0.14.0.postgres.sql
文件中找到缺少 table 的 CLAIMED 的 table 创建语句并添加这些语句tables 到您的 Hive Metastore 数据库。由于未使用它们,因此不会造成任何损害,但会消除您的 schematool 命令中的错误。
我使用 schematool
重新创建了 Hive Metastore。我必须首先使用 here:
中的信息将当前元存储删除到 postgreSQL
> su - postgres
> psql
REVOKE CONNECT ON DATABASE thedb FROM public;
SELECT pid, pg_terminate_backend(pid)
FROM pg_stat_activity
WHERE datname = current_database() AND pid <> pg_backend_pid();
drop metastore;
然后使用
重新创建
/usr/lib/hive/bin/schematool -dbType postgres -initSchema -verbose -userName hiveuser -passWord thepassword
之后验证有效:
> /usr/lib/hive/bin/schematool -dbType postgres -validate
Starting metastore validation
Validating schema version
Succeeded in schema version validation.
[SUCCESS]
Validating sequence number for SEQUENCE_TABLE
Succeeded in sequence number validation for SEQUENCE_TABLE.
[SUCCESS]
Validating metastore schema tables
Succeeded in schema table validation.
[SUCCESS]
Validating DFS locations
Succeeded in DFS location validation.
[SUCCESS]
Validating columns for incorrect NULL values.
Succeeded in column validation for incorrect NULL values.
[SUCCESS]
Done with metastore validation: [SUCCESS]
schemaTool completed
所以我认为如果有错误,那就是在 Metastore 创建步骤中:
\i /usr/lib/hive/scripts/metastore/upgrade/postgres/hive-schema-1.1.0.postgres.sql
我刚刚部署了 Cloudera 5.12,并且正在安装 Hive。按照说明,我 运行
\i /usr/lib/hive/scripts/metastore/upgrade/postgres/hive-schema-1.1.0.postgres.sql
作为最后一步,创建 Metastore。当我 运行 schematool validation
schematool -dbType postgres -validate
我收到一个错误:
Validating metastore schema tables
Table(s) [ [compaction_queue, completed_txn_components, hive_locks, next_compaction_queue_id, next_lock_id, next_txn_id, txn_components, txns] ] are missing from the metastore database schema.
Failed in schema table validation.
[FAIL]
其他一切都很成功,我可以毫无问题地访问 Hive 数据库。我该如何解决这个错误?
我认为这是一个错误。这是我发现的:
$ find . -name "*.sql" -print |xargs grep compaction_queue
./postgres/hive-txn-schema-0.14.0.postgres.sql:CREATE TABLE "compaction_queue" (
./postgres/hive-txn-schema-0.14.0.postgres.sql:CREATE TABLE "next_compaction_queue_id" (
./postgres/hive-txn-schema-0.14.0.postgres.sql:INSERT INTO "next_compaction_queue_id" VALUES(1);
./postgres/hive-schema-0.14.0.postgres.sql:CREATE TABLE "compaction_queue" (
./postgres/hive-schema-0.14.0.postgres.sql:CREATE TABLE "next_compaction_queue_id" (
./postgres/hive-schema-0.14.0.postgres.sql:INSERT INTO "next_compaction_queue_id" VALUES(1);
如您所见,table next_compaction_queue_id
仅存在于 postgresql 的模式版本 0.14 中。它不存在于任何其他版本或任何其他数据库类型中。我不相信这些是用过的。如果您有 Cloudera 支持,请创建支持案例并请求支持创建 jira。
解决方法是在 hive-schema-0.14.0.postgres.sql
文件中找到缺少 table 的 CLAIMED 的 table 创建语句并添加这些语句tables 到您的 Hive Metastore 数据库。由于未使用它们,因此不会造成任何损害,但会消除您的 schematool 命令中的错误。
我使用 schematool
重新创建了 Hive Metastore。我必须首先使用 here:
> su - postgres
> psql
REVOKE CONNECT ON DATABASE thedb FROM public;
SELECT pid, pg_terminate_backend(pid)
FROM pg_stat_activity
WHERE datname = current_database() AND pid <> pg_backend_pid();
drop metastore;
然后使用
重新创建/usr/lib/hive/bin/schematool -dbType postgres -initSchema -verbose -userName hiveuser -passWord thepassword
之后验证有效:
> /usr/lib/hive/bin/schematool -dbType postgres -validate
Starting metastore validation
Validating schema version
Succeeded in schema version validation.
[SUCCESS]
Validating sequence number for SEQUENCE_TABLE
Succeeded in sequence number validation for SEQUENCE_TABLE.
[SUCCESS]
Validating metastore schema tables
Succeeded in schema table validation.
[SUCCESS]
Validating DFS locations
Succeeded in DFS location validation.
[SUCCESS]
Validating columns for incorrect NULL values.
Succeeded in column validation for incorrect NULL values.
[SUCCESS]
Done with metastore validation: [SUCCESS]
schemaTool completed
所以我认为如果有错误,那就是在 Metastore 创建步骤中:
\i /usr/lib/hive/scripts/metastore/upgrade/postgres/hive-schema-1.1.0.postgres.sql