我正在尝试将python-ambariclient与 IBM Analytics Engine 一起使用:
$ pip install --quiet python-ambariclient
然后
from future.standard_library import install_aliases
install_aliases()
from urllib.parse import urlparse
import json
vcap = json.load(open('vcap.json'))
USER = vcap['cluster']['user']
PASSWORD = vcap['cluster']['password']
AMBARI_URL = vcap['cluster']['service_endpoints']['ambari_console']
CLUSTER_ID = vcap['cluster']['cluster_id']
url = urlparse(AMBARI_URL)
HOST = url.hostname
PORT = url.port
from ambariclient.client import Ambari
ambari = Ambari(HOST, port=PORT, username=USER, password=PASSWORD)
for cluster in ambari.clusters:
print('> ' + cluster.cluster_name)
但是,我遇到了连接问题:
ConnectionError: HTTPConnectionPool(host='XXXXXX.bi.services.us-south.bluemix.net', port=9443): 最大重试次数超过了 url: /api/v1/clusters (由 ProtocolError('Connection aborted.', RemoteDisconnected('远程结束关闭连接无响应',)))