Skip to content

Commit

Permalink
add ersources
Browse files Browse the repository at this point in the history
  • Loading branch information
hxd committed Nov 21, 2018
1 parent 80ee3b7 commit 295f48f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/main/resources/core-site.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<configuration>
<property>
<name>fs.default.name</name>
<value>hdfs://node1:9000</value>
</property>
</configuration>
14 changes: 14 additions & 0 deletions src/main/resources/hdfs-site.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<configuration>
<property>
<name>dfs.replication</name>
<value>2</value>
</property>
<property>
<name>dfs.datanode.data.dir</name>
<value>/home/hxd/hadoop_data</value>
</property>
<!--<property>
<name>dfs.namenode.secondary.http-address</name>
<value>MASTERIP:50090</value>
</property>-->
</configuration>
4 changes: 2 additions & 2 deletions src/main/scala/cn/edu/tsinghua/spark/WordCount.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ object WordCount {

// init spark context
val conf = new SparkConf().setAppName("wordcount")//.setMaster("spark://node1:7077")
.setMaster("local")
// .setMaster("local")
val sc = new SparkContext(conf)

// read file
val textRdd = sc.textFile("pom.xml")
val textRdd = sc.textFile("/test/hadoop")

// map reduce
val result = textRdd.map(word => (word, 1)).reduceByKey(_+_)
Expand Down

0 comments on commit 295f48f

Please sign in to comment.