You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by wa...@apache.org on 2018/10/16 20:51:32 UTC

[1/5] hadoop git commit: YARN-8875. [Submarine] Add documentation for submarine installation script details. (Xun Liu via wangda)

Repository: hadoop
Updated Branches:
  refs/heads/trunk babd1449b -> 538250db2


YARN-8875. [Submarine] Add documentation for submarine installation script details. (Xun Liu via wangda)

Change-Id: I1c8d39c394e5a30f967ea514919835b951f2c124


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/ed08dd3b
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/ed08dd3b
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/ed08dd3b

Branch: refs/heads/trunk
Commit: ed08dd3b0c9cec20373e8ca4e34d6526bd759943
Parents: babd144
Author: Wangda Tan <wa...@apache.org>
Authored: Tue Oct 16 13:36:09 2018 -0700
Committer: Wangda Tan <wa...@apache.org>
Committed: Tue Oct 16 13:51:01 2018 -0700

----------------------------------------------------------------------
 .../src/site/markdown/HowToInstall.md           |  36 +++
 .../src/site/markdown/Index.md                  |   4 +-
 .../src/site/markdown/InstallationGuide.md      | 205 +++------------
 .../src/site/markdown/InstallationScriptCN.md   | 242 ++++++++++++++++++
 .../src/site/markdown/InstallationScriptEN.md   | 250 +++++++++++++++++++
 .../src/site/markdown/TestAndTroubleshooting.md | 165 ++++++++++++
 .../resources/images/submarine-installer.gif    | Bin 0 -> 546547 bytes
 7 files changed, 724 insertions(+), 178 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/ed08dd3b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/src/site/markdown/HowToInstall.md
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/src/site/markdown/HowToInstall.md b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/src/site/markdown/HowToInstall.md
new file mode 100644
index 0000000..05d87c1
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/src/site/markdown/HowToInstall.md
@@ -0,0 +1,36 @@
+<!---
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License. See accompanying LICENSE file.
+-->
+
+# How to Install Dependencies
+
+Submarine project uses YARN Service, Docker container, and GPU (when GPU hardware available and properly configured).
+
+That means as an admin, you have to properly setup YARN Service related dependencies, including:
+- YARN Registry DNS
+
+Docker related dependencies, including:
+- Docker binary with expected versions.
+- Docker network which allows Docker container can talk to each other across different nodes.
+
+And when GPU wanna to be used:
+- GPU Driver.
+- Nvidia-docker.
+
+For your convenience, we provided installation documents to help you to setup your environment. You can always choose to have them installed in your own way.
+
+Use Submarine installer to install dependencies: [EN](InstallationScriptEN.html) [CN](InstallationScriptCN.html)
+
+Alternatively, you can follow manual install dependencies: [EN](InstallationGuide.html) [CN](InstallationGuideChineseVersion.html)
+
+Once you have installed dependencies, please follow following guide to [TestAndTroubleshooting](TestAndTroubleshooting.html).  
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/hadoop/blob/ed08dd3b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/src/site/markdown/Index.md
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/src/site/markdown/Index.md b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/src/site/markdown/Index.md
index 0006f6c..baeaa15 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/src/site/markdown/Index.md
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/src/site/markdown/Index.md
@@ -41,6 +41,4 @@ Click below contents if you want to understand more.
 
 - [Developer guide](DeveloperGuide.html)
 
-- [Installation guide](InstallationGuide.html)
-
-- [Installation guide Chinese version](InstallationGuideChineseVersion.html)
+- [Installation guides](HowToInstall.html)

http://git-wip-us.apache.org/repos/asf/hadoop/blob/ed08dd3b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/src/site/markdown/InstallationGuide.md
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/src/site/markdown/InstallationGuide.md b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/src/site/markdown/InstallationGuide.md
index d4f4269..4ef2bda 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/src/site/markdown/InstallationGuide.md
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/src/site/markdown/InstallationGuide.md
@@ -16,9 +16,11 @@
 
 ## Prerequisites
 
+(Please note that all following prerequisites are just an example for you to install. You can always choose to install your own version of kernel, different users, different drivers, etc.).
+
 ### Operating System
 
-The operating system and kernel versions we used are as shown in the following table, which should be minimum required versions:
+The operating system and kernel versions we have tested are as shown in the following table, which is the recommneded minimum required versions.
 
 | Enviroment | Verion |
 | ------ | ------ |
@@ -27,7 +29,7 @@ The operating system and kernel versions we used are as shown in the following t
 
 ### User & Group
 
-As there are some specific users and groups need to be created to install hadoop/docker. Please create them if they are missing.
+As there are some specific users and groups recommended to be created to install hadoop/docker. Please create them if they are missing.
 
 ```
 adduser hdfs
@@ -45,7 +47,7 @@ usermod -aG docker hadoop
 
 ### GCC Version
 
-Check the version of GCC tool
+Check the version of GCC tool (to compile kernel).
 
 ```bash
 gcc --version
@@ -64,7 +66,7 @@ wget http://vault.centos.org/7.3.1611/os/x86_64/Packages/kernel-headers-3.10.0-5
 rpm -ivh kernel-headers-3.10.0-514.el7.x86_64.rpm
 ```
 
-### GPU Servers
+### GPU Servers (Only for Nvidia GPU equipped nodes)
 
 ```
 lspci | grep -i nvidia
@@ -76,9 +78,9 @@ lspci | grep -i nvidia
 
 
 
-### Nvidia Driver Installation
+### Nvidia Driver Installation (Only for Nvidia GPU equipped nodes)
 
-If nvidia driver/cuda has been installed before, They should be uninstalled firstly.
+To make a clean installation, if you have requirements to upgrade GPU drivers. If nvidia driver/cuda has been installed before, They should be uninstalled firstly.
 
 ```
 # uninstall cuda:
@@ -96,16 +98,16 @@ yum install nvidia-detect
 nvidia-detect -v
 Probing for supported NVIDIA devices...
 [10de:13bb] NVIDIA Corporation GM107GL [Quadro K620]
-This device requires the current 390.87 NVIDIA driver kmod-nvidia
+This device requires the current xyz.nm NVIDIA driver kmod-nvidia
 [8086:1912] Intel Corporation HD Graphics 530
 An Intel display controller was also detected
 ```
 
-Pay attention to `This device requires the current 390.87 NVIDIA driver kmod-nvidia`.
-Download the installer [NVIDIA-Linux-x86_64-390.87.run](https://www.nvidia.com/object/linux-amd64-display-archive.html).
+Pay attention to `This device requires the current xyz.nm NVIDIA driver kmod-nvidia`.
+Download the installer like [NVIDIA-Linux-x86_64-390.87.run](https://www.nvidia.com/object/linux-amd64-display-archive.html).
 
 
-Some preparatory work for nvidia driver installation
+Some preparatory work for nvidia driver installation. (This is follow normal Nvidia GPU driver installation, just put here for your convenience)
 
 ```
 # It may take a while to update
@@ -163,6 +165,8 @@ https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html
 
 ### Docker Installation
 
+We recommend to use Docker version >= 1.12.5, following steps are just for your reference. You can always to choose other approaches to install Docker.
+
 ```
 yum -y update
 yum -y install yum-utils
@@ -226,9 +230,9 @@ Server:
  OS/Arch:      linux/amd64
 ```
 
-### Nvidia-docker Installation
+### Nvidia-docker Installation (Only for Nvidia GPU equipped nodes)
 
-Submarine is based on nvidia-docker 1.0 version
+Submarine depends on nvidia-docker 1.0 version
 
 ```
 wget -P /tmp https://github.com/NVIDIA/nvidia-docker/releases/download/v1.0.1/nvidia-docker-1.0.1-1.x86_64.rpm
@@ -285,7 +289,6 @@ Reference:
 https://github.com/NVIDIA/nvidia-docker/tree/1.0
 
 
-
 ### Tensorflow Image
 
 There is no need to install CUDNN and CUDA on the servers, because CUDNN and CUDA can be added in the docker images. we can get basic docker images by following WriteDockerfile.md.
@@ -367,7 +370,7 @@ ENV PATH $PATH:$JAVA_HOME/bin
 ### Test tensorflow in a docker container
 
 After docker image is built, we can check
-tensorflow environments before submitting a yarn job.
+Tensorflow environments before submitting a yarn job.
 
 ```shell
 $ docker run -it ${docker_image_name} /bin/bash
@@ -394,10 +397,13 @@ If there are some errors, we could check the following configuration.
 
 ### Etcd Installation
 
-To install Etcd on specified servers, we can run Submarine/install.sh
+etcd is a distributed reliable key-value store for the most critical data of a distributed system, Registration and discovery of services used in containers.
+You can also choose alternatives like zookeeper, Consul.
+
+To install Etcd on specified servers, we can run Submarine-installer/install.sh
 
 ```shell
-$ ./Submarine/install.sh
+$ ./Submarine-installer/install.sh
 # Etcd status
 systemctl status Etcd.service
 ```
@@ -421,7 +427,10 @@ b3d05464c356441a: name=etcdnode1 peerURLs=http://${etcd_host_ip3}:2380 clientURL
 
 ### Calico Installation
 
-To install Calico on specified servers, we can run Submarine/install.sh
+Calico creates and manages a flat three-tier network, and each container is assigned a routable ip. We just add the steps here for your convenience.
+You can also choose alternatives like Flannel, OVS.
+
+To install Calico on specified servers, we can run Submarine-installer/install.sh
 
 ```
 systemctl start calico-node.service
@@ -460,11 +469,8 @@ docker exec workload-A ping workload-B
 
 ## Hadoop Installation
 
-### Compile hadoop source code
-
-```
-mvn package -Pdist -DskipTests -Dtar
-```
+### Get Hadoop Release
+You can either get Hadoop release binary or compile from source code. Please follow the https://hadoop.apache.org/ guides.
 
 
 ### Start yarn service
@@ -593,10 +599,10 @@ Add configurations in container-executor.cfg
    ...
    # Add configurations in `[docker]` part:
    # /usr/bin/nvidia-docker is the path of nvidia-docker command
-   # nvidia_driver_375.26 means that nvidia driver version is 375.26. nvidia-smi command can be used to check the version
+   # nvidia_driver_375.26 means that nvidia driver version is <version>. nvidia-smi command can be used to check the version
    docker.allowed.volume-drivers=/usr/bin/nvidia-docker
    docker.allowed.devices=/dev/nvidiactl,/dev/nvidia-uvm,/dev/nvidia-uvm-tools,/dev/nvidia1,/dev/nvidia0
-   docker.allowed.ro-mounts=nvidia_driver_375.26
+   docker.allowed.ro-mounts=nvidia_driver_<version>
 
    [gpu]
    module.enabled=true
@@ -607,154 +613,3 @@ Add configurations in container-executor.cfg
    root=/sys/fs/cgroup
    yarn-hierarchy=/hadoop-yarn
    ```
-
-#### Test with a tensorflow job
-
-Distributed-shell + GPU + cgroup
-
-```bash
- ./yarn jar /home/hadoop/hadoop-current/share/hadoop/yarn/hadoop-yarn-submarine-3.2.0-SNAPSHOT.jar job run \
- --env DOCKER_JAVA_HOME=/opt/java \
- --env DOCKER_HADOOP_HDFS_HOME=/hadoop-3.1.0 --name distributed-tf-gpu \
- --env YARN_CONTAINER_RUNTIME_DOCKER_CONTAINER_NETWORK=calico-network \
- --docker_image gpu-cuda9.0-tf1.8.0-with-models \
- --input_path hdfs://${dfs_name_service}/tmp/cifar-10-data \
- --checkpoint_path hdfs://${dfs_name_service}/user/hadoop/tf-distributed-checkpoint \
- --num_ps 0 \
- --ps_resources memory=4G,vcores=2,gpu=0 \
- --ps_launch_cmd "python /test/cifar10_estimator/cifar10_main.py --data-dir=hdfs://${dfs_name_service}/tmp/cifar-10-data --job-dir=hdfs://${dfs_name_service}/tmp/cifar-10-jobdir --num-gpus=0" \
- --worker_resources memory=4G,vcores=2,gpu=1 --verbose \
- --num_workers 1 \
- --worker_launch_cmd "python /test/cifar10_estimator/cifar10_main.py --data-dir=hdfs://${dfs_name_service}/tmp/cifar-10-data --job-dir=hdfs://${dfs_name_service}/tmp/cifar-10-jobdir --train-steps=500 --eval-batch-size=16 --train-batch-size=16 --sync --num-gpus=1"
-```
-
-
-
-## Issues:
-
-### Issue 1: Fail to start nodemanager after system reboot
-
-```
-2018-09-20 18:54:39,785 ERROR org.apache.hadoop.yarn.server.nodemanager.LinuxContainerExecutor: Failed to bootstrap configured resource subsystems!
-org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.resources.ResourceHandlerException: Unexpected: Cannot create yarn cgroup Subsystem:cpu Mount points:/proc/mounts User:yarn Path:/sys/fs/cgroup/cpu,cpuacct/hadoop-yarn
-  at org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.resources.CGroupsHandlerImpl.initializePreMountedCGroupController(CGroupsHandlerImpl.java:425)
-  at org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.resources.CGroupsHandlerImpl.initializeCGroupController(CGroupsHandlerImpl.java:377)
-  at org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.resources.CGroupsCpuResourceHandlerImpl.bootstrap(CGroupsCpuResourceHandlerImpl.java:98)
-  at org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.resources.CGroupsCpuResourceHandlerImpl.bootstrap(CGroupsCpuResourceHandlerImpl.java:87)
-  at org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.resources.ResourceHandlerChain.bootstrap(ResourceHandlerChain.java:58)
-  at org.apache.hadoop.yarn.server.nodemanager.LinuxContainerExecutor.init(LinuxContainerExecutor.java:320)
-  at org.apache.hadoop.yarn.server.nodemanager.NodeManager.serviceInit(NodeManager.java:389)
-  at org.apache.hadoop.service.AbstractService.init(AbstractService.java:164)
-  at org.apache.hadoop.yarn.server.nodemanager.NodeManager.initAndStartNodeManager(NodeManager.java:929)
-  at org.apache.hadoop.yarn.server.nodemanager.NodeManager.main(NodeManager.java:997)
-2018-09-20 18:54:39,789 INFO org.apache.hadoop.service.AbstractService: Service NodeManager failed in state INITED
-```
-
-Solution: Grant user yarn the access to  `/sys/fs/cgroup/cpu,cpuacct`, which is the subfolder of cgroup mount destination.
-
-```
-chown :yarn -R /sys/fs/cgroup/cpu,cpuacct
-chmod g+rwx -R /sys/fs/cgroup/cpu,cpuacct
-```
-
-If GPUs are used,the access to cgroup devices folder is neede as well
-
-```
-chown :yarn -R /sys/fs/cgroup/devices
-chmod g+rwx -R /sys/fs/cgroup/devices
-```
-
-
-### Issue 2: container-executor permission denied
-
-```
-2018-09-21 09:36:26,102 WARN org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.privileged.PrivilegedOperationExecutor: IOException executing command:
-java.io.IOException: Cannot run program "/etc/yarn/sbin/Linux-amd64-64/container-executor": error=13, Permission denied
-        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
-        at org.apache.hadoop.util.Shell.runCommand(Shell.java:938)
-        at org.apache.hadoop.util.Shell.run(Shell.java:901)
-        at org.apache.hadoop.util.Shell$ShellCommandExecutor.execute(Shell.java:1213)
-```
-
-Solution: The permission of `/etc/yarn/sbin/Linux-amd64-64/container-executor` should be 6050
-
-### Issue 3:How to get docker service log
-
-Solution: we can get docker log with the following command
-
-```
-journalctl -u docker
-```
-
-### Issue 4:docker can't remove containers with errors like `device or resource busy`
-
-```bash
-$ docker rm 0bfafa146431
-Error response from daemon: Unable to remove filesystem for 0bfafa146431771f6024dcb9775ef47f170edb2f1852f71916ba44209ca6120a: remove /app/docker/containers/0bfafa146431771f6024dcb9775ef47f170edb2f152f71916ba44209ca6120a/shm: device or resource busy
-```
-
-Solution: to find which process leads to a `device or resource busy`, we can add a shell script, named `find-busy-mnt.sh`
-
-```bash
-#!/bin/bash
-
-# A simple script to get information about mount points and pids and their
-# mount namespaces.
-
-if [ $# -ne 1 ];then
-echo "Usage: $0 <devicemapper-device-id>"
-exit 1
-fi
-
-ID=$1
-
-MOUNTS=`find /proc/*/mounts | xargs grep $ID 2>/dev/null`
-
-[ -z "$MOUNTS" ] &&  echo "No pids found" && exit 0
-
-printf "PID\tNAME\t\tMNTNS\n"
-echo "$MOUNTS" | while read LINE; do
-PID=`echo $LINE | cut -d ":" -f1 | cut -d "/" -f3`
-# Ignore self and thread-self
-if [ "$PID" == "self" ] || [ "$PID" == "thread-self" ]; then
-  continue
-fi
-NAME=`ps -q $PID -o comm=`
-MNTNS=`readlink /proc/$PID/ns/mnt`
-printf "%s\t%s\t\t%s\n" "$PID" "$NAME" "$MNTNS"
-done
-```
-
-Kill the process by pid, which is found by the script
-
-```bash
-$ chmod +x find-busy-mnt.sh
-./find-busy-mnt.sh 0bfafa146431771f6024dcb9775ef47f170edb2f152f71916ba44209ca6120a
-# PID   NAME            MNTNS
-# 5007  ntpd            mnt:[4026533598]
-$ kill -9 5007
-```
-
-
-### Issue 5:Failed to execute `sudo nvidia-docker run`
-
-```
-docker: Error response from daemon: create nvidia_driver_361.42: VolumeDriver.Create: internal error, check logs for details.
-See 'docker run --help'.
-```
-
-Solution:
-
-```
-#check nvidia-docker status
-$ systemctl status nvidia-docker
-$ journalctl -n -u nvidia-docker
-#restart nvidia-docker
-systemctl stop nvidia-docker
-systemctl start nvidia-docker
-```
-
-### Issue 6:Yarn failed to start containers
-
-if the number of GPUs required by applications is larger than the number of GPUs in the cluster, there would be some containers can't be created.
-

http://git-wip-us.apache.org/repos/asf/hadoop/blob/ed08dd3b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/src/site/markdown/InstallationScriptCN.md
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/src/site/markdown/InstallationScriptCN.md b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/src/site/markdown/InstallationScriptCN.md
new file mode 100644
index 0000000..8a873c4
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/src/site/markdown/InstallationScriptCN.md
@@ -0,0 +1,242 @@
+<!---
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License. See accompanying LICENSE file.
+-->
+
+# submarine installer
+
+## 项目介绍
+
+介绍 **submarine-installer** 项目之前,首先要说明一下 **Hadoop {Submarine}**  这个项目,**Hadoop {Submarine}**  是 hadoop 3.2 版本中最新发布的机器学习框架子项目,他让 hadoop 支持 `Tensorflow`、`MXNet`、`Caffe`、`Spark` 等多种深度学习框架,提供了机器学习算法开发、分布式模型训练、模型管理和模型发布等全功能的系统框架,结合 hadoop 与身俱来的数据存储和数据处理能力,让数据科学家们能够更好的挖掘和发挥出数据的价值。
+
+hadoop 在 2.9 版本中就已经让 YARN 支持了 Docker 容器的资源调度模式,**Hadoop {Submarine}** 在此基础之上通过 YARN 把分布式深度学习框架以 Docker 容器的方式进行调度和运行起来。
+
+由于分布式深度学习框架需要运行在多个 Docker 的容器之中,并且需要能够让运行在容器之中的各个服务相互协调,完成分布式机器学习的模型训练和模型发布等服务,这其中就会牵涉到 `DNS`、`Docker` 、 `GPU`、`Network`、`显卡`、`操作系统内核` 修改等多个系统工程问题,正确的部署好 **Hadoop {Submarine}**  的运行环境是一件很困难和耗时的事情。
+
+为了降低 hadoop 2.9 以上版本的 docker 等组件的部署难度,所以我们专门开发了这个用来部署 `Hadoop {Submarine} ` 运行时环境的 `submarine-installer` 项目,提供一键安装脚本,也可以分步执行安装、卸载、启动和停止各个组件,同时讲解每一步主要参数配置和注意事项。我们同时还向 hadoop 社区提交了部署 `Hadoop {Submarine} ` 运行时环境的 [中文手册](InstallationGuideChineseVersion.md) 和 [英文手册](InstallationGuide.md) ,帮助用户更容易的部署,发现问题也可以及时解决。
+
+## 先决条件
+
+**submarine-installer** 目前只支持 `centos-release-7-3.1611.el7.centos.x86_64` 以上版本的操作系统中进行使用。
+
+## 配置说明
+
+使用 **submarine-installer** 进行部署之前,你可以参考 [install.conf](install.conf) 文件中已有的配置参数和格式,根据你的使用情况进行如下的参数配置:
+
++ **DNS 配置项**
+
+  LOCAL_DNS_HOST:服务器端本地 DNS IP 地址配置,可以从 `/etc/resolv.conf` 中查看
+
+  YARN_DNS_HOST:yarn dns server 启动的 IP 地址
+
++ **ETCD 配置项**
+
+  机器学习是一个计算密度型系统,对数据传输性能要求非常高,所以我们使用了网络效率损耗最小的 ETCD 网络组件,它可以通过 BGP 路由方式支持 overlay 网络,同时在跨机房部署时支持隧道模式。
+
+  你需要选择至少三台以上的服务器作为 ETCD 的运行服务器,这样可以让 `Hadoop {Submarine} ` 有较好的容错性和稳定性。
+
+  在 **ETCD_HOSTS** 配置项中输入作为 ETCD 服务器的IP数组,参数配置一般是这样:
+
+  ETCD_HOSTS=(hostIP1 hostIP2 hostIP3),注意多个 hostIP 之间请使用空格进行隔开。
+
++ **DOCKER_REGISTRY 配置项**
+
+  你首先需要安装好一个可用的 docker 的镜像管理仓库,这个镜像仓库用来存放你所需要的各种深度学习框架的镜像文件,然后将镜像仓库的 IP 地址和端口配置进来,参数配置一般是这样:DOCKER_REGISTRY="10.120.196.232:5000"
+
++ **DOWNLOAD_SERVER 配置项**
+
+  `submarine-installer` 默认都是从网络上直接下载所有的依赖包(例如:GCC、Docker、Nvidia 驱动等等),这往往需要消耗大量的时间,并且在有些服务器不能连接互联网的环境中将无法部署,所以我们在 `submarine-installer` 中内置了 HTTP 下载服务,只需要在一台能够连接互联网的服务器中运行 `submarine-installer` ,就可以为所有其他服务器提供依赖包的下载,只需要你按照以下配置进行操作:
+
+  1. 首先,你需要将 `DOWNLOAD_SERVER_IP` 配置为一台能够连接互联网的服务器IP地址,将 `DOWNLOAD_SERVER_PORT` 配置为一个不会不太常用的端口。
+  2. 在  `DOWNLOAD_SERVER_IP` 所在的那台服务器中运行 `submarine-installer/install.sh` 命令后,在安装界面中选择 `[start download server]` 菜单项,`submarine-installer` 将会把部署所有的依赖包全部下载到 `submarine-installer/downloads` 目录中,然后通过 `python -m SimpleHTTPServer ${DOWNLOAD_SERVER_PORT}`  命令启动一个 HTTP 下载服务,不要关闭这台服务器中运行着的 `submarine-installer` 。
+  3. 在其他服务器中同样运行 `submarine-installer/install.sh` 命令 ,按照安装界面中的 `[install component]`  菜单依次进行各个组件的安装时,会自动从 `DOWNLOAD_SERVER_IP` 所在的那台服务器下载依赖包进行安装部署。
+  4. **DOWNLOAD_SERVER** 另外还有一个用处是,你可以自行把各个依赖包手工下载下来,然后放到其中一台服务器的 `submarine-installer/downloads` 目录中,然后开启 `[start download server]` ,这样就可以为整个集群提供离线安装部署的能力。
+
++ **YARN_CONTAINER_EXECUTOR_PATH 配置项**
+
+  如何编译 YARN 的 container-executor:你进入到 `hadoop/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager` 目录中执行 `mvn package -Pnative -DskipTests`  命令,将会编译出 `./target/native/target/usr/local/bin/container-executor` 文件。
+
+  你需要将 `container-executor` 文件的完整路径填写在 YARN_CONTAINER_EXECUTOR_PATH 配置项中。
+
++ **YARN_HIERARCHY 配置项**
+
+  请保持和你所使用的 YARN 集群的 `yarn-site.xml` 配置文件中的 `yarn.nodemanager.linux-container-executor.cgroups.hierarchy` 相同的配置,`yarn-site.xml` 中如果未配置该项,那么默认为 `/hadoop-yarn`。
+
++ **YARN_NODEMANAGER_LOCAL_DIRS 配置项**
+
+  请保持和你所使用的 YARN 集群的 `yarn-site.xml` 配置文件中的 `yarn.nodemanager.local-dirs` 相同的配置。
+
++ **YARN_NODEMANAGER_LOG_DIRS 配置项**
+
+  请保持和你所使用的 YARN 集群的 `yarn-site.xml` 配置文件中的 `yarn.nodemanager.log-dirs` 相同的配置。
+
+## 使用说明
+
+**submarine-installer**  完全使用 Shell 脚本编写,不需要安装 ansible 等任何部署工具,避免了不同公司用户的服务器管理规范不同而导致程序不通用,例如:有些机房是不容许 ROOT 用户通过 SHELL 直接进行远程服务器操作等。
+
+**submarine-installer**  的部署过程,完全是通过在菜单中进行选择的操作方式进行的,避免了误操作的同时,你还可以通过各个菜单项目对任意一个组件进行分步执行安装、卸载、启动和停止各个组件,具有很好的灵活性,在部分组件出现问题后,也可以通过 **submarine-installer**  对系统进行诊断和修复。
+
+**submarine-installer**  部署过程中屏幕中会显示日志信息,日志信息一共有三种字体颜色:
+
++ 红色字体颜色:说明组件安装出现了错误,部署已经终止。
+
++ 绿色文字颜色:说明组件安装正常,部署正常运行。
+
++ 蓝色文字颜色:需要你按照提示信息在另外一个 SHELL 终端中进行手工输入命令,一般是修改操作系统内核配置操作,按照提示信息依次操作就可以了。
+
+**启动 submarine-installer**
+
+运行 `submarine-installer/install.sh` 命令启动,部署程序首先会检测服务器中的网卡 IP 地址,如果服务器有多个网卡或配置了多个 IP ,会以列表的形式显示,选择你实际使用的 IP 地址。
+
+**submarine-installer**  菜单说明:
+
+![alt text](./images/submarine-installer.gif "Submarine Installer")
+
+## 部署说明
+
+部署流程如下所示:
+
+1. 参照配置说明,根据你的服务器使用情况配置好 install.conf 文件
+
+2. 将整个 `submarine-installer` 文件夹打包复制到所有的服务器节点中
+
+3. 首先在配置为 **DOWNLOAD_SERVER** 的服务器中
+
+   + 运行 `submarine-installer/install.sh` 命令
+
+   + 在安装界面中选择 `[start download server]` 菜单项,等待下载完各个依赖包后,启动 HTTP 服务
+
+4. 在其他需要进行部署的服务器中
+
+   运行 `submarine-installer/install.sh` 命令,显示的主菜单 **[Main menu]** 中有以下菜单:
+
+   + prepare system environment
+   + install component
+   + uninstall component
+   + start component
+   + stop component
+   + start download server
+
+5. **prepare system environment**
+
+   + **prepare operation system**
+
+     检查部署服务器的操作系统和版本;
+
+   + **prepare operation system kernel**
+
+     显示操作系统内核更新的操作命令的提示信息,根据你的选择是否自动更新内核版本;
+
+   + **prepare GCC version**
+
+     显示操作系统中现在的 GCC 版本内核更新的操作命令的提示信息和根据你的选择是否自动更新 GCC 版本;
+
+   + **check GPU**
+
+     检查服务器是否能够检测到 GPU 显卡;
+
+   + **prepare user&group**
+
+     显示添加 hadoop 和 docker 的用户和用户组操作命令的提示信息,需要你自己根据提示信息检查服务器中是否存在所需要的用户和用户组;
+
+   + **prepare nvidia environment**
+
+     自动进行操作系统内核和头文件的更新,自动安装 `epel-release` 和 `dkms` ;
+
+     显示修改系统内核参数配置的操作命令的提示信息,需要你另外打开一个终端根据命令顺序执行;
+
+6. install component
+
+   + **instll etcd**
+
+     下载 etcd 的 bin 文件,并安装到 `/usr/bin` 目录中;
+
+     根据  **ETCD_HOSTS** 配置项生成 `etcd.service` 文件, 安装到 `/etc/systemd/system/` 目录中;
+
+   + **instll docker**
+
+     下载 docker 的 RPM 包进行本地安装;
+
+     生成 `daemon.json` 配置文件,安装到 `/etc/docker/` 目录中;
+
+     生成 `docker.service` 配置文件,安装到 `/etc/systemd/system/` 目录中;
+
+   + **instll calico network**
+
+     下载 `calico` 、`calicoctl` 和 `calico-ipam` 文件,安装到 `/usr/bin` 目录中;
+
+     生成 `calicoctl.cfg` 配置文件,安装到 `/etc/calico/` 目录中;
+
+     生成 `calico-node.service` 配置文件,安装到 `/etc/systemd/system/` 目录中;
+
+     安装完毕后,会在容器中会根据 **CALICO_NETWORK_NAME** 配置项自动创建 calico network,并自动创建 2 个 Docker 容器,检查 2 个容器是否能偶互相 PING 通;
+
+   + **instll nvidia driver**
+
+     下载 `nvidia-detect` 文件,在服务器中检测显卡版本;
+
+     根据显卡版本号下载 Nvidia 显卡驱动安装包;
+
+     检测本服务器中是否 `disabled Nouveau` ,如果没有停止安装,那么你需要执行 **[prepare system environment]** 菜单中的 **[prepare nvidia environment]** 子菜单项,按照提示进行操作;
+
+     如果本服务器中已经 `disabled Nouveau` ,那么就会进行本地安装;
+
+   + **instll nvidia docker**
+
+     下载 `nvidia-docker` 的 RPM 安装包并进行安装;
+
+     显示检测 `nvidia-docker` 是否可用的命令提示信息,需要你另外打开一个终端根据命令顺序执行;
+
+   + **instll yarn container-executor**
+
+     根据 **YARN_CONTAINER_EXECUTOR_PATH 配置项**,将 `container-executor` 文件复制到 `/etc/yarn/sbin/Linux-amd64-64/` 目录中;
+
+     根据配置生成 `container-executor.cfg` 文件,复制到 `/etc/yarn/sbin/etc/hadoop/` 目录中;
+
+   + **instll submarine autorun script**
+
+     复制 `submarine.sh` 文件到 `/etc/rc.d/init.d/` 目录中;
+
+     将 `/etc/rc.d/init.d/submarine.sh` 添加到 `/etc/rc.d/rc.local` 系统自启动文件中;
+
+7. uninstall component
+
+   删除指定组件的 BIN 文件和配置文件,不在复述
+
+   - uninstll etcd
+   - uninstll docker
+   - uninstll calico network
+   - uninstll nvidia driver
+   - uninstll nvidia docker
+   - uninstll yarn container-executor
+   - uninstll submarine autorun script
+
+8. start component
+
+   重启指定组件,不在复述
+
+   - start etcd
+   - start docker
+   - start calico network
+
+9. stop component
+
+   停止指定组件,不在复述
+
+   - stop etcd
+   - stop docker
+   - stop calico network
+
+10. start download server
+
+   只能在 **DOWNLOAD_SERVER_IP 配置项** 所在的服务器中才能执行本操作;
+

http://git-wip-us.apache.org/repos/asf/hadoop/blob/ed08dd3b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/src/site/markdown/InstallationScriptEN.md
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/src/site/markdown/InstallationScriptEN.md b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/src/site/markdown/InstallationScriptEN.md
new file mode 100644
index 0000000..c1a408f
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/src/site/markdown/InstallationScriptEN.md
@@ -0,0 +1,250 @@
+<!---
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License. See accompanying LICENSE file.
+-->
+
+
+# submarine installer
+
+## Introduction
+
+Hadoop {Submarine} is the latest machine learning framework subproject in the Hadoop 3.2 release. It allows Hadoop to support `Tensorflow`, `MXNet`,` Caffe`, `Spark`, etc. A variety of deep learning frameworks provide a full-featured system framework for machine learning algorithm development, distributed model training, model management, and model publishing, combined with hadoop's intrinsic data storage and data processing capabilities to enable data scientists to Good mining and the value of the data.
+
+Hadoop has enabled YARN to support Docker container since 2.x. **Hadoop {Submarine}** then uses YARN to schedule and run the distributed deep learning framework in the form of a Docker container.
+
+Since the distributed deep learning framework needs to run in multiple Docker containers and needs to be able to coordinate the various services running in the container, complete the services of model training and model publishing for distributed machine learning. Involving multiple system engineering problems such as `DNS`, `Docker`, `GPU`, `Network`, `graphics card`, `operating system kernel` modification, etc. It is very difficult and time-consuming to properly deploy the **Hadoop {Submarine}** runtime environment.
+
+In order to reduce the difficulty of deploying components, we have developed this **submarine-installer** project to deploy the **Hadoop {Submarine}** runtime environment, providing a one-click installation script or step-by-step installation. Unload, start, and stop individual components, and explain the main parameter configuration and considerations for each step. We also submitted a [Chinese manual](InstallationGuideChineseVersion.md) and an [English manual](InstallationGuide.md) for the **Hadoop {Submarine}** runtime environment to the hadoop community to help users deploy more easily and find problems in a timely manner.
+
+This installer is just created for your convenience. You can choose to install required libraries by yourself.
+
+## prerequisites
+
+**submarine-installer** currently only supports operating systems based on `centos-release-7-3.1611.el7.centos.x86_64` and above.
+
+## Configuration instructions
+
+Before deploying with submarine-installer, you can refer to the existing configuration parameters and format in the `install.conf` file, and configure the following parameters according to your usage:
+
++ **DNS Configuration**
+
+  LOCAL_DNS_HOST: server-side local DNS IP address configuration, which can be viewed from `/etc/resolv.conf`
+
+  YARN_DNS_HOST: yarn dns server started IP address
+
++ **ETCD Configuration**
+
+  Machine learning is a computationally-density system that requires very high data transmission performance. Therefore, we use the ETCD network component with the least network efficiency loss. It can support the overlay network through BGP routing and support tunnel mode when deployed across the equipment room.
+
+  Please note that you can choose to use different Docker networks. ETCD is not the only network solution supported by Submarine.
+
+  You need to select at least three servers as the running server for ETCD, which will make **Hadoop {Submarine}** better fault tolerant and stable.
+
+  Enter the IP array as the ETCD server in the ETCD_HOSTS configuration item. The parameter configuration is generally like this:
+
+  ETCD_HOSTS=(hostIP1 hostIP2 hostIP3). Note that spaces between multiple hostIPs should be separated by spaces.
+
++ **DOCKER_REGISTRY Configuration**
+
+  You can follow the following step to setup your Docker registry. But it is not a hard requirement since you can use a pre-setup Docker registry instead.
+
+  You first need to install an image management repository for the available docker. This image repository is used to store the image files of the various deep learning frameworks you need, and then configure the IP address and port of the mirror repository. The parameter configuration is generally the same :
+
+  DOCKER_REGISTRY="10.120.196.232:5000"
+
++ **DOWNLOAD_SERVER Configuration**
+
+  By default, **submarine-installer** downloads all dependencies directly from the network (eg GCC, Docker, Nvidia drivers, etc.), which often takes a lot of time and cannot be used in environments where some servers cannot connect to the Internet. Deployment, so we built the HTTP download service in **submarine-installer**, you only need to run **submarine-installer** on a server that can connect to the Internet, you can download the dependencies for all other servers, you only need Follow these configurations:
+
+  1. First, you need to configure `DOWNLOAD_SERVER_IP` as a server IP address that can connect to the Internet, and configure `DOWNLOAD_SERVER_PORT` as a port that is not very common.
+  2. After running the `submarine-installer/install.sh` command on the server where `DOWNLOAD_SERVER_IP` is located, select the `[start download server]` menu item in the installation interface. **submarine-installer** will download all the dependencies of the deployment to the server. In the `submarine-installer/downloads` directory, start an HTTP download service with the `python -m SimpleHTTPServer ${DOWNLOAD_SERVER_PORT}` command. Do not close the **submarine-installer** running on this server.
+  3. When you run the `submarine-installer/install.sh` command on other servers and follow the `[install component]` menu in the installation interface to install each component in turn, it will automatically download the dependencies from the server where `DOWNLOAD_SERVER_IP` is located for installation and deployment. .
+  4. **DOWNLOAD_SERVER** Another useful thing is that you can manually download the dependencies by hand, put them in the `submarine-installer/downloads` directory of one of the servers, and then open `[start download server]`, so that you can The cluster provides the ability to deploy offline deployments.
+
++ **YARN_CONTAINER_EXECUTOR_PATH Configuration**
+
+  You can get container-executor binary from either binary release package or build from source.
+  You need to fill in the full path of the container-executor file in the `YARN_CONTAINER_EXECUTOR_PATH` configuration item.
+
++ **YARN_HIERARCHY Configuration**
+
+  Please keep the same configuration as `yarn.nodemanager.linux-container-executor.cgroups.hierarchy` in the `yarn-site.xml` configuration file of the YARN cluster you are using. If this is not configured in `yarn-site.xml`, Then the default is `/hadoop-yarn`.
+
++ **YARN_NODEMANAGER_LOCAL_DIRS Configuration**
+
+  Please keep the same configuration as `yarn.nodemanager.local-dirs` in the `yarn-site.xml` configuration file of the YARN cluster you are using.
+
++ **YARN_NODEMANAGER_LOG_DIRS Configuration**
+
+  Please keep the same configuration as `yarn.nodemanager.log-dirs` in the `yarn-site.xml` configuration file of the YARN cluster you are using.
+
+## Instructions for use
+
+**submarine-installer** is completely written in shell script. It does not need to install any deployment tools such as ansible. It avoids different server management specifications of different company users and causes the program to be uncommon. For example, some computer rooms do not allow ROOT users to directly remotely through SHELL. Server operation, etc.
+
+The deployment process of **submarine-installer** is completely performed by selecting the operation in the menu. It avoids misoperations. You can also install, uninstall, and start any component in each step through various menu items. And the various components are stopped, and the flexibility is very good. After some components have problems, the system can also be diagnosed and repaired by **submarine-installer**.
+
+**submarine-installer** The log information is displayed on the screen during the deployment process. The log information has three font colors:
+
++ Red font color: Indicates that the component installation has an error and the deployment has terminated.
+
++ Green text color: The component is installed properly and the deployment is working properly.
+
++ Blue text color: You need to manually enter the command in another SHELL terminal according to the prompt information. Generally, modify the operating system kernel configuration operation, and follow the prompt information to operate it.
+
+**Start submarine-installer**
+
+Run the `submarine-installer/install.sh` command to start. The deployment program first detects the IP address of the network card in the server. If the server has multiple network cards or multiple IP addresses configured, it will be displayed in the form of a list. Select the one you actually use. IP address.
+
+**submarine-installer**  Menu description:
+
+![alt text](./images/submarine-installer.gif "Submarine Installer")
+
+## Deployment instructions
+
+The deployment process is as follows:
+
+1. Refer to the configuration instructions to configure the `install.conf` file based on your server usage.
+
+2. Copy the entire **submarine-installer** folder to all server nodes
+
+3. First in the server configured as **DOWNLOAD_SERVER**
+
+   + Run the `submarine-installer/install.sh` command
+
+   + Select the `[start download server]` menu item in the installation interface, and wait for the download of each dependency package to start the HTTP service.
+
+4. **In other servers that need to be deployed**
+
+   Run the `submarine-installer/install.sh` command to display the following menu in the main menu **[Main menu]**:
+
+   + prepare system environment
+   + install component
+   + uninstall component
+   + start component
+   + stop component
+   + start download server
+
+5. **prepare system environment**
+
+   - **prepare operation system**
+
+     Check the operating system and version of the deployment server;
+
+   - **prepare operation system kernel**
+
+     Display the prompt information of the operation command of the operating system kernel update, and automatically update the kernel version according to your choice;
+
+   - **prepare GCC version**
+
+     Display the prompt information of the operation command of the current GCC version kernel update in the operating system and whether to automatically update the GCC version according to your choice;
+
+   - **check GPU**
+
+     Check if the server can detect the GPU graphics card;
+
+   - **prepare user&group**
+
+     Display the prompts for adding user and user group operation commands for hadoop and docker. You need to check whether there are any required users and user groups in the server according to the prompt information.
+
+   - **prepare nvidia environment**
+
+     Automatically update the operating system kernel and header files, and automatically install `epel-release` and `dkms`;
+
+     Display the prompt information for modifying the operation command of the system kernel parameter configuration, you need to open another terminal according to the command sequence;
+
+6. **install component**
+
+   - **instll etcd**
+
+     Download the bin file for etcd and install it in the `/usr/bin` directory;
+
+     Generate the `etcd.service` file according to the **ETCD_HOSTS** configuration item and install it into the `/etc/systemd/system/` directory.
+
+   - **instll docker**
+
+     Download docker's RPM package for local installation;
+
+     Generate the `daemon.json` configuration file and install it into the `/etc/docker/` directory.
+
+     Generate the `docker.service` configuration file and install it into the `/etc/systemd/system/` directory.
+
+   - **instll calico network**
+
+     Download the `calico`, `calicoctl`, and `calico-ipam` files and install them in the `/usr/bin` directory.
+
+     Generate the `calicoctl.cfg` configuration file and install it into the `/etc/calico/` directory.
+
+     Generate the `calico-node.service` configuration file and install it into the `/etc/systemd/system/` directory.
+
+     After the installation is complete, the calico network will be automatically created in the container according to the **CALICO_NETWORK_NAME** configuration item, and two Docker containers will be created automatically to check whether the two containers can even ping each other.
+
+   - **instll nvidia driver**
+
+     Download the `nvidia-detect` file to detect the graphics card version in the server;Download the `nvidia-detect` file to detect the graphics card version in the server;
+
+     Download the Nvidia graphics driver installation package according to the graphics card version number;
+
+     Check if the Nouveau is disabled in this server. If the installation is not stopped, you need to execute the **[prepare nvidia environment]** submenu item in the **[prepare system environment]** menu and follow the prompts.
+
+     If Nouveau has been disabled in this server, it will be installed locally;
+
+   - **instll nvidia docker**
+
+     Download the nvidia-docker RPM installation package and install it;
+
+     Display the command prompt information to detect whether nvidia-docker is available. You need to open another terminal to execute according to the command sequence.
+
+   - **instll yarn container-executor**
+
+     Copy the `container-executor` file to the `/etc/yarn/sbin/Linux-amd64-64/` directory according to the **YARN_CONTAINER_EXECUTOR_PATH** configuration item;
+
+     Generate the `container-executor.cfg` file according to the configuration and copy it to the `/etc/yarn/sbin/etc/hadoop/` directory.
+
+   - **instll submarine autorun script**
+
+     Copy the submarine.sh file to the `/etc/rc.d/init.d/` directory;
+
+     Add `/etc/rc.d/init.d/submarine.sh` to the `/etc/rc.d/rc.local` system self-starting file;
+
+7. uninstall component
+
+   Delete the BIN file and configuration file of the specified component, not in the retelling
+
+   - uninstll etcd
+   - uninstll docker
+   - uninstll calico network
+   - uninstll nvidia driver
+   - uninstll nvidia docker
+   - uninstll yarn container-executor
+   - uninstll submarine autorun script
+
+8. start component
+
+   Restart the specified component, not repeat
+
+   - start etcd
+   - start docker
+   - start calico network
+
+9. stop component
+
+   Stop specifying component, not repeating
+
+   - stop etcd
+   - stop docker
+   - stop calico network
+
+10. start download server
+
+   This operation can only be performed on the server where the **DOWNLOAD_SERVER_IP** configuration item is located;
+

http://git-wip-us.apache.org/repos/asf/hadoop/blob/ed08dd3b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/src/site/markdown/TestAndTroubleshooting.md
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/src/site/markdown/TestAndTroubleshooting.md b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/src/site/markdown/TestAndTroubleshooting.md
new file mode 100644
index 0000000..3acf81a
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/src/site/markdown/TestAndTroubleshooting.md
@@ -0,0 +1,165 @@
+<!---
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License. See accompanying LICENSE file.
+-->
+
+#### Test with a tensorflow job
+
+Distributed-shell + GPU + cgroup
+
+```bash
+ ./yarn jar /home/hadoop/hadoop-current/share/hadoop/yarn/hadoop-yarn-submarine-3.2.0-SNAPSHOT.jar job run \
+ --env DOCKER_JAVA_HOME=/opt/java \
+ --env DOCKER_HADOOP_HDFS_HOME=/hadoop-3.1.0 --name distributed-tf-gpu \
+ --env YARN_CONTAINER_RUNTIME_DOCKER_CONTAINER_NETWORK=calico-network \
+ --worker_docker_image gpu-cuda9.0-tf1.8.0-with-models \
+ --ps_docker_image dockerfile-cpu-tf1.8.0-with-models \
+ --input_path hdfs://${dfs_name_service}/tmp/cifar-10-data \
+ --checkpoint_path hdfs://${dfs_name_service}/user/hadoop/tf-distributed-checkpoint \
+ --num_ps 0 \
+ --ps_resources memory=4G,vcores=2,gpu=0 \
+ --ps_launch_cmd "python /test/cifar10_estimator/cifar10_main.py --data-dir=hdfs://${dfs_name_service}/tmp/cifar-10-data --job-dir=hdfs://${dfs_name_service}/tmp/cifar-10-jobdir --num-gpus=0" \
+ --worker_resources memory=4G,vcores=2,gpu=1 --verbose \
+ --num_workers 1 \
+ --worker_launch_cmd "python /test/cifar10_estimator/cifar10_main.py --data-dir=hdfs://${dfs_name_service}/tmp/cifar-10-data --job-dir=hdfs://${dfs_name_service}/tmp/cifar-10-jobdir --train-steps=500 --eval-batch-size=16 --train-batch-size=16 --sync --num-gpus=1"
+```
+
+
+
+## Issues:
+
+### Issue 1: Fail to start nodemanager after system reboot
+
+```
+2018-09-20 18:54:39,785 ERROR org.apache.hadoop.yarn.server.nodemanager.LinuxContainerExecutor: Failed to bootstrap configured resource subsystems!
+org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.resources.ResourceHandlerException: Unexpected: Cannot create yarn cgroup Subsystem:cpu Mount points:/proc/mounts User:yarn Path:/sys/fs/cgroup/cpu,cpuacct/hadoop-yarn
+  at org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.resources.CGroupsHandlerImpl.initializePreMountedCGroupController(CGroupsHandlerImpl.java:425)
+  at org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.resources.CGroupsHandlerImpl.initializeCGroupController(CGroupsHandlerImpl.java:377)
+  at org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.resources.CGroupsCpuResourceHandlerImpl.bootstrap(CGroupsCpuResourceHandlerImpl.java:98)
+  at org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.resources.CGroupsCpuResourceHandlerImpl.bootstrap(CGroupsCpuResourceHandlerImpl.java:87)
+  at org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.resources.ResourceHandlerChain.bootstrap(ResourceHandlerChain.java:58)
+  at org.apache.hadoop.yarn.server.nodemanager.LinuxContainerExecutor.init(LinuxContainerExecutor.java:320)
+  at org.apache.hadoop.yarn.server.nodemanager.NodeManager.serviceInit(NodeManager.java:389)
+  at org.apache.hadoop.service.AbstractService.init(AbstractService.java:164)
+  at org.apache.hadoop.yarn.server.nodemanager.NodeManager.initAndStartNodeManager(NodeManager.java:929)
+  at org.apache.hadoop.yarn.server.nodemanager.NodeManager.main(NodeManager.java:997)
+2018-09-20 18:54:39,789 INFO org.apache.hadoop.service.AbstractService: Service NodeManager failed in state INITED
+```
+
+Solution: Grant user yarn the access to  `/sys/fs/cgroup/cpu,cpuacct`, which is the subfolder of cgroup mount destination.
+
+```
+chown :yarn -R /sys/fs/cgroup/cpu,cpuacct
+chmod g+rwx -R /sys/fs/cgroup/cpu,cpuacct
+```
+
+If GPUs are used,the access to cgroup devices folder is neede as well
+
+```
+chown :yarn -R /sys/fs/cgroup/devices
+chmod g+rwx -R /sys/fs/cgroup/devices
+```
+
+
+### Issue 2: container-executor permission denied
+
+```
+2018-09-21 09:36:26,102 WARN org.apache.hadoop.yarn.server.nodemanager.containermanager.linux.privileged.PrivilegedOperationExecutor: IOException executing command:
+java.io.IOException: Cannot run program "/etc/yarn/sbin/Linux-amd64-64/container-executor": error=13, Permission denied
+        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
+        at org.apache.hadoop.util.Shell.runCommand(Shell.java:938)
+        at org.apache.hadoop.util.Shell.run(Shell.java:901)
+        at org.apache.hadoop.util.Shell$ShellCommandExecutor.execute(Shell.java:1213)
+```
+
+Solution: The permission of `/etc/yarn/sbin/Linux-amd64-64/container-executor` should be 6050
+
+### Issue 3:How to get docker service log
+
+Solution: we can get docker log with the following command
+
+```
+journalctl -u docker
+```
+
+### Issue 4:docker can't remove containers with errors like `device or resource busy`
+
+```bash
+$ docker rm 0bfafa146431
+Error response from daemon: Unable to remove filesystem for 0bfafa146431771f6024dcb9775ef47f170edb2f1852f71916ba44209ca6120a: remove /app/docker/containers/0bfafa146431771f6024dcb9775ef47f170edb2f152f71916ba44209ca6120a/shm: device or resource busy
+```
+
+Solution: to find which process leads to a `device or resource busy`, we can add a shell script, named `find-busy-mnt.sh`
+
+```bash
+#!/bin/bash
+
+# A simple script to get information about mount points and pids and their
+# mount namespaces.
+
+if [ $# -ne 1 ];then
+echo "Usage: $0 <devicemapper-device-id>"
+exit 1
+fi
+
+ID=$1
+
+MOUNTS=`find /proc/*/mounts | xargs grep $ID 2>/dev/null`
+
+[ -z "$MOUNTS" ] &&  echo "No pids found" && exit 0
+
+printf "PID\tNAME\t\tMNTNS\n"
+echo "$MOUNTS" | while read LINE; do
+PID=`echo $LINE | cut -d ":" -f1 | cut -d "/" -f3`
+# Ignore self and thread-self
+if [ "$PID" == "self" ] || [ "$PID" == "thread-self" ]; then
+  continue
+fi
+NAME=`ps -q $PID -o comm=`
+MNTNS=`readlink /proc/$PID/ns/mnt`
+printf "%s\t%s\t\t%s\n" "$PID" "$NAME" "$MNTNS"
+done
+```
+
+Kill the process by pid, which is found by the script
+
+```bash
+$ chmod +x find-busy-mnt.sh
+./find-busy-mnt.sh 0bfafa146431771f6024dcb9775ef47f170edb2f152f71916ba44209ca6120a
+# PID   NAME            MNTNS
+# 5007  ntpd            mnt:[4026533598]
+$ kill -9 5007
+```
+
+
+### Issue 5:Failed to execute `sudo nvidia-docker run`
+
+```
+docker: Error response from daemon: create nvidia_driver_361.42: VolumeDriver.Create: internal error, check logs for details.
+See 'docker run --help'.
+```
+
+Solution:
+
+```
+#check nvidia-docker status
+$ systemctl status nvidia-docker
+$ journalctl -n -u nvidia-docker
+#restart nvidia-docker
+systemctl stop nvidia-docker
+systemctl start nvidia-docker
+```
+
+### Issue 6:Yarn failed to start containers
+
+if the number of GPUs required by applications is larger than the number of GPUs in the cluster, there would be some containers can't be created.
+

http://git-wip-us.apache.org/repos/asf/hadoop/blob/ed08dd3b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/src/site/resources/images/submarine-installer.gif
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/src/site/resources/images/submarine-installer.gif b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/src/site/resources/images/submarine-installer.gif
new file mode 100644
index 0000000..56b3b69
Binary files /dev/null and b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/src/site/resources/images/submarine-installer.gif differ


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


[4/5] hadoop git commit: YARN-8892. YARN UI2 doc changes to update security status (verified under security environment). (Sunil G via wangda)

Posted by wa...@apache.org.
YARN-8892. YARN UI2 doc changes to update security status (verified under security environment). (Sunil G via wangda)

Change-Id: I8bc8622936861b8d6de3e42a0b75af86ad8a3961


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/538250db
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/538250db
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/538250db

Branch: refs/heads/trunk
Commit: 538250db26ce0b261bb74053348cddfc2d65cf52
Parents: 143d747
Author: Wangda Tan <wa...@apache.org>
Authored: Tue Oct 16 13:41:17 2018 -0700
Committer: Wangda Tan <wa...@apache.org>
Committed: Tue Oct 16 13:51:02 2018 -0700

----------------------------------------------------------------------
 .../hadoop-yarn/hadoop-yarn-site/src/site/markdown/YarnUI2.md      | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/538250db/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/YarnUI2.md
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/YarnUI2.md b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/YarnUI2.md
index 609ebe1..4c9daed 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/YarnUI2.md
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/YarnUI2.md
@@ -52,4 +52,4 @@ Open your browser, go to `rm-address:8088/ui2` and try it!
 Notes
 -------------
 
-- This UI framework is not verified under security environment, please use with caution under security environment.
+This UI framework is verified under security environment as well.


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


[3/5] hadoop git commit: YARN-8870. [Submarine] Add submarine installation scripts. (Xun Liu via wangda)

Posted by wa...@apache.org.
YARN-8870. [Submarine] Add submarine installation scripts. (Xun Liu via wangda)

Change-Id: I46e8d9fd32c7745c313030da62da41486a77b3ea


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/46d6e001
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/46d6e001
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/46d6e001

Branch: refs/heads/trunk
Commit: 46d6e0016610ced51a76189daeb3ad0e3dbbf94c
Parents: ed08dd3
Author: Wangda Tan <wa...@apache.org>
Authored: Tue Oct 16 13:36:59 2018 -0700
Committer: Wangda Tan <wa...@apache.org>
Committed: Tue Oct 16 13:51:02 2018 -0700

----------------------------------------------------------------------
 .../resources/assemblies/hadoop-yarn-dist.xml   |   8 +
 .../installation/install.conf                   |  74 ++++
 .../installation/install.sh                     | 116 +++++
 .../package/calico/calico-node.service          |  50 +++
 .../installation/package/calico/calicoctl.cfg   |  22 +
 .../installation/package/docker/daemon.json     |  23 +
 .../installation/package/docker/docker.service  |  35 ++
 .../installation/package/etcd/etcd.service      |  40 ++
 .../package/hadoop/container-executor.cfg       |  41 ++
 .../installation/package/submarine/submarine.sh |  25 ++
 .../installation/scripts/calico.sh              | 224 ++++++++++
 .../installation/scripts/docker.sh              | 166 +++++++
 .../installation/scripts/download-server.sh     |  42 ++
 .../installation/scripts/environment.sh         | 213 +++++++++
 .../installation/scripts/etcd.sh                | 152 +++++++
 .../installation/scripts/hadoop.sh              | 117 +++++
 .../installation/scripts/menu.sh                | 444 +++++++++++++++++++
 .../installation/scripts/nvidia-docker.sh       |  99 +++++
 .../installation/scripts/nvidia.sh              | 120 +++++
 .../installation/scripts/submarine.sh           |  38 ++
 .../installation/scripts/utils.sh               | 123 +++++
 21 files changed, 2172 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/46d6e001/hadoop-assemblies/src/main/resources/assemblies/hadoop-yarn-dist.xml
----------------------------------------------------------------------
diff --git a/hadoop-assemblies/src/main/resources/assemblies/hadoop-yarn-dist.xml b/hadoop-assemblies/src/main/resources/assemblies/hadoop-yarn-dist.xml
index a2ea08c..9c401e8 100644
--- a/hadoop-assemblies/src/main/resources/assemblies/hadoop-yarn-dist.xml
+++ b/hadoop-assemblies/src/main/resources/assemblies/hadoop-yarn-dist.xml
@@ -66,6 +66,14 @@
       <fileMode>0755</fileMode>
     </fileSet>
     <fileSet>
+      <directory>hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation</directory>
+      <outputDirectory>/share/hadoop/yarn/submarine-installer</outputDirectory>
+      <includes>
+        <include>**/*</include>
+      </includes>
+      <fileMode>0755</fileMode>
+    </fileSet>
+    <fileSet>
       <directory>hadoop-yarn/conf</directory>
       <outputDirectory>etc/hadoop</outputDirectory>
       <includes>

http://git-wip-us.apache.org/repos/asf/hadoop/blob/46d6e001/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/install.conf
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/install.conf b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/install.conf
new file mode 100644
index 0000000..82dcf61
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/install.conf
@@ -0,0 +1,74 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+##### install config #####
+
+# DNS
+LOCAL_DNS_HOST="172.17.0.9"   # /etc/resolv.conf
+YARN_DNS_HOST="10.196.69.173" # yarn dns server ip address
+
+# etcd hosts list
+ETCD_HOSTS=(10.196.69.173 10.196.69.174 10.196.69.175)
+
+# docker registry ip:port
+DOCKER_REGISTRY="10.120.196.232:5000"
+
+# Start the http download service on the specified server,
+# Will download all the dependencies in the http server,
+# Run the install script on other servers.
+# Automatically download dependencies from http,
+# Solve the problem that all servers are slow to download online.
+# At the same time, you can also manually download the dependencies to the downloads directory.
+# Offline installation of the system
+DOWNLOAD_SERVER_IP="10.120.196.236"
+DOWNLOAD_SERVER_PORT="19000"
+
+# yarn container-executor config
+# How to compile container-executor:
+# Go to the hadoop/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager
+# path and enter the command: mvn package -Pnative -DskipTests
+# Only the nodemanager is compiled. The path of the compiled container-executor is:
+# ./target/native/target/usr/local/bin/container-executor
+YARN_CONTAINER_EXECUTOR_PATH="Please enter the full path to the container-executor here"
+
+# Keep the same configuration as 'yarn.nodemanager.linux-container-executor.cgroups.hierarchy'
+# in yarn-site.xml, default '/hadoop-yarn'
+YARN_HIERARCHY="/hadoop-yarn"
+
+# Keep the same configuration as 'yarn.nodemanager.local-dirs' in yarn-site.xml
+YARN_NODEMANAGER_LOCAL_DIRS="/home/hadoop/disk/1/yarn/local,/home/hadoop/disk/2/yarn/local,/home/hadoop/disk/3/yarn/local"
+
+# Keep the same configuration as 'yarn.nodemanager.log-dirs' in yarn-site.xml
+YARN_NODEMANAGER_LOG_DIRS="/home/hadoop/disk/1/yarn/logs,/home/hadoop/disk/2/yarn/logs,/home/hadoop/disk/3/yarn/logs"
+
+##### System component download url address, Generally do not need to be modified #####
+DOCKER_REPO="https://yum.dockerproject.org/repo/main/centos/7/Packages"
+DOCKER_ENGINE_RPM="docker-engine-1.12.5-1.el7.centos.x86_64.rpm"
+DOCKER_ENGINE_SELINUX_RPM="docker-engine-selinux-1.12.5-1.el7.centos.noarch.rpm"
+
+NVIDIA_DETECT_URL="https://raw.githubusercontent.com/liuxunorg/submarine-installer/packages/nvidia/nvidia-detect"
+NVIDIA_DOCKER_RPM="nvidia-docker-1.0.1-1.x86_64.rpm"
+NVIDIA_DOCKER_RPM_URL="https://github.com/NVIDIA/nvidia-docker/releases/download/v1.0.1/${NVIDIA_DOCKER_RPM}"
+
+ETCD_TAR_GZ="etcd-v3.3.9-linux-amd64.tar.gz"
+ETCD_DOWNLOAD_URL="https://github.com/etcd-io/etcd/releases/download/v3.3.9/${ETCD_TAR_GZ}"
+
+CALICO_IPV4POOL_CIDR="192.20.0.0"
+CALICO_NETWORK_NAME="calico-network"
+CALICO_DOWNLOAD_URL="https://github.com/projectcalico/cni-plugin/releases/download/v1.11.7/calico"
+CALICO_IPAM_DOWNLOAD_URL="https://github.com/projectcalico/cni-plugin/releases/download/v1.11.7/calico-ipam"
+CALICOCTL_DOWNLOAD_URL="https://github.com/projectcalico/calicoctl/releases/download/v3.2.3/calicoctl"

http://git-wip-us.apache.org/repos/asf/hadoop/blob/46d6e001/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/install.sh
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/install.sh b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/install.sh
new file mode 100755
index 0000000..90b12c2
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/install.sh
@@ -0,0 +1,116 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# description: sumbarine install scripts.
+
+ROOT=$(cd "$(dirname "$0")"; pwd)
+SUBMARINE_INSTALLER_VERSION="v0.7"
+PACKAGE_DIR=${ROOT}/package
+SCRIPTS_DIR=${ROOT}/scripts
+INSTALL_TEMP_DIR=${ROOT}/temp
+DOWNLOAD_DIR=${ROOT}/downloads
+DATE=`date +%Y%m%d-%H:%M:%S`
+LOG=${ROOT}/logs/install.log.`date +%Y%m%d%H%M%S`
+LOCAL_HOST_IP_LIST=()
+LOCAL_HOST_IP=""
+OPERATING_SYSTEM=""
+DOWNLOAD_HTTP=""
+
+# import shell script
+. ${ROOT}/install.conf
+. ${ROOT}/scripts/calico.sh
+. ${ROOT}/scripts/docker.sh
+. ${ROOT}/scripts/download-server.sh
+. ${ROOT}/scripts/environment.sh
+. ${ROOT}/scripts/etcd.sh
+. ${ROOT}/scripts/hadoop.sh
+. ${ROOT}/scripts/menu.sh
+. ${ROOT}/scripts/nvidia.sh
+. ${ROOT}/scripts/nvidia-docker.sh
+. ${ROOT}/scripts/submarine.sh
+. ${ROOT}/scripts/utils.sh
+
+#================================= Main ========================================
+mkdir $ROOT/logs/ -p
+mkdir $INSTALL_TEMP_DIR -p
+mkdir $DOWNLOAD_DIR -p
+
+source /etc/os-release
+OPERATING_SYSTEM=$ID
+
+get_ip_list
+ipCount=${#LOCAL_HOST_IP_LIST[@]}
+if [[ $ipCount -eq 1 ]]; then
+  LOCAL_HOST_IP=${LOCAL_HOST_IP_LIST[0]}
+else
+  echo -e "Detect the network card IP in the server, \e[31m[${LOCAL_HOST_IP_LIST[@]}]\e[0m"
+  echo -n -e "please enter a valid IP address: "
+
+  read ipInput
+  if ! valid_ip $ipInput; then
+    echo -e "you input \e[31m$ipInput\e[0m address format is incorrect! " | tee -a $LOG
+    exit_install
+  else
+    LOCAL_HOST_IP=$ipInput
+  fi
+fi
+
+echo -n -e "Please confirm whether the IP address of this machine is \e[31m${LOCAL_HOST_IP}\e[0m?[y|n]"
+read myselect
+if [[ "$myselect" != "y" && "$myselect" != "Y" ]]; then
+  exit_install
+fi
+
+check_install_conf
+
+if [[ -n "$DOWNLOAD_SERVER_IP" && -n "$DOWNLOAD_SERVER_PORT" && "$DOWNLOAD_SERVER_IP" != "$LOCAL_HOST_IP" ]]; then
+  DOWNLOAD_HTTP="http://${DOWNLOAD_SERVER_IP}:${DOWNLOAD_SERVER_PORT}"
+fi
+
+check_install_user
+
+# 清理安装临时目录
+rm $INSTALL_TEMP_DIR/* -rf >>$LOG 2>&1
+
+menu_index="0"
+for ((j=1;;j++))
+do
+  menu
+  case "$menu_index" in
+    "0")
+      menu_index="$menu_choice"
+    ;;
+    "1"|"2"|"3"|"4"|"5")
+#     echo "aaaa=$menu_index-$menu_choice"
+      menu_process
+      if [[ $? = 1 ]]; then
+        echo "Press any key to return menu!"
+        read
+      fi
+    ;;
+    "a")
+      exit_install
+      ;;
+    "q")
+      exit_install
+      ;;
+    *)
+      menu_index="0"
+      menu_choice="0"
+      menu
+    ;;
+  esac
+done

http://git-wip-us.apache.org/repos/asf/hadoop/blob/46d6e001/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/package/calico/calico-node.service
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/package/calico/calico-node.service b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/package/calico/calico-node.service
new file mode 100644
index 0000000..744c419
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/package/calico/calico-node.service
@@ -0,0 +1,50 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+[Unit]
+Description=calico node
+After=docker.service
+Requires=docker.service
+
+[Service]
+User=root
+PermissionsStartOnly=true
+ExecStart=/usr/bin/docker run --net=host --privileged --name=calico-node \
+  -e ETCD_ENDPOINTS=ETCD_ENDPOINTS_REPLACE \
+  -e CALICO_LIBNETWORK_ENABLED=true \
+  -e CALICO_NETWORKING_BACKEND=bird \
+  -e CALICO_DISABLE_FILE_LOGGING=true \
+  -e CALICO_IPV4POOL_CIDR=CALICO_IPV4POOL_CIDR_REPLACE/16 \
+  -e CALICO_IPV4POOL_IPIP=always \
+  -e FELIX_DEFAULTENDPOINTTOHOSTACTION=ACCEPT \
+  -e FELIX_IPV6SUPPORT=false \
+  -e FELIX_LOGSEVERITYSCREEN=info \
+  -e FELIX_IPINIPMTU=1440 \
+  -e FELIX_HEALTHENABLED=true \
+  -e IP= \
+  -v /etc/calico/ssl:/etc/calico/ssl \
+  -v /var/run/calico:/var/run/calico \
+  -v /lib/modules:/lib/modules \
+  -v /run/docker/plugins:/run/docker/plugins \
+  -v /var/run/docker.sock:/var/run/docker.sock \
+  -v /var/log/calico:/var/log/calico \
+  calico/node:v2.6.2
+ExecStop=/usr/bin/docker rm -f calico-node
+Restart=always
+RestartSec=10
+
+[Install]
+WantedBy=multi-user.target
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/hadoop/blob/46d6e001/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/package/calico/calicoctl.cfg
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/package/calico/calicoctl.cfg b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/package/calico/calicoctl.cfg
new file mode 100644
index 0000000..44ada86
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/package/calico/calicoctl.cfg
@@ -0,0 +1,22 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+apiVersion: v1
+kind: calicoApiConfig
+metadata:
+spec:
+  datastoreType: "etcdv2"
+  etcdEndpoints: ETCD_ENDPOINTS_REPLACE
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/hadoop/blob/46d6e001/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/package/docker/daemon.json
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/package/docker/daemon.json b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/package/docker/daemon.json
new file mode 100644
index 0000000..052fe73
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/package/docker/daemon.json
@@ -0,0 +1,23 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+{
+    "insecure-registries": ["DOCKER_REGISTRY_REPLACE"],
+    "cluster-store":"CLUSTER_STORE_REPLACE",
+    "cluster-advertise":"LOCAL_HOST_IP_REPLACE:2375",
+    "dns": ["YARN_DNS_HOST_REPLACE", "LOCAL_DNS_HOST_REPLACE"],
+    "hosts": ["tcp://LOCAL_HOST_IP_REPLACE:2375","unix:///var/run/docker.sock"]
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/hadoop/blob/46d6e001/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/package/docker/docker.service
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/package/docker/docker.service b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/package/docker/docker.service
new file mode 100644
index 0000000..f444f99
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/package/docker/docker.service
@@ -0,0 +1,35 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+[Unit]
+Description=Docker Application Container Engine
+Documentation=http://docs.docker.io
+
+[Service]
+Environment="PATH=/usr/bin:/bin:/sbin:/usr/bin:/usr/sbin"
+ExecStart=/usr/bin/dockerd --log-level=error
+ExecStartPost=/sbin/iptables -I FORWARD -s 0.0.0.0/0 -j ACCEPT
+ExecReload=/bin/kill -s HUP $MAINPID
+Restart=on-failure
+RestartSec=5
+LimitNOFILE=infinity
+LimitNPROC=infinity
+LimitCORE=infinity
+Delegate=yes
+KillMode=process
+
+[Install]
+WantedBy=multi-user.target
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/hadoop/blob/46d6e001/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/package/etcd/etcd.service
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/package/etcd/etcd.service b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/package/etcd/etcd.service
new file mode 100644
index 0000000..5a44ce2
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/package/etcd/etcd.service
@@ -0,0 +1,40 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+[Unit]
+Description=etcd
+Documentation=https://github.com/coreos/etcd
+
+[Service]
+Type=notify
+Restart=always
+RestartSec=5s
+LimitNOFILE=40000
+TimeoutStartSec=0
+
+ExecStart=/usr/bin/etcd \
+   --name=ETCD_NODE_NAME_REPLACE \
+   --data-dir=/var/lib/etcd \
+   --listen-client-urls=http://LOCAL_HOST_REPLACE:2379,http://127.0.0.1:2379 \
+   --listen-peer-urls=http://LOCAL_HOST_REPLACE:2380 \
+   --advertise-client-urls=http://LOCAL_HOST_REPLACE:2379 \
+   --initial-advertise-peer-urls=http://LOCAL_HOST_REPLACE:2380 \
+   --initial-cluster=INITIAL_CLUSTER_REPLACE \
+   --initial-cluster-token=etcd-token \
+   --initial-cluster-state=new
+
+[Install]
+WantedBy=multi-user.target
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/hadoop/blob/46d6e001/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/package/hadoop/container-executor.cfg
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/package/hadoop/container-executor.cfg b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/package/hadoop/container-executor.cfg
new file mode 100644
index 0000000..9d9f0ca
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/package/hadoop/container-executor.cfg
@@ -0,0 +1,41 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+yarn.nodemanager.local-dirs=YARN_NODEMANAGER_LOCAL_DIRS_REPLACE
+yarn.nodemanager.linux-container-executor.group=yarn
+yarn.nodemanager.log-dirs=YARN_NODEMANAGER_LOG_DIRS_REPLACE
+banned.users=root
+allowed.system.users=yarn
+min.user.id=500
+
+[docker]
+module.enabled=true
+docker.binary=/usr/bin/docker
+docker.allowed.capabilities=SYS_CHROOT,MKNOD,SETFCAP,SETPCAP,FSETID,CHOWN,AUDIT_WRITE,SETGID,NET_RAW,FOWNER,SETUID,DAC_OVERRIDE,KILL,NET_BIND_SERVICE,DAC_READ_SEARCH,SYS_PTRACE,SYS_ADMIN
+docker.allowed.networks=bridge,host,none,CALICO_NETWORK_NAME_REPLACE
+docker.allowed.ro-mounts=/etc/group,/etc/passwd,/etc/krb5.conf,YARN_NODEMANAGER_LOCAL_DIRS_REPLACE,regex:^nvidia_driver_.*$
+docker.allowed.rw-mounts=YARN_NODEMANAGER_LOCAL_DIRS_REPLACE,YARN_NODEMANAGER_LOG_DIRS_REPLACE
+docker.privileged-containers.enabled=false
+docker.trusted.registries=local,centos,hortonworks,DOCKER_REGISTRY_REPLACE
+docker.allowed.volume-drivers=nvidia-docker
+docker.allowed.devices=regex:^/dev/nvidia.*$
+
+[gpu]
+module.enabled=true
+
+[cgroups]
+root=/sys/fs/cgroup
+yarn-hierarchy=YARN_HIERARCHY_REPLACE
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/hadoop/blob/46d6e001/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/package/submarine/submarine.sh
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/package/submarine/submarine.sh b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/package/submarine/submarine.sh
new file mode 100644
index 0000000..ffbc38f
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/package/submarine/submarine.sh
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Solution: Grant user yarn the access to /sys/fs/cgroup/cpu,cpuacct,
+# which is the subfolder of cgroup mount destination.
+chown :yarn -R /sys/fs/cgroup/cpu,cpuacct
+chmod g+rwx -R /sys/fs/cgroup/cpu,cpuacct
+
+# If GPUs are used,the access to cgroup devices folder is neede as well
+chown :yarn -R /sys/fs/cgroup/devices
+chmod g+rwx -R /sys/fs/cgroup/devices

http://git-wip-us.apache.org/repos/asf/hadoop/blob/46d6e001/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/scripts/calico.sh
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/scripts/calico.sh b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/scripts/calico.sh
new file mode 100644
index 0000000..bd40fcf
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/scripts/calico.sh
@@ -0,0 +1,224 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+## @description  download calico bin
+## @audience     public
+## @stability    stable
+function download_calico_bin()
+{
+  # submarin http server
+  if [[ -n "$DOWNLOAD_HTTP" ]]; then
+    MY_CALICOCTL_DOWNLOAD_URL=${DOWNLOAD_HTTP}/downloads/calico/calicoctl
+    MY_CALICO_DOWNLOAD_URL=${DOWNLOAD_HTTP}/downloads/calico/calico
+    MY_CALICO_IPAM_DOWNLOAD_URL=${DOWNLOAD_HTTP}/downloads/calico/calico-ipam
+  else
+    MY_CALICOCTL_DOWNLOAD_URL=${CALICOCTL_DOWNLOAD_URL}
+    MY_CALICO_DOWNLOAD_URL=${CALICO_DOWNLOAD_URL}
+    MY_CALICO_IPAM_DOWNLOAD_URL=${CALICO_IPAM_DOWNLOAD_URL}
+  fi
+
+  mkdir -p ${DOWNLOAD_DIR}/calico
+
+  if [[ -f ${DOWNLOAD_DIR}/calico/calico ]]; then
+    echo "${DOWNLOAD_DIR}/calico/calico is exist."
+  else
+    echo "download ${MY_CALICO_DOWNLOAD_URL} ..."
+    wget -P ${DOWNLOAD_DIR}/calico ${MY_CALICO_DOWNLOAD_URL}
+  fi
+
+  if [[ -f ${DOWNLOAD_DIR}/calico/calicoctl ]]; then
+    echo "${DOWNLOAD_DIR}/calico is exist."
+  else
+    echo "download ${MY_CALICOCTL_DOWNLOAD_URL} ..."
+    wget -P ${DOWNLOAD_DIR}/calico ${MY_CALICOCTL_DOWNLOAD_URL}
+  fi
+
+  if [[ -f ${DOWNLOAD_DIR}/calico/calico-ipam ]]; then
+    echo "${DOWNLOAD_DIR}/calico/calico-ipam is exist."
+  else
+    echo "download ${MY_CALICO_IPAM_DOWNLOAD_URL} ..."
+    wget -P ${DOWNLOAD_DIR}/calico ${MY_CALICO_IPAM_DOWNLOAD_URL}
+  fi
+}
+
+## @description  install calico bin
+## @audience     public
+## @stability    stable
+function install_calico_bin()
+{
+  download_calico_bin
+
+  cp -f ${DOWNLOAD_DIR}/calico/calico /usr/bin/calico
+  cp -f ${DOWNLOAD_DIR}/calico/calicoctl /usr/bin/calicoctl
+  cp -f ${DOWNLOAD_DIR}/calico/calico-ipam /usr/bin/calico-ipam
+
+  chmod +x /usr/bin/calico
+  chmod +x /usr/bin/calicoctl
+  chmod +x /usr/bin/calico-ipam
+}
+
+## @description  install calico config
+## @audience     public
+## @stability    stable
+function install_calico_config()
+{
+  mkdir -p /etc/calico
+
+  cp -rf ${PACKAGE_DIR}/calico ${INSTALL_TEMP_DIR}/
+
+  # 1. replace etcdEndpoints
+  # etcdEndpoints: https://10.196.69.173:2379,https://10.196.69.174:2379,https://10.196.69.175:2379
+  etcdEndpoints=''
+  index=0
+  etcdHostsSize=${#ETCD_HOSTS[@]}
+  for item in ${ETCD_HOSTS[@]}
+  do
+    index=$(($index+1))
+    etcdEndpoints="${etcdEndpoints}http:\/\/${item}:2379"
+    if [[ ${index} -lt ${etcdHostsSize} ]]; then
+      etcdEndpoints=${etcdEndpoints}","
+    fi
+  done
+  # echo "etcdEndpoints=${etcdEndpoints}"
+  sed -i "s/ETCD_ENDPOINTS_REPLACE/${etcdEndpoints}/g" $INSTALL_TEMP_DIR/calico/calicoctl.cfg >>$LOG
+
+  if [[ ! -d /etc/calico ]]; then
+    mkdir /etc/calico
+  else
+    rm -rf /etc/calico/*
+  fi
+
+  cp -f $INSTALL_TEMP_DIR/calico/calicoctl.cfg /etc/calico/calicoctl.cfg
+
+  sed -i "s/ETCD_ENDPOINTS_REPLACE/${etcdEndpoints}/g" $INSTALL_TEMP_DIR/calico/calico-node.service >>$LOG
+  sed -i "s/CALICO_IPV4POOL_CIDR_REPLACE/${CALICO_IPV4POOL_CIDR}/g" $INSTALL_TEMP_DIR/calico/calico-node.service >>$LOG
+  cp $INSTALL_TEMP_DIR/calico/calico-node.service /etc/systemd/system/ >>$LOG
+
+  systemctl daemon-reload
+  systemctl enable calico-node.service
+}
+
+## @description  modify kernel network config
+## @audience     public
+## @stability    stable
+function kernel_network_config()
+{
+  if [ `grep -c "net.ipv4.conf.all.rp_filter=1" /etc/sysctl.conf` -eq '0' ]; then
+    echo "net.ipv4.conf.all.rp_filter=1" >>/etc/sysctl.conf
+  fi
+
+  if [ `grep -c "net.ipv4.ip_forward=1" /etc/sysctl.conf` -eq '0' ]; then
+    echo "net.ipv4.ip_forward=1" >>/etc/sysctl.conf
+  fi
+
+  sysctl -p
+}
+
+## @description  check if the calico-network exist
+## @audience     public
+## @stability    stable
+function calico_network_exist()
+{
+  local dockerNetwokInfo=`docker network ls --filter NAME=${CALICO_NETWORK_NAME}`
+  echo ${dockerNetwokInfo} | grep ${CALICO_NETWORK_NAME}
+}
+
+## @description  verification calico
+## @audience     public
+## @stability    stable
+function verification_calico()
+{
+  echo " ===== Check if the network between 2 containers can be connected ====="
+  local claicoNetworkExist=`calico_network_exist`
+  if [[ "$claicoNetworkExist" = "" ]]; then
+    echo "Create a calico network"
+    docker network create --driver calico --ipam-driver calico-ipam ${CALICO_NETWORK_NAME}
+  else
+    echo "calico network ${CALICO_NETWORK_NAME} is exist."
+  fi
+
+  local verifyA="verify-calico-network-A"
+  local verifyAInfo=`containers_exist ${verifyA}`
+  if [[ -n "$verifyAInfo" ]]; then
+    echo "Delete existing container ${verifyA}."
+    docker stop ${verifyA}
+    docker rm ${verifyA}
+  fi
+  echo "Create containers verify-calico-network-A"
+  docker run --net ${CALICO_NETWORK_NAME} --name ${verifyA} -tid busybox
+
+  local verifyB="verify-calico-network-B"
+  local verifyBInfo=`containers_exist ${verifyB}`
+  if [[ -n "$verifyBInfo" ]]; then
+    echo "Delete existing container ${verifyB}."
+    docker stop ${verifyB}
+    docker rm ${verifyB}
+  fi
+  echo "Create containers verify-calico-network-B"
+  docker run --net ${CALICO_NETWORK_NAME} --name ${verifyB} -tid busybox
+
+  echo -e "\033[33m${verifyA} ping ${verifyB}\033[0m"
+  docker exec ${verifyA} ping ${verifyB} -c 5
+}
+
+## @description  install calico
+## @audience     public
+## @stability    stable
+function install_calico()
+{
+  kernel_network_config
+  install_calico_bin
+  install_calico_config
+  start_calico
+  verification_calico
+}
+
+## @description  uninstall calico
+## @audience     public
+## @stability    stable
+function uninstall_calico()
+{
+  echo "stop calico-node.service"
+  systemctl stop calico-node.service
+
+  echo "rm /usr/bin/calico ..."
+  rm /usr/bin/calicoctl
+  rm /usr/bin/calico
+  rm /usr/bin/calico-ipam
+
+  rm -rf /etc/calico/
+  rm /etc/systemd/system/calico-node.service
+  systemctl daemon-reload
+}
+
+## @description  start calico
+## @audience     public
+## @stability    stable
+function start_calico()
+{
+  systemctl restart calico-node.service
+  systemctl status calico-node.service
+}
+
+## @description  stop calico
+## @audience     public
+## @stability    stable
+function stop_calico()
+{
+  systemctl stop calico-node.service
+  systemctl status calico-node.service
+}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/46d6e001/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/scripts/docker.sh
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/scripts/docker.sh b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/scripts/docker.sh
new file mode 100644
index 0000000..26f19cc
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/scripts/docker.sh
@@ -0,0 +1,166 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+## @description  download docker rmp
+## @audience     public
+## @stability    stable
+function download_docker_rpm()
+{
+  # download http server
+  if [[ -n "$DOWNLOAD_HTTP" ]]; then
+    MY_DOCKER_ENGINE_SELINUX_RPM="${DOWNLOAD_HTTP}/downloads/docker/${DOCKER_ENGINE_SELINUX_RPM}"
+    MY_DOCKER_ENGINE_RPM="${DOWNLOAD_HTTP}/downloads/docker/${DOCKER_ENGINE_RPM}"
+  else
+    MY_DOCKER_ENGINE_SELINUX_RPM=${DOCKER_REPO}/${DOCKER_ENGINE_SELINUX_RPM}
+    MY_DOCKER_ENGINE_RPM=${DOCKER_REPO}/${DOCKER_ENGINE_RPM}
+  fi
+
+  # download docker rpm
+  if [[ -f ${DOWNLOAD_DIR}/docker/${DOCKER_ENGINE_SELINUX_RPM} ]]; then
+    echo "${DOWNLOAD_DIR}/docker/${DOCKER_ENGINE_SELINUX_RPM} is exist."
+  else
+    echo "download ${MY_DOCKER_ENGINE_SELINUX_RPM} ..."
+    wget -P ${DOWNLOAD_DIR}/docker/ ${MY_DOCKER_ENGINE_SELINUX_RPM}
+  fi
+
+  if [[ -f ${DOWNLOAD_DIR}/docker/${DOCKER_ENGINE_RPM} ]]; then
+    echo "${DOWNLOAD_DIR}/docker/${DOCKER_ENGINE_RPM} is exist."
+  else
+    echo "download ${MY_DOCKER_ENGINE_RPM} ..."
+    wget -P ${DOWNLOAD_DIR}/docker/ ${MY_DOCKER_ENGINE_RPM}
+  fi
+}
+
+## @description  install docker bin
+## @audience     public
+## @stability    stable
+function install_docker_bin()
+{
+  download_docker_rpm
+
+  yum -y localinstall ${DOWNLOAD_DIR}/docker/${DOCKER_ENGINE_SELINUX_RPM}
+  yum -y localinstall ${DOWNLOAD_DIR}/docker/${DOCKER_ENGINE_RPM}
+}
+
+## @description  uninstall docker bin
+## @audience     public
+## @stability    stable
+function uninstall_docker_bin()
+{
+  download_docker_rpm
+
+  yum -y remove ${DOWNLOAD_DIR}/docker/${DOCKER_ENGINE_SELINUX_RPM}
+  yum -y remove ${DOWNLOAD_DIR}/docker/${DOCKER_ENGINE_RPM}
+}
+
+## @description  install docker config
+## @audience     public
+## @stability    stable
+function install_docker_config()
+{
+  rm -rf ${INSTALL_TEMP_DIR}/docker
+  cp -rf ${PACKAGE_DIR}/docker ${INSTALL_TEMP_DIR}/
+
+  # replace cluster-store
+  # "cluster-store":"etcd://10.196.69.173:2379,10.196.69.174:2379,10.196.69.175:2379"
+  # char '/' need to escape '\/'
+  clusterStore="etcd:\/\/"
+  index=1
+  etcdHostsSize=${#ETCD_HOSTS[@]}
+  for item in ${ETCD_HOSTS[@]}
+  do
+    clusterStore="${clusterStore}${item}:2379"
+    if [[ ${index} -lt ${etcdHostsSize}-1 ]]; then
+      clusterStore=${clusterStore}","
+    fi
+    index=$(($index+1))
+  done
+  echo "clusterStore=${clusterStore}"
+  sed -i "s/CLUSTER_STORE_REPLACE/${clusterStore}/g" $INSTALL_TEMP_DIR/docker/daemon.json >>$LOG
+
+  sed -i "s/DOCKER_REGISTRY_REPLACE/${DOCKER_REGISTRY}/g" $INSTALL_TEMP_DIR/docker/daemon.json >>$LOG
+  sed -i "s/LOCAL_HOST_IP_REPLACE/${LOCAL_HOST_IP}/g" $INSTALL_TEMP_DIR/docker/daemon.json >>$LOG
+  sed -i "s/YARN_DNS_HOST_REPLACE/${YARN_DNS_HOST}/g" $INSTALL_TEMP_DIR/docker/daemon.json >>$LOG
+  sed -i "s/LOCAL_DNS_HOST_REPLACE/${LOCAL_DNS_HOST}/g" $INSTALL_TEMP_DIR/docker/daemon.json >>$LOG
+
+  # Delete the ASF license comment in the daemon.json file, otherwise it will cause a json format error.
+  sed -i '1,16d' $INSTALL_TEMP_DIR/docker/daemon.json
+
+  if [ ! -d "/etc/docker" ]; then
+    mkdir /etc/docker
+  fi
+
+  cp $INSTALL_TEMP_DIR/docker/daemon.json /etc/docker/
+  cp $INSTALL_TEMP_DIR/docker/docker.service /etc/systemd/system/ >>$LOG
+}
+
+## @description  install docker
+## @audience     public
+## @stability    stable
+function install_docker()
+{
+  install_docker_bin
+  install_docker_config
+
+  systemctl daemon-reload
+  systemctl enable docker.service
+}
+
+## @description  unstall docker
+## @audience     public
+## @stability    stable
+function uninstall_docker()
+{
+  echo "stop docker service"
+  systemctl stop docker
+
+  echo "remove docker"
+  uninstall_docker_bin
+
+  rm /etc/docker/daemon.json >>$LOG
+  rm /etc/systemd/system/docker.service >>$LOG
+
+  systemctl daemon-reload
+}
+
+## @description  start docker
+## @audience     public
+## @stability    stable
+function start_docker()
+{
+  systemctl restart docker
+  systemctl status docker
+  docker info
+}
+
+## @description  stop docker
+## @audience     public
+## @stability    stable
+function stop_docker()
+{
+  systemctl stop docker
+  systemctl status docker
+}
+
+## @description  check if the containers exist
+## @audience     public
+## @stability    stable
+function containers_exist()
+{
+  local dockerContainersInfo=`docker ps -a --filter NAME=$1`
+  echo ${dockerContainersInfo} | grep $1
+}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/46d6e001/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/scripts/download-server.sh
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/scripts/download-server.sh b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/scripts/download-server.sh
new file mode 100644
index 0000000..62af827
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/scripts/download-server.sh
@@ -0,0 +1,42 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+## @description  start download server
+## @audience     public
+## @stability    stable
+function start_download_server()
+{
+  if [[ "$DOWNLOAD_SERVER_IP" != "$LOCAL_HOST_IP" ]]; then
+    echo -e "\033[31mERROR: Only $DOWNLOAD_SERVER_IP can start the download service.\033[0m"
+    return 1
+  fi
+
+  echo -e "You can put the install package file in the \033[34m${DOWNLOAD_DIR}\033[0m folder first, Or automatic download."
+  echo -n "Do you want to start download http server?[y|n]"
+  read myselect
+  if [[ "$myselect" = "y" || "$myselect" = "Y" ]]
+  then
+    download_etcd_bin
+    download_calico_bin
+    download_docker_rpm
+    download_nvidia_driver
+    download_nvidia_docker_bin
+    download_yarn_container_executor
+
+    python -m SimpleHTTPServer ${DOWNLOAD_SERVER_PORT}
+  fi
+}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/46d6e001/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/scripts/environment.sh
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/scripts/environment.sh b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/scripts/environment.sh
new file mode 100644
index 0000000..17f59b2
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/scripts/environment.sh
@@ -0,0 +1,213 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+## @description  check operation System
+## @audience     public
+## @stability    stable
+function check_operationSystem()
+{
+  echo -e "The submarine assembly support \033[32m[centos-release-7-3.1611.el7.centos.x86_64]\033[0m or higher operating system version."
+
+  case ${OPERATING_SYSTEM} in
+  centos)
+    local operationSystemVersion=`rpm --query centos-release`
+    echo -e "The current operating system version is \e[31m[${operationSystemVersion}]\e[0m" | tee -a $LOG
+    ;;
+  *)
+    echo -e "\033[31mWARN: The submarine assembly Unsupported [${OPERATING_SYSTEM}] operating system\033[0m"
+    ;;
+  esac
+}
+
+## @description  update operation System Kernel
+## @audience     public
+## @stability    stable
+function update_operationSystemKernel()
+{
+  echo "If the server is unable to connect to the network, execute the following command yourself:
+        wget http://vault.centos.org/7.3.1611/os/x86_64/Packages/kernel-headers-3.10.0-514.el7.x86_64.rpm
+        rpm -ivh kernel-headers-3.10.0-514.el7.x86_64.rpm"
+
+  echo -n "Do you want to kernel upgrades?[y|n]"
+  read myselect
+  if [[ "$myselect" = "y" || "$myselect" = "Y" ]]
+  then
+    echo "Now try to use the yum command for kernel upgrades ..."
+    yum install kernel-devel-$(uname -r) kernel-headers-$(uname -r)
+
+    local kernelVersion=`uname -r`
+    echo -e "After the upgrade, the operating system kernel version is \e[31m${kernelVersion}\e[0m" | tee -a $LOG
+  fi
+}
+
+## @description  check operation system kernel
+## @audience     public
+## @stability    stable
+function check_operationSystemKernel()
+{
+case ${OPERATING_SYSTEM} in
+centos)
+  local kernelVersion=`uname -r`
+
+  echo -e "Submarine support operating system kernel version is \033[32m 3.10.0-514.el7.x86_64 \033[0m" | tee -a $LOG
+  echo -e "Current operating system kernel version is \e[31m${kernelVersion}\e[0m" | tee -a $LOG
+
+  update_operationSystemKernel
+  ;;
+*)
+  echo -e "\033[31m WARN: The submarine assembly Unsupported operating system [${OPERATING_SYSTEM}] \033[0m"
+  ;;
+esac
+}
+
+## @description  get gcc version
+## @audience     public
+## @stability    stable
+function get_gcc_version()
+{
+  local gccVersion=`gcc --version`
+  version=${gccVersion%Copyright*}
+  echo $version
+}
+
+## @description  install gcc
+## @audience     public
+## @stability    stable
+function install_gcc()
+{
+  echo -n "Do you want to install gcc?[y|n]"
+  read myselect
+  if [[ "$myselect" = "y" || "$myselect" = "Y" ]]; then
+    echo "Execute the yum install gcc make g++ command"
+    yum install gcc make g++
+
+    local gccVersion=`gcc --version`
+    echo -e "After the install, the gcc version is \e[31m${gccVersion}\e[0m" | tee -a $LOG
+  fi
+}
+
+## @description  check gcc Version
+## @audience     public
+## @stability    stable
+function check_gccVersion()
+{
+  local gccVersionInfo=`gcc --version`
+  local gccVersion=${gccVersionInfo%Copyright*}
+
+  if [[ "$gccVersion" = "" ]]; then
+    echo "The gcc was not installed on the system. Automated installation ..."
+    install_gcc
+  else
+    echo -e "Submarine gcc version need \033[34mgcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-11)\033[0m or higher."
+    echo -e "Current gcc version was \033[34m${gccVersion}\033[0m"
+  fi
+}
+
+## @description  check GPU
+## @audience     public
+## @stability    stable
+function check_GPU()
+{
+  gpuInfo=`lspci | grep -i nvidia`
+
+  if [[ "$gpuInfo" = "" ]]; then
+    echo -e "\033[31mERROR: The system did not detect the GPU graphics card.\033[0m"
+  else
+    echo -e "\033[32mINFO: The system detect the GPU graphics card.\033[0m"
+  fi
+}
+
+## @description  check user group
+## @audience     public
+## @stability    stable
+function check_userGroup()
+{
+  echo -e "check hadoop user group ..."
+
+  echo -e "Hadoop runs the required user [hdfs, mapred, yarn] and groups [hdfs, mapred, yarn, hadoop] installed by ambari."
+  echo -e "If you are not using ambari for hadoop installation,
+then you can add the user and group by root by executing the following command:
+\033[34madduser hdfs
+adduser mapred
+adduser yarn
+addgroup hadoop
+usermod -aG hdfs,hadoop hdfs
+usermod -aG mapred,hadoop mapred
+usermod -aG yarn,hadoop yarn
+usermod -aG hdfs,hadoop hadoop
+groupadd docker
+usermod -aG docker yarn
+usermod -aG docker hadoop\033[0m\n"
+
+  echo -e "check docker user group ..."
+  # check user group
+  DOCKER_USER_GROUP='docker'
+  egrep "^${DOCKER_USER_GROUP}" /etc/group >& /dev/null
+  if [[ $? -ne 0 ]]; then
+    echo -e "user group ${DOCKER_USER_GROUP} does not exist, Please execute the following command:"
+    echo -e "\033[34mgroupadd $DOCKER_USER_GROUP\033[0m"
+  fi
+
+  # check user
+  USER_GROUP=(yarn hadoop)
+  for user in ${USER_GROUP[@]}
+  do
+    egrep "^${user}" /etc/passwd >& /dev/null
+    if [[ $? -ne 0 ]]; then
+      echo -e "User ${user} does not exist, Please execute the following command:"
+      echo -e "\033[34madduser ${user}\033[0m"
+      echo -e "\033[34musermod -aG ${DOCKER_USER_GROUP} ${user}\033[0m"
+    fi
+
+    echo -e "Please execute the following command:"
+    echo -e "\033[34musermod -aG ${DOCKER_USER_GROUP} ${user}\033[0m"
+  done
+}
+
+## @description  Some preparatory work for nvidia driver installation
+## @audience     public
+## @stability    stable
+function prepare_nvidia_environment()
+{
+  echo "prepare nvidia environment ..."
+
+  yum -y update
+  yum install kernel-devel-$(uname -r) kernel-headers-$(uname -r)
+
+  yum -y install epel-release
+  yum -y install dkms
+
+  echo -e "\033[34m ===== Please manually execute the following command =====
+# 1. Disable nouveau
+# Add the content 'rd.driver.blacklist=nouveau nouveau.modeset=0'
+# to the 'GRUB_CMDLINE_LINUX' configuration item in the /etc/default/grub file.
+root:> vi /etc/default/grub
+vi:> GRUB_CMDLINE_LINUX=\"rd.driver.blacklist=nouveau nouveau.modeset=0 ...\"
+
+# 2. Generate configuration
+root:> grub2-mkconfig -o /boot/grub2/grub.cfg
+
+# 3. Open (new) /etc/modprobe.d/blacklist.conf, add content 'blacklist nouveau'
+root:> vi /etc/modprobe.d/blacklist.conf
+vi:> blacklist nouveau
+
+# 4. Update configuration and reboot
+root:> mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r)-nouveau.img
+root:> dracut /boot/initramfs-$(uname -r).img $(uname -r)
+root:> reboot
+\033[0m"
+}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/46d6e001/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/scripts/etcd.sh
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/scripts/etcd.sh b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/scripts/etcd.sh
new file mode 100644
index 0000000..48df80e
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/scripts/etcd.sh
@@ -0,0 +1,152 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+## @description  download etcd bin
+## @audience     public
+## @stability    stable
+function download_etcd_bin()
+{
+  # my download http server
+  if [[ -n "$DOWNLOAD_HTTP" ]]; then
+    MY_ETCD_DOWNLOAD_URL="${DOWNLOAD_HTTP}/downloads/etcd/${ETCD_TAR_GZ}"
+  else
+    MY_ETCD_DOWNLOAD_URL=${ETCD_DOWNLOAD_URL}
+  fi
+
+  if [[ -f "${DOWNLOAD_DIR}/etcd/${ETCD_TAR_GZ}" ]]; then
+    echo "${DOWNLOAD_DIR}/etcd/${ETCD_TAR_GZ} is exist."
+  else
+    echo "download ${MY_ETCD_DOWNLOAD_URL} ..."
+    wget -P ${DOWNLOAD_DIR}/etcd ${MY_ETCD_DOWNLOAD_URL}
+  fi
+}
+
+## @description  install etcd bin
+## @audience     public
+## @stability    stable
+function install_etcd_bin()
+{
+  download_etcd_bin
+
+  # install etcd bin
+  mkdir -p ${INSTALL_TEMP_DIR}
+  rm -rf ${INSTALL_TEMP_DIR}/etcd-*-linux-amd6
+  tar zxvf ${DOWNLOAD_DIR}/etcd/${ETCD_TAR_GZ} -C ${INSTALL_TEMP_DIR}
+
+  cp -f ${INSTALL_TEMP_DIR}/etcd-*-linux-amd64/etcd /usr/bin
+  cp -f ${INSTALL_TEMP_DIR}/etcd-*-linux-amd64/etcdctl /usr/bin
+
+  mkdir -p /var/lib/etcd
+  chmod -R a+rw /var/lib/etcd
+}
+
+## @description  install etcd config
+## @audience     public
+## @stability    stable
+function install_etcd_config()
+{
+  # config etcd.service
+  rm -rf ${INSTALL_TEMP_DIR}/etcd
+  cp -rf ${PACKAGE_DIR}/etcd ${INSTALL_TEMP_DIR}/
+
+  # 1. Replace name with ETCD_NODE_NAME_REPLACE based on the location of the local IP in $ETCD_HOSTS
+  indexEtcdList=$(indexByEtcdHosts ${LOCAL_HOST_IP})
+  # echo ${indexEtcdList}
+  etcdNodeName="etcdnode${indexEtcdList}"
+  # echo ${etcdNodeName}
+  sed -i "s/ETCD_NODE_NAME_REPLACE/${etcdNodeName}/g" $INSTALL_TEMP_DIR/etcd/etcd.service >>$LOG
+
+  # 2. Replace local IP address
+  sed -i "s/LOCAL_HOST_REPLACE/${LOCAL_HOST_IP}/g" $INSTALL_TEMP_DIR/etcd/etcd.service >>$LOG
+
+  # 3. Replace the initial-cluster parameter
+  # --initial-cluster=etcdnode1=http://10.196.69.173:2380,etcdnode2=http://10.196.69.174:2380,etcdnode3=http://10.196.69.175:2380 \
+  initialCluster=''
+  index=0
+  etcdHostsSize=${#ETCD_HOSTS[@]}
+  for item in ${ETCD_HOSTS[@]}
+  do
+    # char '/' need to escape '\/'
+    initialCluster="${initialCluster}etcdnode${index}=http:\/\/${item}:2380"
+    if [[ ${index} -lt ${etcdHostsSize}-1 ]]; then
+      initialCluster=${initialCluster}","
+    fi
+    index=$(($index+1))
+  done
+  #echo "initialCluster=${initialCluster}"
+  sed -i "s/INITIAL_CLUSTER_REPLACE/${initialCluster}/g" $INSTALL_TEMP_DIR/etcd/etcd.service >>$LOG
+
+  cp $INSTALL_TEMP_DIR/etcd/etcd.service /etc/systemd/system/ >>$LOG
+}
+
+## @description  install etcd
+## @audience     public
+## @stability    stable
+function install_etcd()
+{
+  index=$(indexByEtcdHosts ${LOCAL_HOST_IP})
+  if [ -z "$index" ]; then
+    echo -e "STOP: This host\033[31m[${LOCAL_HOST_IP}]\033[0m is not in the ETCD server list\033[31m[${ETCD_HOSTS[@]}]\033[0m"
+    return 1
+  fi
+
+  install_etcd_bin
+
+  install_etcd_config
+
+  systemctl daemon-reload
+  systemctl enable etcd.service
+}
+
+## @description  uninstall etcd
+## @audience     public
+## @stability    stable
+function uninstall_etcd()
+{
+  echo "stop etcd.service"
+  systemctl stop etcd.service
+
+  echo "rm etcd ..."
+  rm /usr/bin/etcd
+  rm /usr/bin/etcdctl
+  rm -rf /var/lib/etcd
+  rm /etc/systemd/system/etcd.service
+
+  systemctl daemon-reload
+}
+
+## @description  start etcd
+## @audience     public
+## @stability    stable
+function start_etcd()
+{
+  systemctl restart etcd.service
+
+  echo " ===== Check the status of the etcd service ====="
+  echo " exec etcdctl cluster-health"
+  etcdctl cluster-health
+  echo " exec etcdctl cluster-health"
+  etcdctl member list
+}
+
+## @description  stop etcd
+## @audience     public
+## @stability    stable
+function stop_etcd()
+{
+  systemctl stop etcd.service
+}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/46d6e001/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/scripts/hadoop.sh
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/scripts/hadoop.sh b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/scripts/hadoop.sh
new file mode 100644
index 0000000..9df5d7e
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/scripts/hadoop.sh
@@ -0,0 +1,117 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+## @description  install yarn
+## @audience     public
+## @stability    stable
+function install_yarn()
+{
+  install_yarn_container_executor
+  install_yarn_config
+}
+
+## @description  uninstall yarn
+## @audience     public
+## @stability    stable
+function uninstall_yarn()
+{
+  rm -rf /etc/yarn/sbin/Linux-amd64-64/*
+  rm -rf /etc/yarn/sbin/etc/hadoop/*
+}
+
+## @description  download yarn container executor
+## @audience     public
+## @stability    stable
+function download_yarn_container_executor()
+{
+  # my download http server
+  if [[ -n "$DOWNLOAD_HTTP" ]]; then
+    MY_YARN_CONTAINER_EXECUTOR_PATH="${DOWNLOAD_HTTP}/downloads/hadoop/container-executor"
+  else
+    MY_YARN_CONTAINER_EXECUTOR_PATH=${YARN_CONTAINER_EXECUTOR_PATH}
+  fi
+
+  if [ ! -d "${DOWNLOAD_DIR}/hadoop" ]; then
+    mkdir -p ${DOWNLOAD_DIR}/hadoop
+  fi
+
+  if [[ -f "${DOWNLOAD_DIR}/hadoop/container-executor" ]]; then
+    echo "${DOWNLOAD_DIR}/hadoop/container-executor is exist."
+  else
+    if [[ -n "$DOWNLOAD_HTTP" ]]; then
+      echo "download ${MY_YARN_CONTAINER_EXECUTOR_PATH} ..."
+      wget -P ${DOWNLOAD_DIR}/hadoop ${MY_YARN_CONTAINER_EXECUTOR_PATH}
+    else
+      echo "copy ${MY_YARN_CONTAINER_EXECUTOR_PATH} ..."
+      cp ${MY_YARN_CONTAINER_EXECUTOR_PATH} ${DOWNLOAD_DIR}/hadoop/
+    fi
+  fi
+}
+
+## @description  install yarn container executor
+## @audience     public
+## @stability    stable
+function install_yarn_container_executor()
+{
+  echo "install yarn container executor file ..."
+
+  download_yarn_container_executor
+
+  if [ ! -d "/etc/yarn/sbin/Linux-amd64-64" ]; then
+    mkdir -p /etc/yarn/sbin/Linux-amd64-64
+  fi
+  if [ -f "/etc/yarn/sbin/Linux-amd64-64/container-executor" ]; then
+    rm /etc/yarn/sbin/Linux-amd64-64/container-executor
+  fi
+
+  cp -f ${DOWNLOAD_DIR}/hadoop/container-executor /etc/yarn/sbin/Linux-amd64-64
+
+  sudo chmod 6755 /etc/yarn/sbin/Linux-amd64-64
+  sudo chown :yarn /etc/yarn/sbin/Linux-amd64-64/container-executor
+  sudo chmod 6050 /etc/yarn/sbin/Linux-amd64-64/container-executor
+}
+
+## @description  install yarn config
+## @audience     public
+## @stability    stable
+function install_yarn_config()
+{
+  echo "install yarn config file ..."
+
+  cp -R ${PACKAGE_DIR}/hadoop ${INSTALL_TEMP_DIR}/
+
+  find="/"
+  replace="\/"
+  escape_yarn_nodemanager_local_dirs=${YARN_NODEMANAGER_LOCAL_DIRS//$find/$replace}
+  escape_yarn_nodemanager_log_dirs=${YARN_NODEMANAGER_LOG_DIRS//$find/$replace}
+  escape_yarn_hierarchy=${YARN_HIERARCHY//$find/$replace}
+
+  sed -i "s/YARN_NODEMANAGER_LOCAL_DIRS_REPLACE/${escape_yarn_nodemanager_local_dirs}/g" $INSTALL_TEMP_DIR/hadoop/container-executor.cfg >>$LOG
+  sed -i "s/YARN_NODEMANAGER_LOG_DIRS_REPLACE/${escape_yarn_nodemanager_log_dirs}/g" $INSTALL_TEMP_DIR/hadoop/container-executor.cfg >>$LOG
+  sed -i "s/DOCKER_REGISTRY_REPLACE/${DOCKER_REGISTRY}/g" $INSTALL_TEMP_DIR/hadoop/container-executor.cfg >>$LOG
+  sed -i "s/CALICO_NETWORK_NAME_REPLACE/${CALICO_NETWORK_NAME}/g" $INSTALL_TEMP_DIR/hadoop/container-executor.cfg >>$LOG
+  sed -i "s/YARN_HIERARCHY_REPLACE/${escape_yarn_hierarchy}/g" $INSTALL_TEMP_DIR/hadoop/container-executor.cfg >>$LOG
+
+  # Delete the ASF license comment in the container-executor.cfg file, otherwise it will cause a cfg format error.
+  sed -i '1,16d' $INSTALL_TEMP_DIR/hadoop/container-executor.cfg
+
+  if [ ! -d "/etc/yarn/sbin/etc/hadoop" ]; then
+    mkdir -p /etc/yarn/sbin/etc/hadoop
+  fi
+
+  cp -f $INSTALL_TEMP_DIR/hadoop/container-executor.cfg /etc/yarn/sbin/etc/hadoop/
+}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/46d6e001/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/scripts/menu.sh
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/scripts/menu.sh b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/scripts/menu.sh
new file mode 100644
index 0000000..68f91c1
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/scripts/menu.sh
@@ -0,0 +1,444 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+## @description  main menu
+## @audience     public
+## @stability    stable
+main_menu()
+{
+cat<<MENULIST
+====================================================================================
+                            SUBMARINE INSTALLER ${SUBMARINE_INSTALLER_VERSION}
+
+HOST:${LOCAL_HOST_IP}            DOWNLOAD_SERVER:http://${DOWNLOAD_SERVER_IP}:${DOWNLOAD_SERVER_PORT}
+====================================================================================
+[Main menu]
+------------------------------------------------------------------------------------
+MENULIST
+echo -e "  \e[32m1.prepare system environment [..]\e[0m"
+echo -e "  \e[32m2.install component [..]\e[0m"
+echo -e "  \e[32m3.uninstall component [..]\e[0m"
+echo -e "  \e[32m4.start component [..]\e[0m"
+echo -e "  \e[32m5.stop component [..]\e[0m"
+echo -e "  \e[32m6.start download server [..]\e[0m"
+echo -e ""
+echo -e "  \e[32mq.quit\e[0m"
+cat<<MENULIST
+====================================================================================
+MENULIST
+
+echo -ne "Please input your choice [\e[32m1\e[0m-\e[32m6\e[0m,\e[32mq\e[0m(quit)]:"
+}
+
+## @description  check menu
+## @audience     public
+## @stability    stable
+check_menu()
+{
+cat<<MENULIST
+====================================================================================
+                            SUBMARINE INSTALLER ${SUBMARINE_INSTALLER_VERSION}
+
+HOST:${LOCAL_HOST_IP}            DOWNLOAD_SERVER:http://${DOWNLOAD_SERVER_IP}:${DOWNLOAD_SERVER_PORT}
+====================================================================================
+[Main menu] > [prepare system environment]
+------------------------------------------------------------------------------------
+MENULIST
+echo -e "  \e[32m1.prepare operation system\e[0m"
+echo -e "  \e[32m2.prepare operation system kernel\e[0m"
+echo -e "  \e[32m3.prepare GCC version\e[0m"
+echo -e "  \e[32m4.check GPU\e[0m"
+echo -e "  \e[32m5.prepare user&group\e[0m"
+echo -e "  \e[32m6.prepare nvidia environment\e[0m"
+echo -e ""
+echo -e "  \e[32mb.back main menu\e[0m"
+cat<<MENULIST
+====================================================================================
+MENULIST
+
+echo -ne "Please input your choice [\e[32m1\e[0m-\e[32m5\e[0m,\e[32mb\e[0m(back)]:"
+}
+
+## @description  install menu
+## @audience     public
+## @stability    stable
+install_menu()
+{
+cat<<MENULIST
+====================================================================================
+                            SUBMARINE INSTALLER ${SUBMARINE_INSTALLER_VERSION}
+
+HOST:${LOCAL_HOST_IP}            DOWNLOAD_SERVER:http://${DOWNLOAD_SERVER_IP}:${DOWNLOAD_SERVER_PORT}
+====================================================================================
+[Main menu] > [install component]
+------------------------------------------------------------------------------------
+MENULIST
+echo -e "  \e[32m1.instll etcd\e[0m"
+echo -e "  \e[32m2.instll docker\e[0m"
+echo -e "  \e[32m3.instll calico network\e[0m"
+echo -e "  \e[32m4.instll nvidia driver\e[0m"
+echo -e "  \e[32m5.instll nvidia docker\e[0m"
+echo -e "  \e[32m6.instll yarn container-executor\e[0m"
+echo -e "  \e[32m7.instll submarine autorun script\e[0m"
+echo -e ""
+echo -e "  \e[32mb.back main menu\e[0m"
+cat<<MENULIST
+====================================================================================
+MENULIST
+
+echo -ne "Please input your choice [\e[32m1\e[0m-\e[32m7\e[0m,\e[32mb\e[0m(back)]:"
+}
+
+## @description  unstall menu
+## @audience     public
+## @stability    stable
+uninstall_menu()
+{
+cat<<MENULIST
+====================================================================================
+                            SUBMARINE INSTALLER ${SUBMARINE_INSTALLER_VERSION}
+
+HOST:${LOCAL_HOST_IP}            DOWNLOAD_SERVER:http://${DOWNLOAD_SERVER_IP}:${DOWNLOAD_SERVER_PORT}
+====================================================================================
+[Main menu] > [uninstll component]
+------------------------------------------------------------------------------------
+MENULIST
+echo -e "  \e[32m1.uninstll etcd\e[0m"
+echo -e "  \e[32m2.uninstll docker\e[0m"
+echo -e "  \e[32m3.uninstll calico network\e[0m"
+echo -e "  \e[32m4.uninstll nvidia driver\e[0m"
+echo -e "  \e[32m5.uninstll nvidia docker\e[0m"
+echo -e "  \e[32m6.uninstll yarn container-executor\e[0m"
+echo -e "  \e[32m7.uninstll submarine autorun script\e[0m"
+echo -e ""
+echo -e "  \e[32mb.back main menu\e[0m"
+cat<<MENULIST
+====================================================================================
+MENULIST
+
+echo -ne "Please input your choice [\e[32m1\e[0m-\e[32m7\e[0m,\e[32mb\e[0m(back)]:"
+}
+
+## @description  start menu
+## @audience     public
+## @stability    stable
+start_menu()
+{
+cat<<MENULIST
+====================================================================================
+                            SUBMARINE INSTALLER ${SUBMARINE_INSTALLER_VERSION}
+
+HOST:${LOCAL_HOST_IP}            DOWNLOAD_SERVER:http://${DOWNLOAD_SERVER_IP}:${DOWNLOAD_SERVER_PORT}
+====================================================================================
+[Main menu] > [stop component]
+------------------------------------------------------------------------------------
+MENULIST
+echo -e "  \e[32m1.start etcd\e[0m"
+echo -e "  \e[32m2.start docker\e[0m"
+echo -e "  \e[32m3.start calico network\e[0m"
+echo -e ""
+echo -e "  \e[32mb.back main menu\e[0m"
+cat<<MENULIST
+====================================================================================
+MENULIST
+
+echo -ne "Please input your choice [\e[32m1\e[0m-\e[32m3\e[0m,\e[32mb\e[0m(back)]:"
+}
+
+## @description  stop menu
+## @audience     public
+## @stability    stable
+stop_menu()
+{
+cat<<MENULIST
+====================================================================================
+                            SUBMARINE INSTALLER ${SUBMARINE_INSTALLER_VERSION}
+
+HOST:${LOCAL_HOST_IP}    DOWNLOAD_SERVER:http://${DOWNLOAD_SERVER_IP}:${DOWNLOAD_SERVER_PORT}
+====================================================================================
+[Main menu] > [stop component]
+------------------------------------------------------------------------------------
+MENULIST
+echo -e "  \e[32m1.stop etcd\e[0m"
+echo -e "  \e[32m2.stop docker\e[0m"
+echo -e "  \e[32m3.stop calico network\e[0m"
+echo -e ""
+echo -e "  \e[32mb.back main menu\e[0m"
+cat<<MENULIST
+====================================================================================
+MENULIST
+
+echo -ne "Please input your choice [\e[32m1\e[0m-\e[32m3\e[0m,\e[32mb\e[0m(back)]:"
+}
+
+## @description  menu operation
+## @audience     public
+## @stability    stable
+menu_index="0"
+menu()
+{
+  clear
+  # echo "menu_index-menu_choice=$menu_index-$menu_choice"
+  case $menu_index in
+    "0")
+      main_menu
+    ;;
+    "1")
+      check_menu
+    ;;
+    "2")
+      install_menu
+    ;;
+    "3")
+      uninstall_menu
+    ;;
+    "4")
+      start_menu
+    ;;
+    "5")
+      stop_menu
+    ;;
+    "6")
+      start_download_server
+    ;;
+    "q")
+      exit 1
+    ;;
+    *)
+      echo "error input!"
+      menu_index="0"
+      menu_choice="0"
+      main_menu
+    ;;
+  esac
+
+  read menu_choice
+}
+
+## @description  menu process
+## @audience     public
+## @stability    stable
+menu_process()
+{
+  process=0
+  unset myselect
+  # echo "debug=$menu_index-$menu_choice"
+  case "$menu_index-$menu_choice" in
+    "1-b"|"2-b"|"3-b"|"4-b"|"5-b"|"6-b")
+      menu_index="0"
+      menu_choice="0"
+    ;;
+# check system environment
+    "1-1")
+      myselect="y"
+      check_operationSystem
+    ;;
+    "1-2")
+      myselect="y"
+      check_operationSystemKernel
+    ;;
+    "1-3")
+      myselect="y"
+      check_gccVersion
+    ;;
+    "1-4")
+      myselect="y"
+      check_GPU
+    ;;
+    "1-5")
+      myselect="y"
+      check_userGroup
+    ;;
+    "1-6")
+      myselect="y"
+      prepare_nvidia_environment
+    ;;
+# install component
+    "2-1")
+      echo -n "Do you want to install etcd?[y|n]"
+      read myselect
+      if [[ "$myselect" = "y" || "$myselect" = "Y" ]]
+      then
+        install_etcd
+      fi
+    ;;
+    "2-2")
+      echo -n "Do you want to install docker?[y|n]"
+      read myselect
+      if [[ "$myselect" = "y" || "$myselect" = "Y" ]]
+      then
+        install_docker
+      fi
+    ;;
+    "2-3")
+      echo -n "Do you want to install calico network?[y|n]"
+      read myselect
+      if [[ "$myselect" = "y" || "$myselect" = "Y" ]]
+      then
+        install_calico
+      fi
+    ;;
+    "2-4")
+      echo -n "Do you want to install nvidia driver?[y|n]"
+      read myselect
+      if [[ "$myselect" = "y" || "$myselect" = "Y" ]]
+      then
+        install_nvidia
+      fi
+    ;;
+    "2-5")
+      echo -n "Do you want to install nvidia docker?[y|n]"
+      read myselect
+      if [[ "$myselect" = "y" || "$myselect" = "Y" ]]
+      then
+        install_nvidia_docker
+      fi
+    ;;
+    "2-6")
+      echo -n "Do you want to install yarn container-executor?[y|n]"
+      read myselect
+      if [[ "$myselect" = "y" || "$myselect" = "Y" ]]
+      then
+        install_yarn
+      fi
+    ;;
+    "2-7")
+      echo -n "Do you want to install submarine auto start script?[y|n]"
+      read myselect
+      if [[ "$myselect" = "y" || "$myselect" = "Y" ]]
+      then
+        install_submarine
+      fi
+    ;;
+# uninstall component
+    "3-1")
+      echo -n "Do you want to uninstall etcd?[y|n]"
+      read myselect
+      if [[ "$myselect" = "y" || "$myselect" = "Y" ]]
+      then
+        uninstall_etcd
+      fi
+    ;;
+    "3-2")
+      echo -n "Do you want to uninstall docker?[y|n]"
+      read myselect
+      if [[ "$myselect" = "y" || "$myselect" = "Y" ]]
+      then
+        uninstall_docker
+      fi
+    ;;
+   "3-3")
+      echo -n "Do you want to uninstall calico network?[y|n]"
+      read myselect
+      if [[ "$myselect" = "y" || "$myselect" = "Y" ]]
+      then
+        uninstall_calico
+      fi
+    ;;
+    "3-4")
+      echo -n "Do you want to uninstall nvidia driver?[y|n]"
+      read myselect
+      if [[ "$myselect" = "y" || "$myselect" = "Y" ]]
+      then
+        uninstall_nvidia
+      fi
+    ;;
+    "3-5")
+      echo -n "Do you want to uninstall nvidia docker?[y|n]"
+      read myselect
+      if [[ "$myselect" = "y" || "$myselect" = "Y" ]]
+      then
+        uninstall_nvidia_docker
+      fi
+    ;;
+    "3-6")
+      echo -n "Do you want to uninstall yarn container-executor?[y|n]"
+      read myselect
+      if [[ "$myselect" = "y" || "$myselect" = "Y" ]]
+      then
+        uninstall_yarn
+      fi
+    ;;
+    "3-7")
+      echo -n "Do you want to uninstall submarine autostart script?[y|n]"
+      read myselect
+      if [[ "$myselect" = "y" || "$myselect" = "Y" ]]
+      then
+        uninstall_submarine
+      fi
+    ;;
+# startup component
+    "4-1")
+      echo -n "Do you want to startup etcd?[y|n]"
+      read myselect
+      if [[ "$myselect" = "y" || "$myselect" = "Y" ]]
+      then
+        start_etcd
+      fi
+    ;;
+    "4-2")
+      echo -n "Do you want to startup docker?[y|n]"
+      read myselect
+      if [[ "$myselect" = "y" || "$myselect" = "Y" ]]
+      then
+        start_docker
+      fi
+    ;;
+    "4-3")
+      echo -n "Do you want to startup calico network?[y|n]"
+      read myselect
+      if [[ "$myselect" = "y" || "$myselect" = "Y" ]]
+      then
+        start_calico
+      fi
+    ;;
+# stop component
+    "5-1")
+      echo -n "Do you want to stop etcd?[y|n]"
+      read myselect
+      if [[ "$myselect" = "y" || "$myselect" = "Y" ]]
+      then
+        stop_etcd
+      fi
+    ;;
+    "5-2")
+      echo -n "Do you want to stop docker?[y|n]"
+      read myselect
+      if [[ "$myselect" = "y" || "$myselect" = "Y" ]]
+      then
+        stop_docker
+      fi
+    ;;
+    "5-3")
+      echo -n "Do you want to stop calico network?[y|n]"
+      read myselect
+      if [[ "$myselect" = "y" || "$myselect" = "Y" ]]
+      then
+        stop_calico
+      fi
+    ;;
+  esac
+
+  if [[ "$myselect" = "y" || "$myselect" = "Y" ]]
+  then
+    process=1
+  fi
+
+#  echo "process=$process"
+  return $process
+}
+

http://git-wip-us.apache.org/repos/asf/hadoop/blob/46d6e001/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/scripts/nvidia-docker.sh
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/scripts/nvidia-docker.sh b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/scripts/nvidia-docker.sh
new file mode 100644
index 0000000..3441f28
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/scripts/nvidia-docker.sh
@@ -0,0 +1,99 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+## @description  download nvidia docker bin
+## @audience     public
+## @stability    stable
+function download_nvidia_docker_bin()
+{
+  # download http server
+  if [[ -n "$DOWNLOAD_HTTP" ]]; then
+    MY_NVIDIA_DOCKER_RPM_URL="${DOWNLOAD_HTTP}/downloads/nvidia-docker/${NVIDIA_DOCKER_RPM}"
+  else
+    MY_NVIDIA_DOCKER_RPM_URL=${NVIDIA_DOCKER_RPM_URL}
+  fi
+
+  if [[ -f "${DOWNLOAD_DIR}/nvidia-docker/${NVIDIA_DOCKER_RPM}" ]]; then
+    echo "${DOWNLOAD_DIR}/nvidia-docker/${NVIDIA_DOCKER_RPM} is exist."
+  else
+    echo "download ${MY_NVIDIA_DOCKER_RPM_URL} ..."
+    wget -P ${DOWNLOAD_DIR}/nvidia-docker/ ${MY_NVIDIA_DOCKER_RPM_URL}
+  fi
+}
+
+## @description  install nvidia docker
+## @audience     public
+## @stability    stable
+function install_nvidia_docker()
+{
+  download_nvidia_docker_bin
+
+  sudo rpm -i ${DOWNLOAD_DIR}/nvidia-docker/${NVIDIA_DOCKER_RPM}
+
+  echo -e "\033[32m===== Start nvidia-docker =====\033[0m"
+  sudo systemctl start nvidia-docker
+
+  echo -e "\033[32m===== Check nvidia-docker status =====\033[0m"
+  systemctl status nvidia-docker
+
+  echo -e "\033[32m===== Check nvidia-docker log =====\033[0m"
+  journalctl -u nvidia-docker
+
+  echo -e "\033[32m===== Test nvidia-docker-plugin =====\033[0m"
+  curl http://localhost:3476/v1.0/docker/cli
+
+  # create nvidia driver library path
+  if [ ! -d "/var/lib/nvidia-docker/volumes/nvidia_driver" ]; then
+    echo "WARN: /var/lib/nvidia-docker/volumes/nvidia_driver folder path is not exist!"
+    mkdir -p /var/lib/nvidia-docker/volumes/nvidia_driver
+  fi
+
+  local nvidiaVersion=`get_nvidia_version`
+  echo -e "\033[31m nvidia detect version is ${nvidiaVersion}\033[0m"
+
+  mkdir /var/lib/nvidia-docker/volumes/nvidia_driver/${nvidiaVersion}
+  mkdir /var/lib/nvidia-docker/volumes/nvidia_driver/${nvidiaVersion}/bin
+  mkdir /var/lib/nvidia-docker/volumes/nvidia_driver/${nvidiaVersion}/lib64
+
+  cp /usr/bin/nvidia* /var/lib/nvidia-docker/volumes/nvidia_driver/${nvidiaVersion}/bin
+  cp /usr/lib64/libcuda* /var/lib/nvidia-docker/volumes/nvidia_driver/${nvidiaVersion}/lib64
+  cp /usr/lib64/libnvidia* /var/lib/nvidia-docker/volumes/nvidia_driver/${nvidiaVersion}/lib64
+
+  echo -e "\033[32m===== Please manually execute the following command =====\033[0m"
+  echo -e "\033[32mshell:> nvidia-docker run --rm ${DOCKER_REGISTRY}/nvidia/cuda:9.0-devel nvidia-smi
+# If you don't see the list of graphics cards above, the NVIDIA driver installation failed. =====
+\033[0m"
+
+  echo -e "\033[32m===== Please manually execute the following command =====\033[0m"
+  echo -e "\033[32m# Test with tf.test.is_gpu_available()
+shell:> nvidia-docker run -it ${DOCKER_REGISTRY}/tensorflow/tensorflow:1.9.0-gpu bash
+# In docker container
+container:> python
+python:> import tensorflow as tf
+python:> tf.test.is_gpu_available()
+python:> exit()
+\033[0m"
+}
+
+## @description  uninstall nvidia docker
+## @audience     public
+## @stability    stable
+function uninstall_nvidia_docker()
+{
+  echo "This method is not implemented."
+}
+

http://git-wip-us.apache.org/repos/asf/hadoop/blob/46d6e001/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/scripts/nvidia.sh
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/scripts/nvidia.sh b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/scripts/nvidia.sh
new file mode 100644
index 0000000..7b2b1de
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/scripts/nvidia.sh
@@ -0,0 +1,120 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+nvidia_run_file=""
+
+## @description  get nvidia version
+## @audience     public
+## @stability    stable
+function get_nvidia_version()
+{
+  chmod +x ${DOWNLOAD_DIR}/nvidia/nvidia-detect
+  local nvidia_detect_info=`${DOWNLOAD_DIR}/nvidia/nvidia-detect -v`
+  echo $nvidia_detect_info | sed "s/^.*This device requires the current \([0-9.]*\).*/\1/"
+}
+
+## @description  download nvidia driver
+## @audience     public
+## @stability    stable
+function download_nvidia_driver()
+{
+  # submarin http server
+  if [[ -n "$DOWNLOAD_HTTP" ]]; then
+    MY_NVIDIA_DETECT_URL="${DOWNLOAD_HTTP}/downloads/nvidia/nvidia-detect"
+  else
+    MY_NVIDIA_DETECT_URL=${NVIDIA_DETECT_URL}
+  fi
+
+  # download nvidia_detect
+  if [[ -f "${DOWNLOAD_DIR}/nvidia/nvidia-detect" ]]; then
+    echo "${DOWNLOAD_DIR}/nvidia/nvidia-detect is exist."
+  else
+    echo "download ${MY_NVIDIA_DETECT_URL} ..."
+    wget -P ${DOWNLOAD_DIR}/nvidia/ ${MY_NVIDIA_DETECT_URL}
+  fi
+
+  echo "execution nvidia-detect to check the graphics card ..."
+  local nvidiaVersion=`get_nvidia_version`
+  echo -e "detect nvidia version is \033[31m${nvidiaVersion}\033[0m"
+
+  # download NVIDIA driver
+  if [[ "$nvidiaVersion" = "" ]]; then
+    echo -e "\033[31mERROR: No graphics card device detected.\033[0m"
+    return 1
+  else
+    nvidia_run_file="NVIDIA-Linux-x86_64-${nvidiaVersion}.run"
+
+    # submarin http server
+    if [[ -n "$DOWNLOAD_HTTP" ]]; then
+      MY_NVIDIA_DRIVER_RUN_URL="${DOWNLOAD_HTTP}/downloads/nvidia/${nvidia_run_file}"
+    else
+      # http://us.download.nvidia.com/XFree86/Linux-x86_64/390.87/NVIDIA-Linux-x86_64-390.87.run
+      MY_NVIDIA_DRIVER_RUN_URL="http://us.download.nvidia.com/XFree86/Linux-x86_64/${nvidiaVersion}/${nvidia_run_file}"
+    fi
+
+    if [[ -f ${DOWNLOAD_DIR}/nvidia/${nvidia_run_file} ]]; then
+      echo "NVIDIA driver files already exist in the ${DOWNLOAD_DIR}/nvidia/${nvidia_run_file} directory."
+      echo "===== Please make sure the ${DOWNLOAD_DIR}/nvidia/nvidia/${nvidia_run_file} file is complete and can be used normally. ====="
+    else
+      echo "Download the NVIDIA driver from the ${MY_NVIDIA_DRIVER_RUN_URL}"
+      wget -P ${DOWNLOAD_DIR}/nvidia/ ${MY_NVIDIA_DRIVER_RUN_URL}
+    fi
+  fi
+}
+
+## @description  install nvidia
+## @audience     public
+## @stability    stable
+function install_nvidia()
+{
+  download_nvidia_driver
+
+  # Confirm that the system disables nouveau
+  local disable_nouveau_info=`lsmod | grep nouveau`
+  if [[ "$disable_nouveau_info" = "" ]]; then
+    echo "===== Start installing the NVIDIA driver ====="
+    echo -e "Some options during the installation
+Would you like to register the kernel module sources with DKMS?
+  This will allow DKMS to automatically build a new module, if you install a different kernel later. \033[33m[Yes]\033[0m
+Install NVIDIA's 32-bit compatibility libraries \033[33m[Yes]\033[0m
+centos Install NVIDIA's 32-bit compatibility libraries \033[33m[Yes]\033[0m
+Would you like to run the nvidia-xconfig utility to automatically update your X configuration file... \033[33m[No]\033[0m"
+    sleep 2
+    sh ${DOWNLOAD_DIR}/nvidia/${nvidia_run_file}
+  else
+    echo -e "ERROR: Nouveau is not disabled"
+    return 1
+  fi
+
+  echo -e "\033[32m===== execute nvidia-smi. You should be able to see the list of graphics cards =====\033[0m"
+  sleep 1
+  nvidia-smi
+}
+
+## @description  uninstall nvidia
+## @audience     public
+## @stability    stable
+function uninstall_nvidia()
+{
+  if [ ! -f "/usr/bin/nvidia-uninstall" ]; then
+    echo -e "\033[31mERROR: /usr/bin/nvidia-uninstall file is not exist!\033[0m"
+    return 1
+  fi
+
+  echo -e "execute /usr/bin/nvidia-uninstall"
+  /usr/bin/nvidia-uninstall
+}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/46d6e001/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/scripts/submarine.sh
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/scripts/submarine.sh b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/scripts/submarine.sh
new file mode 100644
index 0000000..b73d5e7
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/scripts/submarine.sh
@@ -0,0 +1,38 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+## @description  install submarine autorun script
+## @audience     public
+## @stability    stable
+function install_submarine()
+{
+  cp ${PACKAGE_DIR}/submarine/submarine.sh /etc/rc.d/init.d/submarine.sh
+  chmod +x /etc/rc.d/init.d/submarine.sh
+  chmod +x /etc/rc.d/rc.local
+
+  if [ `grep -c "/etc/rc.d/init.d/submarine.sh" /etc/rc.d/rc.local` -eq '0' ]; then
+    echo "/etc/rc.d/init.d/submarine.sh">> /etc/rc.d/rc.local
+  fi
+}
+
+## @description  uninstall submarine autorun script
+## @audience     public
+## @stability    stable
+function uninstall_submarine()
+{
+  rm /etc/rc.d/init.d/submarine.sh
+}
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


[5/5] hadoop git commit: YARN-8798. [Submarine] Job should not be submitted if --input_path option is missing. (Zhankun Tang via wangda)

Posted by wa...@apache.org.
YARN-8798. [Submarine] Job should not be submitted if --input_path option is missing. (Zhankun Tang via wangda)

Change-Id: I7ae0e44eb5179b04a6ac861ec1c65f3b18c38f0f


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/143d7477
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/143d7477
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/143d7477

Branch: refs/heads/trunk
Commit: 143d74775b2b62884090fdd88874134b9eab2888
Parents: 46d6e00
Author: Wangda Tan <wa...@apache.org>
Authored: Tue Oct 16 13:39:34 2018 -0700
Committer: Wangda Tan <wa...@apache.org>
Committed: Tue Oct 16 13:51:02 2018 -0700

----------------------------------------------------------------------
 .../client/cli/param/RunJobParameters.java      |  6 +++
 .../client/cli/TestRunJobCliParsing.java        | 39 ++++++++++++++++++++
 2 files changed, 45 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/143d7477/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/src/main/java/org/apache/hadoop/yarn/submarine/client/cli/param/RunJobParameters.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/src/main/java/org/apache/hadoop/yarn/submarine/client/cli/param/RunJobParameters.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/src/main/java/org/apache/hadoop/yarn/submarine/client/cli/param/RunJobParameters.java
index 92a1883..d923e0f 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/src/main/java/org/apache/hadoop/yarn/submarine/client/cli/param/RunJobParameters.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/src/main/java/org/apache/hadoop/yarn/submarine/client/cli/param/RunJobParameters.java
@@ -62,6 +62,12 @@ public class RunJobParameters extends RunParameters {
     if (parsedCommandLine.getOptionValue(CliConstants.N_WORKERS) != null) {
       nWorkers = Integer.parseInt(
           parsedCommandLine.getOptionValue(CliConstants.N_WORKERS));
+      // Only check null value.
+      // Training job shouldn't ignore INPUT_PATH option
+      // But if nWorkers is 0, INPUT_PATH can be ignored because user can only run Tensorboard
+      if (null == input && 0 != nWorkers) {
+        throw new ParseException("\"--" + CliConstants.INPUT_PATH + "\" is absent");
+      }
     }
 
     int nPS = 0;

http://git-wip-us.apache.org/repos/asf/hadoop/blob/143d7477/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/src/test/java/org/apache/hadoop/yarn/submarine/client/cli/TestRunJobCliParsing.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/src/test/java/org/apache/hadoop/yarn/submarine/client/cli/TestRunJobCliParsing.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/src/test/java/org/apache/hadoop/yarn/submarine/client/cli/TestRunJobCliParsing.java
index 295d6a8..240de06 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/src/test/java/org/apache/hadoop/yarn/submarine/client/cli/TestRunJobCliParsing.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/src/test/java/org/apache/hadoop/yarn/submarine/client/cli/TestRunJobCliParsing.java
@@ -19,6 +19,7 @@
 
 package org.apache.hadoop.yarn.submarine.client.cli;
 
+import org.apache.commons.cli.ParseException;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.Resource;
 import org.apache.hadoop.yarn.api.records.ResourceInformation;
@@ -136,6 +137,44 @@ public class TestRunJobCliParsing {
   }
 
   @Test
+  public void testNoInputPathOptionSpecified() throws Exception {
+    RunJobCli runJobCli = new RunJobCli(getMockClientContext());
+    String expectedErrorMessage = "\"--" + CliConstants.INPUT_PATH + "\" is absent";
+    String actualMessage = "";
+    try {
+      runJobCli.run(
+          new String[]{"--name", "my-job", "--docker_image", "tf-docker:1.1.0",
+              "--checkpoint_path", "hdfs://output",
+              "--num_workers", "1", "--worker_launch_cmd", "python run-job.py",
+              "--worker_resources", "memory=4g,vcores=2", "--tensorboard",
+              "true", "--verbose", "--wait_job_finish"});
+    } catch (ParseException e) {
+      actualMessage = e.getMessage();
+      e.printStackTrace();
+    }
+    Assert.assertEquals(expectedErrorMessage, actualMessage);
+  }
+
+  /**
+   * when only run tensorboard, input_path is not needed
+   * */
+  @Test
+  public void testNoInputPathOptionButOnlyRunTensorboard() throws Exception {
+    RunJobCli runJobCli = new RunJobCli(getMockClientContext());
+    boolean success = true;
+    try {
+      runJobCli.run(
+          new String[]{"--name", "my-job", "--docker_image", "tf-docker:1.1.0",
+              "--num_workers", "0", "--tensorboard", "--verbose",
+              "--tensorboard_resources", "memory=2G,vcores=2",
+              "--tensorboard_docker_image", "tb_docker_image:001"});
+    } catch (ParseException e) {
+      success = false;
+    }
+    Assert.assertTrue(success);
+  }
+
+  @Test
   public void testLaunchCommandPatternReplace() throws Exception {
     RunJobCli runJobCli = new RunJobCli(getMockClientContext());
     Assert.assertFalse(SubmarineLogs.isVerbose());


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


[2/5] hadoop git commit: YARN-8870. [Submarine] Add submarine installation scripts. (Xun Liu via wangda)

Posted by wa...@apache.org.
http://git-wip-us.apache.org/repos/asf/hadoop/blob/46d6e001/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/scripts/utils.sh
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/scripts/utils.sh b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/scripts/utils.sh
new file mode 100644
index 0000000..7b3c2a9
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-submarine/installation/scripts/utils.sh
@@ -0,0 +1,123 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+## @description  check install user
+## @audience     public
+## @stability    stable
+function check_install_user()
+{
+  if [[ $(id -u) -ne 0 ]];then
+    echo "This script must be run with a ROOT user!"
+    exit # don't call exit_install()
+  fi
+}
+
+## @description  exit install
+## @audience     public
+## @stability    stable
+function exit_install()
+{
+  echo "Exit the installation!" | tee -a $LOG
+  exit $1
+}
+
+## @description  Check if the IP address format is correct
+## @audience     public
+## @stability    stable
+function valid_ip()
+{
+  local ip=$1
+  local stat=1
+
+  if [[ $ip =~ ^[0-9]{1,3\}.[0-9]{1,3\}.[0-9]{1,3\}.[0-9]{1,3\}$ ]]; then
+    OIFS=$IFS
+    IFS='.'
+    ip=($ip)
+    IFS=$OIFS
+
+    if [[ ${ip[0]} -le 255 && ${ip[1]} -le 255 && ${ip[2]} -le 255 && ${ip[3]} -le 255 ]]; then
+      stat=$?
+    fi
+  fi
+
+  return $stat
+}
+
+## @description  Check if the configuration file configuration is correct
+## @audience     public
+## @stability    stable
+function check_install_conf()
+{
+  echo "Check if the configuration file configuration is correct ..." | tee -a $LOG
+
+  # check etcd conf
+  hostCount=${#ETCD_HOSTS[@]}
+  if [[ $hostCount -lt 3 && hostCount -ne 0 ]]; then # <>2
+    echo "Number of nodes = [$hostCount], must be configured to be greater than or equal to 3 servers! " | tee -a $LOG
+    exit_install
+  fi
+  for ip in ${ETCD_HOSTS[@]}
+  do
+    if ! valid_ip $ip; then
+      echo "]ETCD_HOSTS=[$ip], IP address format is incorrect! " | tee -a $LOG
+      exit_install
+    fi
+  done
+  echo "Check if the configuration file configuration is correct [ Done ]" | tee -a $LOG
+}
+
+## @description  index by EtcdHosts list
+## @audience     public
+## @stability    stable
+function indexByEtcdHosts() {
+  index=0
+  while [ "$index" -lt "${#ETCD_HOSTS[@]}" ]; do
+    if [ "${ETCD_HOSTS[$index]}" = "$1" ]; then
+      echo $index
+      return
+    fi
+    let "index++"
+  done
+  echo ""
+}
+
+## @description  get local IP
+## @audience     public
+## @stability    stable
+function getLocalIP()
+{
+  local _ip _myip _line _nl=$'\n'
+  while IFS=$': \t' read -a _line ;do
+      [ -z "${_line%inet}" ] &&
+         _ip=${_line[${#_line[1]}>4?1:2]} &&
+         [ "${_ip#127.0.0.1}" ] && _myip=$_ip
+    done< <(LANG=C /sbin/ifconfig)
+  printf ${1+-v} $1 "%s${_nl:0:$[${#1}>0?0:1]}" $_myip
+}
+
+## @description  get ip list
+## @audience     public
+## @stability    stable
+function get_ip_list()
+{
+  array=$(ifconfig | grep inet | grep -v inet6 | grep -v 127 | sed 's/^[ \t]*//g' | cut -d ' ' -f2)
+
+  for ip in ${array[@]}
+  do
+    LOCAL_HOST_IP_LIST+=(${ip})
+  done
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org