Python 如何将文件从本地笔记本电脑放到远程HDFS?
我有Hadoop 2.8.1 已配置的hdfs-site.xmlPython 如何将文件从本地笔记本电脑放到远程HDFS?,python,hadoop,hdfs,Python,Hadoop,Hdfs,我有Hadoop 2.8.1 已配置的hdfs-site.xml <configuration> # Add the following inside the configuration tag <property> <name>dfs.data.dir</name> <value>/app/dfs/name/data</value> <final>true<
<configuration>
# Add the following inside the configuration tag
<property>
<name>dfs.data.dir</name>
<value>/app/dfs/name/data</value>
<final>true</final>
</property>
<property>
<name>dfs.name.dir</name>
<value>/app/dfs/name</value>
<final>true</final>
</property>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
<property>
<name>dfs.webhdfs.enabled</name>
<value>true</value>
</property>
</configuration>
这种变体有效。
但我想把已经准备好的文件放到远程HDFS
试图写作
with open("C:\\Downloads\\Demographic_Statistics_By_Zip_Code.csv") as file_data:
print(file_data)
但文件并没有放到HDFS中。
只返回
<_io.TextIOWrapper name='C:\\Downloads\\Demographic_Statistics_By_Zip_Code.csv' mode='r' encoding='cp1251'>
如何解决此问题?使用hdfs cli如何?
请参阅此链接中的copyFromLocal或put命令:
使用hdfs cli怎么样?
请参阅此链接中的copyFromLocal或put命令:
<_io.TextIOWrapper name='C:\\Downloads\\Demographic_Statistics_By_Zip_Code.csv' mode='r' encoding='cp1251'>