linux - “Memory is below 1MB, or missing a M/G at the end of the memory specification?”的原因是什么?当我使用 start-all.sh 启动 spark 集群时
问题描述
我正在我的 Linux 操作系统上构建一个 spark 集群。但是当我使用 启动它时./sbin/start-all.sh
,从节点发生以下错误。我该如何解决?
我检查了环境配置cat /etc/profile
并重新加载它source /etc/profile
。但我没有发现任何问题。
以下是 spark-env.sh 的内容
export JAVA_HOME=/root/apps/jdk1.8.0_60
export SCALA_HOME=/root/apps/scala
export SPARK_MASTER_HOST=hdp-01
export SPARK_WORKER_MEMORY=512
export SPARK_WORKER_CORES=2
export SPARK_WORKER_INSTANCES=1
export SPARK_MASTER_PORT=7077
我想用 启动一个火花集群./sbin/start-all.sh
,但实际结果如下:
Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties
Exception in thread "main" java.lang.IllegalStateException: Memory is below 1MB, or missing an M/G at the end of the memory specification?
at org.apache.spark.deploy.worker.WorkerArguments.checkWorkerMemory(WorkerArguments.scala:181)
at org.apache.spark.deploy.worker.WorkerArguments.<init>(WorkerArguments.scala:66)
at org.apache.spark.deploy.worker.Worker$.main(Worker.scala:742)
at org.apache.spark.deploy.worker.Worker.main(Worker.scala)
解决方案
再次尝试修改配置,发现了一些我没有注意到的配置说明。如下:
- SPARK_WORKER_MEMORY,设置worker必须给executors的总内存量(例如1000m,2g),默认为零。
- SPARK_MASTER_OPTS,仅为主服务器设置配置属性(例如“-Dx=y”)。
- SPARK_WORKER_CORES,设置在这台机器上使用的核心数。...
所以我将我的配置修改为:
export SPARK_WORKER_MEMORY=512M
export SPARK_WORKER_CORES=2
#export SPARK_WORKER_INSTANCES=1 # default 1
#export SPARK_MASTER_PORT=7077 # default 7077