Код Python:
Код: Выделить всё
from hdfs import InsecureClient
hdfs_url = "http://ec2-54-253-105-121.ap-southeast-2.compute.amazonaws.com:9870"
hdfs_user = "hdfs"
local_file_path = "/content/drive/My Drive/Algotest/NSE_NIFTY_1m.csv"
hdfs_destination = "/div/NSE_NIFTY_1m.csv" # Destination path in HDFS
# Create the HDFS client
hdfs_client = InsecureClient(hdfs_url, user=hdfs_user)
# Upload the file to HDFS
try:
hdfs_client.upload(hdfs_destination, local_file_path)
print("File uploaded successfully.")
except Exception as e:
print("Error:", e)
Код: Выделить всё
requests.exceptions.ConnectionError: HTTPConnectionPool(host='ip-172-31-12-191.ap-southeast-2.compute.internal', port=9864): Max retries exceeded with url: /webhdfs/v1/div/NSE_NIFTY_1m.csv?op=CREATE&user.name=hdfs&namenoderpcaddress=ip-172-31-12-150.ap-southeast-2.compute.internal:8020&createflag=&createparent=true&overwrite=false&user.name=hdfs (Caused by NameResolutionError(": Failed to resolve 'ip-172-31-12-191.ap-southeast-2.compute.internal' ([Errno -2] Name or service not known)"))
Error: HTTPConnectionPool(host='ip-172-31-12-191.ap-southeast-2.compute.internal', port=9864): Max retries exceeded with url: /webhdfs/v1/div/NSE_NIFTY_1m.csv?op=CREATE&user.name=hdfs&namenoderpcaddress=ip-172-31-12-150.ap-southeast-2.compute.internal:8020&createflag=&createparent=true&overwrite=false&user.name=hdfs (Caused by NameResolutionError(": Failed to resolve 'ip-172-31-12-191.ap-southeast-2.compute.internal' ([Errno -2] Name or service not known)"))
Ссылка на ссылку: https://github.com/cloudera/impyla/issu ... t-72324276
Подробнее здесь: https://stackoverflow.com/questions/785 ... python-lib