EMR的外部蜂房Metastore

时间:2018-01-17 13:10:27

标签: mysql hadoop hive amazon-rds emr

我正在使用默认的hive元存储创建一个EMR集群,之后我将hive-site.xml覆盖了一些属性,这些属性将aws rds实例指向hive Metastore,一切都很好,但是在重启hive服务器之后,我无法使用RDS作为蜂巢样环。它仍然是由EMR创建的默认蜂巢式Metastore。

2 个答案:

答案 0 :(得分:5)

您可以通过在创建群集时为应用程序提供配置对象来覆盖应用程序的默认配置。配置对象被引用为JSON文件。配置对象由分类,属性和可选的嵌套配置组成。属性是您要在该文件中更改的设置。您可以在单个JSON对象中为多个应用程序指定多个分类。

要使用外部mysql Metastore信息覆盖hive-site.xml,请创建一个名为hiveConfiguration.json的配置文件,其中包含对hive-site.xml的编辑:

[
    {
      "Classification": "hive-site",
      "Properties": {
        "javax.jdo.option.ConnectionURL": "jdbc:mysql:\/\/hostname:3306\/hive?createDatabaseIfNotExist=true",
        "javax.jdo.option.ConnectionDriverName": "org.mariadb.jdbc.Driver",
        "javax.jdo.option.ConnectionUserName": "username",
        "javax.jdo.option.ConnectionPassword": "password"
      }
    }
]

使用hiveConfiguration.json和以下AWS CLI命令创建集群:

aws emr create-cluster --release-label emr-5.11.0 --instance-type m3.xlarge --instance-count 2 \
--applications Name=Hive --configurations ./hiveConfiguration.json --use-default-roles

参考:

https://docs.aws.amazon.com/emr/latest/ReleaseGuide/emr-hive-metastore-external.html

答案 1 :(得分:0)

为什么要重启Hive-server2?如果要更改hive.metastore。*等属性,则需要重新启动Hive Metastore守护程序,它在EMR上是Hcatalog的一部分。实际上,您可能不需要重新启动任何东西来更新Metastore数据库。您可以只运行离线schematool -initSchema指向新数据库。 见https://cwiki.apache.org/confluence/display/Hive/Hive+Schema+Tool