-
Notifications
You must be signed in to change notification settings - Fork 2
/
pigconf.sh
42 lines (32 loc) · 1.03 KB
/
pigconf.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
#!/usr/bin/env bash
# File: pigconf.sh
# Name: D.Saravanan
# Date: 20/09/2020
# Script to install and configure Apache Pig-0.17.0 in Hadoop-3.2.1
user='raman'
# Nodes
mnode='172.17.0.2'
enode='172.17.0.5'
nodes='172.17.0.3 172.17.0.4'
for ip in $mnode $enode $nodes; do
ssh $user@"$ip" <<'EOF'
if [ $ip == $mnode ]
then
wget -c http://apachemirror.wuchna.com/pig/pig-0.17.0/pig-0.17.0.tar.gz -P /home/$user/Downloads/
tar -xzf /home/$user/Downloads/pig-0.17.0.tar.gz
mv /home/$user/pig-0.17.0/ /usr/local/hadoop/pig/
# copy pig to nodes
scp -r /usr/local/hadoop/pig/ [email protected]:/usr/local/hadoop/pig/
scp -r /usr/local/hadoop/pig/ [email protected]:/usr/local/hadoop/pig/
# copy pig to edge node
scp -r /usr/local/hadoop/pig/ [email protected]:/usr/local/hadoop/pig/
fi
# .bashrc
sed -i '$ a export PIG_HOME=\/usr\/local\/hadoop\/pig \
\nexport PIG_CONF_DIR=\$PIG_HOME\/conf \
\nexport PIG_CLASSPATH=\$HADOOP_HOME\/conf \
\nexport PATH=\$PIG_HOME\/bin:\$PATH' /home/$user/.bashrc
source ~/.bashrc
logout
EOF
done