Support Questions
Find answers, ask questions, and share your expertise

I can create and list a directory using WebHDFS but I can't create a file in VirtualBox Sandbox.

New Contributor

I used Microsoft SSIS to create a file in HDFS using WebHDFS but it failed.

To get better error message, I tested with pyhdfs. I was able to create and list a directory but I can't create a file inside the directory. Following is my sandbox version and test. Could anyone help me?

Thank you.

Sandbox version:

[root@sandbox-hdp ~]# sandbox-version                                                                       
Sandbox information:                                                                                        
Created on: 01_02_2018_10_47_41                                                                             
Hadoop stack version:  Hadoop                                                               
Ambari Version:                                                                                 
Ambari build:  Release : 143                                                                                
Java version:  1.8.0_161                                                                                     
OS Version:  CentOS release 6.9 (Final)  

Test and error:

>>> fs = pyhdfs.HdfsClient(hosts='', user_name='root')

>>> fs.mkdirs('/mytestdir')


>>> fs.listdir('/mytestdir')


>>> fs.create('/mytestdir/a.txt','test')

requests.exceptions.ConnectionError: HTTPConnectionPool(host='', port=50075): Max retries exceeded with url: /webhdfs/v1/mytestdir/a.txt?op=CREATE& (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x000001FF2A116470>: Failed to establish a new connection: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond',))


New Contributor

It was my fault.

I had to add for in hosts file because in case of creating files, it uses Actually it was in the manual of Sandbox on a VM but I missed it.