使用预览图像创建 dataproc 集群时无法启动 Cloud SQL Metastore

Failed to bring up Cloud SQL Metastore When create dataproc cluster using preview image

我正在使用 Spark 对某些数据进行一些计算,然后推送到 Hive。 Cloud Dataproc versions 是 1.2,包含 Hive 2.1。 Hive 中的 Merge 命令仅在 2.2 及更高版本中支持。所以我必须为 dataproc 集群使用预览版。当我将 1.2 版用于 dataproc 集群时,我可以毫无问题地创建集群。使用预览版时出现此错误“无法启动 Cloud SQL Metastore”。 初始化脚本是here。以前有没有人遇到过这个问题?

hive-metastore.service is not a native service, redirecting to systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install is-enabled hive-metastore
mysql.service is not a native service, redirecting to systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install disable mysql
insserv: warning: current start runlevel(s) (empty) of script `mysql` overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `mysql' overrides LSB defaults (0 1 6).
Created symlink /etc/systemd/system/multi-user.target.wants/cloud-sql-proxy.service → /usr/lib/systemd/system/cloud-sql-proxy.service.
Cloud SQL Proxy installation succeeded
hive-metastore.service is not a native service, redirecting to systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install is-enabled hive-metastore
[2018-06-06T12:43:55+0000]: Failed to bring up Cloud SQL Metastore

我认为问题可能是您的 Metastore 是从旧版本的 Dataproc 初始化的,因此具有过时的架构。

如果你有失败的集群(如果没有,请像以前一样创建一个新集群,你可以使用--single-node选项来降低成本),然后SSH到主节点并升级模式:

$ gcloud compute ssh my-cluster-m

$ /usr/lib/hive/bin/schematool -dbType mysql -info
Hive distribution version:       2.3.0
Metastore schema version:        2.1.0    <-- you will need this

org.apache.hadoop.hive.metastore.HiveMetaException: Metastore schema version is
not compatible. Hive Version: 2.3.0, Database Schema Version: 2.1.0
*** schemaTool failed ***

$ /usr/lib/hive/bin/schematool -dbType mysql -upgradeSchemaFrom 2.1.0

很遗憾,此集群无法恢复到 运行 状态,因此请删除并重新创建它。

我创建这个 PR 是为了让问题更容易被发现: https://github.com/GoogleCloudPlatform/dataproc-initialization-actions/pull/278