千家信息网

windows 基于docker下的 spark 开发环境搭建

发表于:2025-01-22 作者:千家信息网编辑
千家信息网最后更新 2025年01月22日,docker toolboxhttps://www.docker.com/products/docker-toolboxsparkhttps://hub.docker.com/r/singularit
千家信息网最后更新 2025年01月22日windows 基于docker下的 spark 开发环境搭建

docker toolbox

https://www.docker.com/products/docker-toolbox


spark

https://hub.docker.com/r/singularities/spark/~/dockerfile/


# start-hadoop-namenode

# hadoop fs -mkdir /user

# hadoop fs -mkdir /user/root/

# hadoop fs -put ./README.md /user/root


# start-spark

# start-spark worker [master]

# spark-shell

# spark-shell --master spark://a60b8c8f9653:7077


scala> val lines = sc.textFile("file:///usr/local/spark-2.1.0/README.md")

scala> val lines = sc.textFile("hdfs:///usr/local/spark-2.1.0/README.md")

lines: org.apache.spark.rdd.RDD[String] = file:///usr/local/spark-2.1.0/README.md MapPartitionsRDD[1] at textFile at :24

scala> lines.count()

res0: Long = 104

scala> lines.saveAsTextFile("hdfs:///user/root/README2.md") // 保存到hdfs


0