如何在pywebhfds中传递连接错误?

t3irkdon  于 2021-05-31  发布在  Hadoop
关注(0)|答案(1)|浏览(276)

我有一个本地单节点托管的hadoop。我的名字和datanode是一样的。
我正在尝试使用python库创建一个文件。

self.hdfs = PyWebHdfsClient(host='192.168.231.130', port='9870', user_name='kush',
                                    base_uri_pattern="http://192.168.231.130:9870/webhdfs/v1/", timeout=1)
        if not self.hdfs.exists_file_dir(path):
            self.hdfs.make_dir(path)
error-->self.hdfs.create_file("{}/results_{}.csv".format(path, name),
                              'word,negative,neutral,positive,compound\n')

文件存在并使目录正常工作。但是我的create文件一直抛出一个错误我得到的例外是:

requests.exceptions.ConnectionError: HTTPConnectionPool(host='kush', port=9864): Max retries exceeded with url: /webhdfs/v1/user/kush/data/results_4104.csv?op=CREATE&user.name=kush&namenoderpcaddress=192.168.231.130:9000&createflag=&createparent=true&overwrite=false (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000001F8C3FB1C40>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))

我已经允许9000、9870和9864使用防火墙。提前谢谢。我们将不胜感激

uz75evzq

uz75evzq1#

显然我只需要在/etc/hosts中添加'kush',但有一个问题是我的主机名和机器名是相同的,所以我更改了我的机器名,然后将它添加到我的/etc/hosts(windows和linux)中,瞧!

相关问题