-
Notifications
You must be signed in to change notification settings - Fork 5
/
update_image.sh
executable file
·86 lines (74 loc) · 3.84 KB
/
update_image.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/bash
server=$1
role=$2
package=$3
if [ $# -lt 2 ];then
echo error!
else
#make base image
if [ "x$role" = "xtemplate" ];then
#scp image/*.tar.gz $server:/opt/"
#scp -r image/lzo $server:/opt/"
#ssh $server "tar -xvzf /opt/hadoop-2.7.3.tar.gz -C /opt/"
#ssh $server "rm /opt/hadoop"
#ssh $server "ln -s /opt/hadoop-2.7.3 /opt/hadoop"
#scp jars/S3/* $server:/opt/hadoop/share/hadoop/common/lib/
#ssh $server "tar -xvzf /opt/apache-hive-1.2.2-bin.tar.gz -C /opt/"
#ssh $server "rm /opt/hive"
#ssh $server "ln -s /opt/apache-hive-1.2.2-bin /opt/hive"
#scp jars/mysql-connector-java-5.1.45-bin.jar /opt/hive/lib/
#ssh $server "tar -xvzf /opt/spark-2.2.0-bin-hadoop2.7.tgz -C /opt/"
#ssh $server "tar -xvzf /opt/spark-2.1.1-bin-hadoop2.7.tgz -C /opt/"
#ssh $server "tar -xvzf /opt/spark-2.0.2-bin-hadoop2.7.tgz -C /opt/"
#ssh $server "rm /opt/spark"
#ssh $server "ln -s /opt/spark-2.2.0-bin-hadoop2.7 /opt/spark"
#ssh $server "cp /opt/spark-2.2.0-bin-hadoop2.7/conf/spark-defaults.conf.template /opt/spark-2.2.0-bin-hadoop2.7/conf/spark-defaults.conf"
#ssh $server "cp /opt/spark-2.1.1-bin-hadoop2.7/conf/spark-defaults.conf.template /opt/spark-2.1.1-bin-hadoop2.7/conf/spark-defaults.conf"
#ssh $server "cp /opt/spark-2.0.2-bin-hadoop2.7/conf/spark-defaults.conf.template /opt/spark-2.0.2-bin-hadoop2.7/conf/spark-defaults.conf"
#ssh $server "tar -xvzf /opt/jdk-8u141-linux-x64.tar.gz -C /usr/"
#ssh $server "ln -s /usr/jdk1.8.0_141 /usr/jdk"
#ssh $server "tar -xvzf /opt/miniconda.tar.gz -C /opt/"
#ssh $server "ln -s /opt/miniconda2/ /opt/python2"
#ssh $server "ln -s /opt/miniconda3/ /opt/python3"
#ssh $server "tar -xvzf /opt/livy-server-0.2.0.tar.gz -C /opt/"
#ssh $server "ln -s /opt/livy-server-0.2.0/ /opt/livy"
#ssh $server "tar -xvzf /opt/bigdata-client.tar.gz -C /opt/"
#ssh $server "ln -s /opt/apache-hive-1.2.2-bin/ /opt/hive"
#ssh $server "ln -s /opt/sqoop-1.4.6.bin__hadoop-2.0.4-alpha/ /opt/sqoop"
echo "template image created"
else
#ssh $server "apt-get install -y ntp"
#scp ../app-agent-linux-amd64.tar.gz $server:/opt/
#ssh $server "tar -zxf /opt/app-agent-linux-amd64.tar.gz -C /opt/; rm -rf /opt/app-agent-linux-amd64.tar.gz"
#ssh $server "cd /opt/app-agent-linux-amd64; ./install.sh; cd /opt/; rm -rf /opt/app-agent-linux-amd64"
scp -r confd/$role/conf.d $server:/etc/confd/
scp -r confd/$role/templates $server:/etc/confd/
scp -r scripts/hadoop/etc $server:/opt/hadoop/
scp -r scripts/hadoop/sbin $server:/opt/hadoop/
scp -r scripts/spark/sbin $server:/opt/spark/
scp -r scripts/hive/sbin $server:/opt/hive/
scp -r scripts/flink/sbin $server:/opt/flink/
scp -r scripts/qingcloud/sbin $server:/opt/qingcloud/
scp -r scripts/etc/ntp.conf $server:/etc/
fi
if [ "x$role" = "xbigdata-client" ] || [ "x$role" = "xyarn-master" ];then
scp jars/mysql-connector-java-5.1.45-bin.jar $server:/opt/hive/lib/
fi
if [ "x$package" = "xlzo" ];then
ssh $server "tar -xvzf /opt/lzo/libgplcompression.tar.gz -C /opt/hadoop/lib/native/"
ssh $server "mv /opt/hadoop/lib/native/libgplcompression/* /opt/hadoop/lib/native/"
ssh $server "rm -rf /opt/hadoop/lib/native/libgplcompression/"
ssh $server "tar -xvzf /opt/lzo/liblzo.tar.gz -C /usr/lib/"
ssh $server "mkdir -p /usr/lib64/"
ssh $server "tar -xvzf /opt/lzo/liblzo.tar.gz -C /usr/lib64/"
ssh $server "cp /opt/lzo/lzop /usr/local/bin/lzop;"
ssh $server "rm -rf /usr/bin/lzop"
ssh $server "ln -s /usr/local/bin/lzop /usr/bin/lzop"
ssh $server "cp /opt/lzo/hadoop-lzo-0.4.20.jar /opt/hadoop/share/hadoop/common/"
ssh $server "sudo chown -R root:root /usr/lib/"
ssh $server "sudo chown -R root:root /usr/lib64/"
ssh $server "sudo chown -R root:root /opt/"
fi
#ssh $server "rm /opt/*.tar.gz"
#ssh $server "rm -rf /opt/lzo"
fi