HDP Sandbox 起動スクリプトがうまくいかなかったので・・・


この手順にそって start_sandbox-hdp.sh を実行したがなかなか終わらない。
以下の手順でやったらうまく起動した。

1. スクリプト内の docker run ・・・ まで手動実行

start_sandbox-hdp.sh
#!/bin/bash
echo "Waiting for docker daemon to start up:"
until docker ps 2>&1| grep STATUS>/dev/null; do  sleep 1; done;  >/dev/null
docker ps -a | grep sandbox-hdp
if [ $? -eq 0 ]; then
 docker start sandbox-hdp
else
docker run --name sandbox-hdp --hostname "sandbox-hdp.hortonworks.com" --privileged -d \
-p 15500:15500 \

〜〜〜 省略 〜〜〜

-p 2222:22 \
sandbox-hdp /usr/sbin/sshd -D
fi

2. SSHで接続
ssh root@localhost -p 2222

3. 以降のコマンドはコンテナ上で直接実行

/bin/sh -c 'echo "127.0.0.1 sandbox.hortonworks.com" >> /etc/hosts'

/bin/sh -c 'chown -R mysql:mysql /var/lib/mysql'

service mysqld start

service postgresql start

ambari-server start

ambari-agent start

/bin/sh -c 'rm -f /usr/hdp/current/oozie-server/libext/falcon-oozie-el-extension-*'

/bin/sh -c 'chown -R hdfs:hadoop /hadoop/hdfs'

/etc/init.d/shellinaboxd start

/bin/sh -c ' until curl --silent -u raj_ops:raj_ops -H "X-Requested-By:ambari" -i -X GET  http://localhost:8080/api/v1/clusters/Sandbox/hosts/sandbox-hdp.hortonworks.com/host_components/ZOOKEEPER_SERVER | grep state | grep -v desired | grep INSTALLED; do sleep 5; echo -n .; done;'

/bin/sh -c 'until curl --silent --user raj_ops:raj_ops -X PUT -H "X-Requested-By: ambari"  -d "{\"RequestInfo\":{\"context\":\"_PARSE_.START.HDFS\",\"operation_level\":{\"level\":\"SERVICE\",\"cluster_name\":\"Sandbox\",\"service_name\":\"HDFS\"}},\"Body\":{\"ServiceInfo\":{\"state\":\"STARTED\"}}}" http://localhost:8080/api/v1/clusters/Sandbox/services/HDFS | grep -i accept >/dev/null; do echo -n .; sleep 5; done;'

/bin/sh -c 'until curl --silent --user raj_ops:raj_ops -X PUT -H "X-Requested-By: ambari"  -d "{\"RequestInfo\":{\"context\":\"_PARSE_.START.ALL_SERVICES\",\"operation_level\":{\"level\":\"CLUSTER\",\"cluster_name\":\"Sandbox\"}},\"Body\":{\"ServiceInfo\":{\"state\":\"STARTED\"}}}" http://localhost:8080/api/v1/clusters/Sandbox/services | grep -i accept > /dev/null; do sleep 5; echo -n .; done; '

/bin/sh -c 'until /usr/bin/curl --silent --user raj_ops:raj_ops -H "X-Requested-By: ambari" "http://localhost:8080/api/v1/clusters/Sandbox/requests?to=end&page_size=10&fields=Requests" | tail -n 27 | grep COMPLETED | grep COMPLETED > /dev/null; do echo -n .; sleep 1; done;'

su - hue -c '/bin/bash /usr/lib/tutorials/tutorials_app/run/run.sh &>/dev/null'

su - hue -c '/bin/bash /usr/lib/hue/tools/start_scripts/update-tutorials.sh &>/dev/null'

touch /usr/hdp/current/oozie-server/oozie-server/work/Catalina/localhost/oozie/SESSIONS.ser
dchown oozie:hadoop /usr/hdp/current/oozie-server/oozie-server/work/Catalina/localhost/oozie/SESSIONS.ser

/etc/init.d/tutorials start

/etc/init.d/splash