forked from apache/spark
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request apache#10 from mesosphere/multiple_spark
[SPARK-110] Support multiple spark dispatchers
- Loading branch information
Showing
21 changed files
with
262 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,8 @@ def main(): | |
|
||
output_file.write(template) | ||
|
||
print("Package built successfully.") | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<HISTORY_SERVER_CONF> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
</head> | ||
|
||
<body> | ||
<a href="dispatcher">Spark Dispatcher UI</a> | ||
<br/> | ||
<a href="history">Spark History Server</a> | ||
</body> | ||
|
||
</html> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
server { | ||
listen <PORT>; | ||
port_in_redirect off; | ||
|
||
server_name ""; | ||
|
||
root /usr/html; | ||
index index.html; | ||
|
||
location /v1 { | ||
proxy_pass <DISPATCHER_URL>; | ||
|
||
# Don't try to be intelligent, only proxy | ||
proxy_buffering off; | ||
proxy_redirect off; | ||
proxy_next_upstream off; | ||
|
||
# Set long timeout | ||
proxy_connect_timeout 159s; | ||
proxy_send_timeout 600s; | ||
proxy_read_timeout 600s; | ||
} | ||
|
||
location /dispatcher/ { | ||
proxy_redirect $scheme://$host $scheme://$host/dispatcher; | ||
proxy_pass <DISPATCHER_UI_URL>/; | ||
proxy_set_header Host $host; | ||
} | ||
|
||
location /history/ { | ||
proxy_redirect $scheme://$host $scheme://$host/history; | ||
proxy_pass <HISTORY_SERVER_URL>/; | ||
proxy_set_header Host $host; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
worker_processes 1; | ||
daemon off; | ||
|
||
events { | ||
worker_connections 1024; | ||
} | ||
|
||
error_log /dev/stdout warn; | ||
pid /var/run/nginx.pid; | ||
|
||
http { | ||
include /etc/nginx/mime.types; | ||
default_type application/octet-stream; | ||
|
||
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' | ||
'$status $body_bytes_sent "$http_referer" ' | ||
'"$http_user_agent" "$http_x_forwarded_for"'; | ||
|
||
access_log /dev/stdout main; | ||
|
||
sendfile on; | ||
#tcp_nopush on; | ||
|
||
keepalive_timeout 65; | ||
|
||
gzip on; | ||
|
||
include /etc/nginx/conf.d/*.conf; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/sh | ||
set -e | ||
set -x | ||
|
||
export DISPATCHER_PORT="${PORT0}" | ||
export DISPATCHER_UI_PORT="${PORT1}" | ||
export HISTORY_SERVER_PORT="${PORT2}" | ||
export SPARK_PROXY_PORT="${PORT3}" | ||
export WEBUI_URL="http://${FRAMEWORK_NAME}${DNS_SUFFIX}:${SPARK_PROXY_PORT}" | ||
export HISTORY_SERVER_WEB_PROXY_BASE="/service/${FRAMEWORK_NAME}/history" | ||
export DISPATCHER_UI_WEB_PROXY_BASE="/service/${FRAMEWORK_NAME}/dispatcher" | ||
|
||
if [ "${ENABLE_HISTORY_SERVER:=false}" = "true" ]; then | ||
ln -s /var/lib/runit/service/history-server /etc/service/history-server | ||
fi | ||
|
||
# start service | ||
exec runsvdir -P /etc/service | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/sh | ||
set -e | ||
set -x | ||
|
||
mkdir -p "${MESOS_SANDBOX}"/history-server | ||
exec svlogd "${MESOS_SANDBOX}"/history-server | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/sh | ||
set -e | ||
set -x | ||
|
||
exec 2>&1 | ||
|
||
export APPLICATION_WEB_PROXY_BASE="${HISTORY_SERVER_WEB_PROXY_BASE}" | ||
export SPARK_HISTORY_OPTS="-Dspark.history.ui.port=${HISTORY_SERVER_PORT} -Dspark.history.fs.logDirectory=${HISTORY_LOG_DIR} -Dspark.history.fs.cleaner.enabled=${HISTORY_CLEANER_ENABLED} -Dspark.history.fs.cleaner.interval=${HISTORY_CLEANER_INTERVAL} -Dspark.history.fs.cleaner.maxAge=${HISTORY_CLEANER_MAXAGE}" | ||
|
||
cd /opt/spark/dist | ||
exec /opt/spark/dist/bin/spark-class org.apache.spark.deploy.history.HistoryServer | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/sh | ||
set -e | ||
set -x | ||
|
||
mkdir -p "${MESOS_SANDBOX}"/nginx | ||
exec svlogd "${MESOS_SANDBOX}"/nginx | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/sh | ||
set -e | ||
set -x | ||
|
||
exec 2>&1 | ||
vars="s,<PORT>,${SPARK_PROXY_PORT},;s,<DISPATCHER_URL>,http://${HOST}:${DISPATCHER_PORT},;s,<DISPATCHER_UI_URL>,http://${HOST}:${DISPATCHER_UI_PORT},;s,<HISTORY_SERVER_URL>,http://${HOST}:${HISTORY_SERVER_PORT}," | ||
sed "${vars}" /etc/nginx/conf.d/spark.conf.template >/etc/nginx/conf.d/spark.conf | ||
|
||
exec /usr/sbin/nginx -c /etc/nginx/nginx.conf | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/sh | ||
set -e | ||
set -x | ||
|
||
mkdir -p "${MESOS_SANDBOX}"/spark | ||
exec svlogd "${MESOS_SANDBOX}"/spark | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/sh | ||
set -e | ||
set -x | ||
|
||
exec 2>&1 | ||
|
||
export APPLICATION_WEB_PROXY_BASE="${DISPATCHER_UI_WEB_PROXY_BASE}" | ||
|
||
cd /opt/spark/dist | ||
|
||
if [ "$FRAMEWORK_NAME" != "spark" ]; then | ||
export SPARK_DAEMON_JAVA_OPTS="$SPARK_DAEMON_JAVA_OPTS -Dspark.deploy.zookeeper.dir=/spark_mesos_dispatcher_$FRAMEWORK_NAME" | ||
fi | ||
|
||
if [ "$SPARK_DISPATCHER_MESOS_ROLE" != "" ]; then | ||
export SPARK_DAEMON_JAVA_OPTS="$SPARK_DAEMON_JAVA_OPTS -Dspark.mesos.role=$SPARK_DISPATCHER_MESOS_ROLE" | ||
fi | ||
|
||
HISTORY_SERVER_CONF="" | ||
if [ "${ENABLE_HISTORY_SERVER:=false}" = "true" ]; then | ||
HISTORY_SERVER_CONF="spark.mesos.historyServer.url=${HISTORY_SERVER_WEB_PROXY_BASE}" | ||
fi | ||
|
||
sed "s,<HISTORY_SERVER_CONF>,${HISTORY_SERVER_CONF}," \ | ||
conf/mesos-cluster-dispatcher.properties.template >conf/mesos-cluster-dispatcher.properties | ||
|
||
exec /opt/spark/dist/bin/spark-class \ | ||
org.apache.spark.deploy.mesos.MesosClusterDispatcher \ | ||
--port "${DISPATCHER_PORT}" \ | ||
--webui-port "${DISPATCHER_UI_PORT}" \ | ||
--master "${MESOS_MASTER}" \ | ||
--zk "${ZK}" \ | ||
--host "${HOST}" \ | ||
--name "${FRAMEWORK_NAME}" \ | ||
--properties-file "conf/mesos-cluster-dispatcher.properties" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters