简体   繁体   English

如何通过Spark即服务笔记本连接到在BigInsights on Cloud上运行的远程配置单元?

[英]How to connect to remote hive running on BigInsights on Cloud from a Spark as a Service notebook?

I would like to connect to a hive service running on BigInsights from a spark notebook using jdbc. 我想使用jdbc从Spark笔记本连接到在BigInsights上运行的配置单元服务。 The jdbc url format is: jdbc网址格式为:

jdbc:hive2://${env.hostname}:10000/default;ssl=true;sslTrustStore=./truststore.jks;trustStorePassword=mypassword;

As you can see from the url, this connection requires a truststore. 从url中可以看到,此连接需要一个信任库。 How should I make the truststore available to spark as a service? 我应该如何使信任库可用于火花即服务?

Update 1: 更新1:

  • The certificate is not issued by a well known CA. 该证书不是由众所周知的CA颁发的。
  • Tenants have no access to the JRE/JDK on the service. 租户无法访问该服务上的JRE / JDK。

Update 2: 更新2:

I can add the certificate and truststore using the following: 我可以使用以下方法添加证书和信任库:

with open('certificate', 'w') as f:
    f.write('''
-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----
''')

!keytool -import -trustcacerts -alias biginsights -file certificate -keystore truststore.jks -storepass mypassword -noprompt

The final part of the question now is how to add a jar to python notebook on bluemix spark? 现在问题的最后一部分是如何在bluemix spark上向python笔记本添加一个jar?

Here is one of the may be odd way around(Not tried):- 这是一种可能很奇怪的方法之一(未尝试):

In Notebook, If you are already not in python shell, then switch to python shell and then if you have your truststore available to be downloaded from URL , you can download it this way and run cell:- !wget 在Notebook中,如果您尚未使用python shell,请切换到python shell,然后如果可以从URL下载信任库,则可以通过这种方式下载并运行cell:-!wget

if biginsights server lets you use SSH to access the keystore, use !scp to download the truststore. 如果biginsights服务器允许您使用SSH访问密钥库,请使用!scp下载信任库。

Once downloaded, i would suggest try to use !pwd which will give you path /gpfs/fs01/user/s027-20bcfe6e4297e8-2c631c8ff999/notebook/notebooks 下载后,我建议尝试使用!pwd,它会为您提供路径/ gpfs​​ / fs01 / user / s027-20bcfe6e4297e8-2c631c8ff999 / notebook / notebooks

If you do !ls, you can see your downloaded trustore file. 如果您这样做,则可以看到已下载的trustore文件。 See if you can give the FULL Absolute path to trustore in JDBC URL. 看看是否可以在JDBC URL中提供FULL Absolute路径来信任。

Thanks, Charles. 谢谢,查尔斯。

First find out if the SSL certificate is issued by a "well-known" CA authority. 首先确定SSL证书是否由“知名” CA机构颁发。 By "well-known", I meant those CA authorities whose signing certificates are already included in the jdk truststore. “知名”是指那些签名证书已包含在jdk信任库中的CA权威。 If yes, find out from the jdk documentation the location and name of the truststore and provided that in the sslTrustStore parameter. 如果是,请从jdk文档中找到信任库的位置和名称,并在sslTrustStore参数中提供。 If no, then has to download the cert, add to a truststore and upload the truststore to a location accessible by spark as a service. 如果否,则必须下载证书,将其添加到信任库,然后将信任库上载到Spark即服务可访问的位置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何通过身份验证从火花连接远程配置单元 - How to connect remote hive from spark with authentication Spark 连接到本地 Hive 而不是远程 - Spark connect to local Hive and not to remote 本地 spark 连接到远程 hive 和 hadoop - Local spark connect to to remote hive and hadoop 如何在没有 hive-site.xml 的情况下将 Spark SQL 连接到远程 Hive 元存储(通过节俭协议)? - How to connect Spark SQL to remote Hive metastore (via thrift protocol) with no hive-site.xml? 如何将在Intellij中运行的Spark作业连接到本地MySQL Hive Metastore? - How to connect Spark job running in Intellij to the local mysql hive metastore? 如何使用Spark Scala从IntelliJ IDEA连接到Virtual Box中的Hive - How to connect to Hive in Virtual Box from IntelliJ IDEA with Spark Scala 在远程集群上从 Spark 运行 hive 查询时,客户端无法通过以下方式进行身份验证:[TOKEN,KERBEROS] - Client cannot authenticate via: [TOKEN, KERBEROS] when running hive query from Spark on a remote cluster 如何从本地运行的Spark Shell连接到Spark EMR - How to connect to Spark EMR from the locally running Spark Shell 从本地 jupyter notebook 连接到 spark 集群 - Connect to spark cluster from local jupyter notebook 如何在 IntelliJ 上使用 Scala 从 Spark 连接到 Hive? - How do I connect to Hive from spark using Scala on IntelliJ?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM