<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question How to connect to a remote hdfs (for example hortonworks VM) from a local machine in python in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/How-to-connect-to-a-remote-hdfs-for-example-hortonworks-VM/m-p/181575#M143773</link>
    <description>&lt;P&gt;I want to read and write files to and from a remote HDFS. I program by Pycharm in local machine and I want to connect to a remote hdfs (HDP 2.5). Is there any solution? &lt;/P&gt;&lt;P&gt;How can I configure hdfs and how can I refer to a file in hdfs?&lt;/P&gt;&lt;P&gt;Thanks a million,&lt;/P&gt;&lt;P&gt;Shanghoosh &lt;/P&gt;</description>
    <pubDate>Tue, 04 Apr 2017 18:25:03 GMT</pubDate>
    <dc:creator>ali_mohammadi</dc:creator>
    <dc:date>2017-04-04T18:25:03Z</dc:date>
    <item>
      <title>How to connect to a remote hdfs (for example hortonworks VM) from a local machine in python</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-connect-to-a-remote-hdfs-for-example-hortonworks-VM/m-p/181575#M143773</link>
      <description>&lt;P&gt;I want to read and write files to and from a remote HDFS. I program by Pycharm in local machine and I want to connect to a remote hdfs (HDP 2.5). Is there any solution? &lt;/P&gt;&lt;P&gt;How can I configure hdfs and how can I refer to a file in hdfs?&lt;/P&gt;&lt;P&gt;Thanks a million,&lt;/P&gt;&lt;P&gt;Shanghoosh &lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2017 18:25:03 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-connect-to-a-remote-hdfs-for-example-hortonworks-VM/m-p/181575#M143773</guid>
      <dc:creator>ali_mohammadi</dc:creator>
      <dc:date>2017-04-04T18:25:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to connect to a remote hdfs (for example hortonworks VM) from a local machine in python</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-connect-to-a-remote-hdfs-for-example-hortonworks-VM/m-p/181576#M143774</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/15908/alimohammadi.html" nodeid="15908"&gt;@Ali Mohammadi Shanghoshabad&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Please check this article :   &lt;A href="https://community.hortonworks.com/articles/26416/how-to-install-snakebite-in-hdp.html" target="_blank"&gt;https://community.hortonworks.com/articles/26416/how-to-install-snakebite-in-hdp.html&lt;/A&gt;
You only need to pass the hdfs config files of your remote cluster to the python client.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;For example in the python code :you can tell where is your core-site.xml /hdfs-site.xml present.   It can be any path where these files are present.&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/spotify/snakebite/blob/6a456e6100b0c1be66cc1f7f9d7f50494f369da3/snakebite/client.py#L1553" target="_blank"&gt;https://github.com/spotify/snakebite/blob/6a456e6100b0c1be66cc1f7f9d7f50494f369da3/snakebite/client.py#L1553&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2017 18:33:17 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-connect-to-a-remote-hdfs-for-example-hortonworks-VM/m-p/181576#M143774</guid>
      <dc:creator>jsensharma</dc:creator>
      <dc:date>2017-04-04T18:33:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to connect to a remote hdfs (for example hortonworks VM) from a local machine in python</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-connect-to-a-remote-hdfs-for-example-hortonworks-VM/m-p/181577#M143775</link>
      <description>&lt;P&gt;Hi &lt;A rel="user" href="https://community.cloudera.com/users/3418/jsensharma.html" nodeid="3418"&gt;@Jay SenSharma&lt;/A&gt; &lt;/P&gt;&lt;P&gt;Thank you for excellent notes.&lt;/P&gt;&lt;P&gt;I solved the problem before reading your notes as follows:&lt;/P&gt;&lt;PRE&gt;from hdfs import InsecureClient
client = InsecureClient('http://localhost:50070')
# for reading  a file
with client.read('/tmp/tweets_staging/tweets-082940117.json') as reader:
  features = reader.read()
# for writing a file
with client.write('/tmp/tweets_staging/1.json', overwrite=True) as writer:
   writer.write(features)
&lt;/PRE&gt;&lt;P&gt;but I am going to try your solution too.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Shanghoosh&lt;/P&gt;</description>
      <pubDate>Wed, 05 Apr 2017 12:26:29 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-connect-to-a-remote-hdfs-for-example-hortonworks-VM/m-p/181577#M143775</guid>
      <dc:creator>ali_mohammadi</dc:creator>
      <dc:date>2017-04-05T12:26:29Z</dc:date>
    </item>
  </channel>
</rss>

