高可用HDFS客户端python

问题描述

在 HDFSCLI 文档中,它说可以通过添加以分号 ; (https://hdfscli.readthedocs.io/en/latest/quickstart.html#configuration) 分隔的 URL 来配置它以连接到多个主机。 我使用 kerberos 客户端,这是我的代码 - from hdfs.ext.kerberos import KerberosClient hdfs_client = KerberosClient('http://host01:50070;http://host02:50070')

例如,当我尝试 makedir 时,出现以下错误 - requests.exceptions.InvalidURL: Failed to parse: http://host01:50070;http://host02:50070/webhdfs/v1/path/to/create

解决方法

显然我安装的 hdfs 版本很旧,代码不适用于 2.0.8 版,但它适用于 2.5.7