Databricks CLI:SSLError,找不到本地颁发者证书

Jam*_*ams 8 python ssl databricks databricks-cli

我已经安装并配置了 Databricks CLI,但是当我尝试使用它时,我收到一条错误,表明它找不到本地颁发者证书:

$ dbfs ls dbfs:/databricks/cluster_init/
Error: SSLError: HTTPSConnectionPool(host='dbc-12345678-1234.cloud.databricks.com', port=443): Max retries exceeded with url: /api/2.0/dbfs/list?path=dbfs%3A%2Fda
tabricks%2Fcluster_init%2F (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer
 certificate (_ssl.c:1123)')))
Run Code Online (Sandbox Code Playgroud)

上述错误是否表明我需要安装证书,或者以某种方式配置我的环境,以便它知道如何找到正确的证书?

我的环境是带有 WSL 的 Windows 10 (Ubuntu 20.04)(上面的命令来自 WSL/Ubuntu 命令行)。

Databricks CLI 已安装到 Anaconda 环境中,包括以下证书和 SSL 包:

$ conda list | grep cert
ca-certificates           2020.6.20            hecda079_0    conda-forge
certifi                   2020.6.20        py38h32f6830_0    conda-forge
$ conda list | grep ssl
openssl                   1.1.1g               h516909a_1    conda-forge
pyopenssl                 19.1.0                     py_1    conda-forge
Run Code Online (Sandbox Code Playgroud)

当我尝试使用 REST API 时,出现类似的错误curl

$ curl -n -X GET https://dbc-12345678-1234.cloud.databricks.com/api/2.0/clusters/list
curl: (60) SSL certificate problem: unable to get local issuer certificate
More details here: https://curl.haxx.se/docs/sslcerts.html

curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.
Run Code Online (Sandbox Code Playgroud)

小智 11

此问题可以通过禁用 SSL 证书验证来解决。在 Databricks CLI 中,您可以通过insecure = True在 Databricks 配置文件中指定来执行此操作.databrickscfg

  • 这似乎可行,但这是一个热修复解决方案(禁用 SSL 永远不应该是一个持久的解决方案)。有谁知道如何添加 dbfs 考虑的根证书? (6认同)
  • 你不应该设置`insecure = True`吗?有趣的是,将其设置为 False 也有效:-)。不设置“不安全”会导致 SSL 错误。 (2认同)