title: Write DataFrame to HDFS,connection refused
body: <p>I am trying to run example from Mastering Apache Spark 2.x book.</p>
  
  <pre><code>scala&gt; val df = sc.parallelize(Array(1,2,3)).toDF
  df: org.apache.spark.sql.DataFrame = [value: int]
  </code></pre>
  
  <p>I am new to Spark world,but I guess that dataframe should be saved to HDFS</p>
  
  <pre><code>scala&gt; df.write.json("hdfs://localhost:9000/tmp/account.json")
  java.net.ConnectException: Call From miki/127.0.1.1 to localhost:9000 failed on connection exception: java.net.ConnectException: Connection refused; For more details see:  http://wiki.apache.org/hadoop/ConnectionRefused
  </code></pre>
  
  <p>I checked with dfsadmin</p>
  
  <pre><code> hadoop dfsadmin -safemode enter
  WARNING: Use of this script to execute dfsadmin is deprecated.
  WARNING: Attempting to execute replacement "hdfs dfsadmin" instead.
  
  safemode: FileSystem file:/// is not an HDFS file system
  </code></pre>
  
  <p>jps output</p>
  
  <pre><code>miki@miki:~$ jps
  13798 Jps
  10906 SparkSubmit
  </code></pre>
  
  <p>How to fix this?</p>