如何在OpenShift上启动spark-shell

时间:2015-01-29 23:58:33

标签: shell openshift apache-spark

我目前正在尝试在OpenShift服务器实例上使用Apache Spark的spark-shell。 当尝试初始化shell时,我得到了一堆错误,声称我无法绑定到指定的端口,即使在查找IP和端口时也是如此。

spark-env.sh内容:

#!/usr/bin/env bash

# This file is sourced when running various Spark programs.
# Copy it as spark-env.sh and edit that to configure Spark for your site.

# Options read when launching programs locally with 
# ./bin/run-example or ./bin/spark-submit
# - HADOOP_CONF_DIR, to point Spark towards Hadoop configuration files
# - SPARK_LOCAL_IP, to set the IP address Spark binds to on this node
# - SPARK_PUBLIC_DNS, to set the public dns name of the driver program
# - SPARK_CLASSPATH, default classpath entries to append

# Options read by executors and drivers running inside the cluster     
SPARK_LOCAL_IP=127.6.30.1
#, to set the IP address Spark binds to on this node
# - SPARK_PUBLIC_DNS, to set the public DNS name of the driver program
# - SPARK_CLASSPATH, default classpath entries to append
# - SPARK_LOCAL_DIRS, storage directories to use on this node for shuffle and RDD data
# - MESOS_NATIVE_LIBRARY, to point to your libmesos.so if you use Mesos

# Options read in YARN client mode
# - HADOOP_CONF_DIR, to point Spark towards Hadoop configuration files
# - SPARK_EXECUTOR_INSTANCES, Number of workers to start (Default: 2)
# - SPARK_EXECUTOR_CORES, Number of cores for the workers (Default: 1).
# - SPARK_EXECUTOR_MEMORY, Memory per Worker (e.g. 1000M, 2G) (Default: 1G)
# - SPARK_DRIVER_MEMORY, Memory for Master (e.g. 1000M, 2G) (Default: 512 Mb)
# - SPARK_YARN_APP_NAME, The name of your application (Default: Spark)
# - SPARK_YARN_QUEUE, The hadoop queue to use for allocation requests (Default: ‘default’)
# - SPARK_YARN_DIST_FILES, Comma separated list of files to be distributed with the job.
# - SPARK_YARN_DIST_ARCHIVES, Comma separated list of archives to be distributed with the job.

# Options for the daemons used in the standalone deploy mode 
SPARK_MASTER_IP=127.6.30.1
#, to bind the master to a different IP address or hostname SPARK_MASTER_PORT=15001
# / SPARK_MASTER_WEBUI_PORT, to use non-default ports for the master
# - SPARK_MASTER_OPTS, to set config properties only for the master (e.g. "-Dx=y")
# - SPARK_WORKER_CORES, to set the number of cores to use on this machine
# - SPARK_WORKER_MEMORY, to set how much total memory workers have to give executors (e.g. 1000m, 2g)
# - SPARK_WORKER_PORT / SPARK_WORKER_WEBUI_PORT, to use non-default ports for the worker
# - SPARK_WORKER_INSTANCES, to set the number of worker processes per node

运行shell:

 ./spark-shell --conf spark.replClassServer.port=15002

输出:

Spark assembly has been built with Hive, including Datanucleus jars on classpath
Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties
15/01/29 18:56:17 INFO SecurityManager: Changing view acls to: 547c730b5973caaff60000d4
15/01/29 18:56:17 INFO SecurityManager: Changing modify acls to: 547c730b5973caaff60000d4
15/01/29 18:56:17 INFO SecurityManager: SecurityManager: authentication disabled; ui acls disabled; users with view permissions: Set(547c730b5973caaff60000d4); users with modify permissions: Set(547c730b5973caaff60000d4)
15/01/29 18:56:17 INFO HttpServer: Starting HTTP Server
15/01/29 18:56:17 WARN Utils: Service 'HTTP class server' could not bind on port 15002. Attempting port 15003.
15/01/29 18:56:17 WARN Utils: Service 'HTTP class server' could not bind on port 15003. Attempting port 15004.
15/01/29 18:56:17 WARN Utils: Service 'HTTP class server' could not bind on port 15004. Attempting port 15005.
15/01/29 18:56:17 WARN Utils: Service 'HTTP class server' could not bind on port 15005. Attempting port 15006.
15/01/29 18:56:17 WARN Utils: Service 'HTTP class server' could not bind on port 15006. Attempting port 15007.
15/01/29 18:56:17 WARN Utils: Service 'HTTP class server' could not bind on port 15007. Attempting port 15008.
15/01/29 18:56:17 WARN Utils: Service 'HTTP class server' could not bind on port 15008. Attempting port 15009.
15/01/29 18:56:17 WARN Utils: Service 'HTTP class server' could not bind on port 15009. Attempting port 15010.
15/01/29 18:56:17 WARN Utils: Service 'HTTP class server' could not bind on port 15010. Attempting port 15011.
15/01/29 18:56:17 WARN Utils: Service 'HTTP class server' could not bind on port 15011. Attempting port 15012.
15/01/29 18:56:17 WARN Utils: Service 'HTTP class server' could not bind on port 15012. Attempting port 15013.
15/01/29 18:56:17 WARN Utils: Service 'HTTP class server' could not bind on port 15013. Attempting port 15014.
15/01/29 18:56:17 WARN Utils: Service 'HTTP class server' could not bind on port 15014. Attempting port 15015.
15/01/29 18:56:17 WARN Utils: Service 'HTTP class server' could not bind on port 15015. Attempting port 15016.
15/01/29 18:56:17 WARN Utils: Service 'HTTP class server' could not bind on port 15016. Attempting port 15017.
15/01/29 18:56:17 WARN Utils: Service 'HTTP class server' could not bind on port 15017. Attempting port 15018.
Exception in thread "main" java.net.BindException: Permiso denegado: Service 'HTTP class server' failed after 16 retries!
    at java.net.PlainSocketImpl.socketBind(Native Method)
    at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:376)
    at java.net.ServerSocket.bind(ServerSocket.java:376)
    at java.net.ServerSocket.<init>(ServerSocket.java:237)
    at java.net.ServerSocket.<init>(ServerSocket.java:181)
    at org.eclipse.jetty.server.bio.SocketConnector.newServerSocket(SocketConnector.java:96)
    at org.eclipse.jetty.server.bio.SocketConnector.open(SocketConnector.java:85)
    at org.eclipse.jetty.server.AbstractConnector.doStart(AbstractConnector.java:316)
    at org.eclipse.jetty.server.bio.SocketConnector.doStart(SocketConnector.java:156)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
    at org.eclipse.jetty.server.Server.doStart(Server.java:293)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
    at org.apache.spark.HttpServer.org$apache$spark$HttpServer$$doStart(HttpServer.scala:100)
    at org.apache.spark.HttpServer$$anonfun$1.apply(HttpServer.scala:60)
    at org.apache.spark.HttpServer$$anonfun$1.apply(HttpServer.scala:60)
    at org.apache.spark.util.Utils$$anonfun$startServiceOnPort$1.apply$mcVI$sp(Utils.scala:1676)
    at scala.collection.immutable.Range.foreach$mVc$sp(Range.scala:141)
    at org.apache.spark.util.Utils$.startServiceOnPort(Utils.scala:1667)
    at org.apache.spark.HttpServer.start(HttpServer.scala:60)
    at org.apache.spark.repl.SparkIMain.<init>(SparkIMain.scala:121)
    at org.apache.spark.repl.SparkILoop$SparkILoopInterpreter.<init>(SparkILoop.scala:179)
    at org.apache.spark.repl.SparkILoop.createInterpreter(SparkILoop.scala:206)
    at org.apache.spark.repl.SparkILoop$$anonfun$process$1.apply$mcZ$sp(SparkILoop.scala:920)
    at org.apache.spark.repl.SparkILoop$$anonfun$process$1.apply(SparkILoop.scala:916)
    at org.apache.spark.repl.SparkILoop$$anonfun$process$1.apply(SparkILoop.scala:916)
    at scala.tools.nsc.util.ScalaClassLoader$.savingContextLoader(ScalaClassLoader.scala:135)
    at org.apache.spark.repl.SparkILoop.process(SparkILoop.scala:916)
    at org.apache.spark.repl.SparkILoop.process(SparkILoop.scala:1011)
    at org.apache.spark.repl.Main$.main(Main.scala:31)
    at org.apache.spark.repl.Main.main(Main.scala)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.spark.deploy.SparkSubmit$.launch(SparkSubmit.scala:358)
    at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:75)
    at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)

1 个答案:

答案 0 :(得分:0)

OpenShift希望您绑定到特定的主机和端口。两者都可以通过环境变量获得。

根据您选择的墨盒,您应该拥有OPENSHIFT_CARTRIDGE_IPOPENSHIFT_CARTRIDGE_HTTP_PORT的内容。