获取hdfs 地址,连接阿里云hdfs

本地配置了阿里云的hdfs 地址
利用python pyspark连不上
报错
尝试找到正确的地址和端口号
hdfs getconf -confKey fs.default.name

# hdfs getconf -confKey fs.default.name
2020-06-17 14:59:51,762 INFO Configuration.deprecation: fs.default.name is deprecated. Instead, use fs.defaultFS
dfs://****.cn-beijing.dfs.aliyuncs.com:10290

归根结底
之前是端口错误

dirpath='dfs://******.cn-beijing.dfs.aliyuncs.com:10290/user/root/test/test.txt'
sc=spark.sparkContext
textFile = sc.textFile(dirpath)
textFile.first()
Out[16]:
'What is Big Data?'

你可能感兴趣的:(pyspark,hdfs)