配置单元CLI和配置单元Server2 Metastore不一致



我正在尝试修改现有的Azure HDInsight集群,以指向现有的配置单元元存储(托管在MSSQL实例上)。我在hive-site.xml中更改了以下参数,以指向现有的Metastore:

"javax.jdo.option.ConnectionDriverName" : "com.microsoft.sqlserver.jdbc.SQLServerDriver", 
"javax.jdo.option.ConnectionUserName" : "<<user>>",     
"javax.jdo.option.ConnectionPassword" : "<<password>>",   
"javax.jdo.option.ConnectionURL" : "jdbc:sqlserver://<<server>>.database.windows.net:1433;database=HiveMetaStoreEast;user=<<user>>;password=<<password>>;encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30;" 

似乎起到了一定的作用,因为我可以通过Beeline访问Hive CLI和Hiveserver2。奇怪的是,show databases;根据所使用的客户端输出不同的结果。我读到启动配置单元0.14(我正在运行)时,使用hiveserver2-site.xml等配置单元/Hiveserver2可以使用更细粒度的配置。我曾尝试在hiveserver2-site.xml中设置hive.metastore.uris参数以匹配它在hive-site.xml中显示的内容,但仍然得到了同样奇怪的结果。

总之,如何确定配置单元Server2和配置单元CLI进程指向相同(且正确)的Metastore URI?

发布这篇文章后,我在Hortonworks网站上发现了一个类似的帖子:http://hortonworks.com/community/forums/topic/configuration-of-hiveserver2-to-use-a-remote-metastore-server/#post-81960

似乎位于此处(在我的配置单元节点上)的startHiveserver2.sh.j2启动脚本/var/lib/ambari-agent/cache/common-services/HIVE/0.12.0.2.0/package/templates/包含hive.metastore.uris参数的空字符串CLI覆盖,我认为这会迫使配置单元Server2以本地元存储模式启动,从而在配置单元CLI(使用远程URI)和Beeline(使用本地)之间创建不一致的视图。

请参阅以下解决不一致的补丁:

--- startHiveserver2.sh.j2  2015-11-25 04:06:15.357996439 +0000
+++ /var/lib/ambari-server/resources/common-services/HIVE/0.12.0.2.0/package/templates/startHiveserver2.sh.j2   2015-11-25 03:43:29.837452851 +0000
@@ -20,5 +20,6 @@
#
HIVE_SERVER2_OPTS=" -hiveconf hive.log.file=hiveserver2.log -hiveconf hive.log.dir=$5"
-HIVE_CONF_DIR=$4 {{hive_bin}}/hiveserver2 -hiveconf hive.metastore.uris=" " ${HIVE_SERVER2_OPTS} > $1 2> $2 &
+#HIVE_CONF_DIR=$4 {{hive_bin}}/hiveserver2 -hiveconf hive.metastore.uris=" " ${HIVE_SERVER2_OPTS} > $1 2> $2 &
+HIVE_CONF_DIR=$4 {{hive_bin}}/hiveserver2 ${HIVE_SERVER2_OPTS} > $1 2> $2 &
echo $!|cat>$3

最新更新