更改 hdfs 中的节点

问题描述 投票:0回答:0

我们有将配置文件上传到 HDFS 的代码:

from hdfs import InsecureClient

def upload_file_to_hdfs(local_path, remote_path):
    client = InsecureClient(url='http://hdfs_server:50070', user='dr.who')
    try:
        ret = client.upload(remote_path, local_path)
    except Exception as e:
        logging.info(f'Error: {e}')
    print(f'File is uploaded: {local_path} -> {remote_path}')
    return ret

现在域名和端口都固定了。如果我们有一个节点被切换怎么办?

python hadoop hdfs
© www.soinside.com 2019 - 2024. All rights reserved.