Skip to content

Commit 6fc741b

Browse files
committed
organizing initialization sequence
1 parent e483204 commit 6fc741b

File tree

5 files changed

+39
-26
lines changed

5 files changed

+39
-26
lines changed

binder/start

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
#!/bin/bash
22

33

4-
chmod +x ./binder/start.hadoop
5-
chmod +x ./binder/start.hive
6-
chmod +x ./binder/start.mysql
7-
chmod +x ./binder/start.hbase
8-
#chmod +x ./binder/start.mariadb
4+
chmod +x ~/binder/start.hadoop
5+
chmod +x ~/binder/start.hive
6+
chmod +x ~/binder/start.mysql
7+
chmod +x ~/binder/start.hbase
8+
#chmod +x ~/binder/start.mariadb
99

10+
# starting mysql in parallel
11+
~/binder/start.mysql &
12+
13+
~/binder/start.hadoop && \
14+
sleep 3 && \
15+
~/binder/start.hive && \
16+
sleep 3 && \
17+
~/binder/start.hbase && \
18+
touch ready.txt &
1019

11-
./binder/start.hadoop && sleep 3 && ./binder/start.hive && sleep 3 && ./binder/start.hbase && ./binder/start.mysql &
1220

1321

1422
# DO NOT REMOVE(!)

binder/start.hadoop

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,33 @@
22

33
#loading envvars
44
#for auto load in binderhub:
5-
source $(pwd)/.profile
5+
source ~/.profile
66
#for manual start: run
77
#source $(pwd)/.bashrc
88

99
#Starting sshd server
10-
/usr/sbin/sshd -f $(pwd)/resources/configs/ssh/sshd_config
10+
/usr/sbin/sshd -f ~/resources/configs/ssh/sshd_config
1111

1212
# Adding names to know hosts. This step avoids yes/no host confirmation.
1313
ssh -o "StrictHostKeyChecking no" $USER@localhost -p 8822 -C "exit"
1414
ssh -o "StrictHostKeyChecking no" $USER@0.0.0.0 -p 8822 -C "exit"
1515

1616
# Copying configurations files to the Hadoop folder
17-
cp $(pwd)/resources/configs/hadoop/${HADOOP_VERSION}/core-site.xml ${HADOOP_HOME}/etc/hadoop/
18-
cp $(pwd)/resources/configs/hadoop/${HADOOP_VERSION}/hdfs-site.xml ${HADOOP_HOME}/etc/hadoop/
17+
cp ~/resources/configs/hadoop/${HADOOP_VERSION}/core-site.xml ${HADOOP_HOME}/etc/hadoop/
18+
cp ~/resources/configs/hadoop/${HADOOP_VERSION}/hdfs-site.xml ${HADOOP_HOME}/etc/hadoop/
1919

2020
# Formatting the filesystem
2121
hdfs namenode -format -force -nonInteractive >> /dev/null
2222

23-
start-dfs.sh && \
23+
start-dfs.sh && \
2424
#Copying YARN configurations for Pseudo-Distributed Mode
25-
cp $(pwd)/resources/configs/hadoop/${HADOOP_VERSION}/mapred-site.xml ${HADOOP_HOME}/etc/hadoop/ && \
26-
cp $(pwd)/resources/configs/hadoop/${HADOOP_VERSION}/yarn-site.xml ${HADOOP_HOME}/etc/hadoop/ && \
25+
cp ~/resources/configs/hadoop/${HADOOP_VERSION}/mapred-site.xml ${HADOOP_HOME}/etc/hadoop/ && \
26+
cp ~/resources/configs/hadoop/${HADOOP_VERSION}/yarn-site.xml ${HADOOP_HOME}/etc/hadoop/ && \
2727

28-
start-yarn.sh && \
28+
start-yarn.sh && \
2929

30-
hdfs dfs -mkdir /user/ && \
31-
hdfs dfs -mkdir /user/matheus/ && \
32-
hdfs dfs -mkdir /user/$USER &
30+
hdfs dfs -mkdir /user/ && \
31+
hdfs dfs -mkdir /user/matheus/ && \
32+
hdfs dfs -mkdir /user/$USER &
3333

3434
# echo "${USER} $(pwd) ${HADOOP_HOME} ${HADOOP_VERSION}" > startresult.txt

binder/start.hbase

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# deleting slf4j lib. Hive will automatically use slf4j-log4j jar file present in Hadoop
44
rm ${HBASE_HOME}/lib/client-facing-thirdparty/slf4j-log4j12-1.7.25.jar
55

6-
cp ./resources/configs/hbase/${HBASE_VERSION}/hbase-site.xml ${HBASE_HOME}/conf/
6+
cp ~/resources/configs/hbase/${HBASE_VERSION}/hbase-site.xml ${HBASE_HOME}/conf/
77

88
hdfs dfs -mkdir /hbase
99

binder/start.hive

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/bin/bash
22

33
#setting log level higher for less verbosity
4-
cp ./resources/configs/hive/${HIVE_VERSION}/beeline-log4j2.properties ${HIVE_HOME}/conf/
5-
cp ./resources/configs/hive/${HIVE_VERSION}/hive-site.xml ${HIVE_HOME}/conf/
4+
cp ~/resources/configs/hive/${HIVE_VERSION}/beeline-log4j2.properties ${HIVE_HOME}/conf/
5+
cp ~/resources/configs/hive/${HIVE_VERSION}/hive-site.xml ${HIVE_HOME}/conf/
66

77
#hack to make metastore_db within HIVE_HOME.
88
sed -i "s~HIVE_HOME~$HIVE_HOME~g" ${HIVE_HOME}/conf/hive-site.xml

binder/start.mysql

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,17 @@
44

55
$MYSQL_HOME/bin/mysqld --user='${USER}' --initialize-insecure --skip-grant-tables
66

7-
cd ${MYSQL_HOME} && \
8-
nohup ${MYSQL_HOME}/bin/mysqld_safe &
7+
cd ${MYSQL_HOME} && \
8+
${MYSQL_HOME}/bin/mysqld_safe &
99

10-
sleep 5
10+
# waiting for mysqld startup
11+
while ! mysqladmin ping -h "localhost" --silent; do
12+
echo "mysqld is down...";
13+
sleep 5
14+
done
1115

12-
$MYSQL_HOME/bin/mysql -u root -e "CREATE USER '${USER}'@'localhost';"
13-
$MYSQL_HOME/bin/mysql -u root -e "GRANT ALL PRIVILEGES ON *.* TO '${USER}'@'localhost';"
16+
echo "mysqld is up!";
1417

15-
touch done.txt
18+
# creating local user and granting all privileges
19+
$MYSQL_HOME/bin/mysql -u root -e "CREATE USER '${USER}'@'localhost';";
20+
$MYSQL_HOME/bin/mysql -u root -e "GRANT ALL PRIVILEGES ON *.* TO '${USER}'@'localhost';" ;

0 commit comments

Comments
 (0)