-
Notifications
You must be signed in to change notification settings - Fork 2
/
hbaseconf.sh
106 lines (90 loc) · 3.18 KB
/
hbaseconf.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/usr/bin/env bash
# File: hbaseconf.sh
# Name: D.Saravanan
# Date: 09/09/2020
# Script to install and configure Apache HBase-2.2.5 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/hbase/2.2.5/hbase-2.2.5-bin.tar.gz -P /home/$user/Downloads/
tar -xzf /home/$user/Downloads/hbase-2.2.5-bin.tar.gz
mv /home/$user/hbase-2.2.5/ /usr/local/hadoop/hbase/
# copy hbase to nodes
scp -r /usr/local/hadoop/hbase/ $user@172.17.0.3:/usr/local/hadoop/hbase/
scp -r /usr/local/hadoop/hbase/ $user@172.17.0.4:/usr/local/hadoop/hbase/
# hbase-site.xml
sed -i '/<configuration>/,/<\/configuration>/{//!d}' /usr/local/hadoop/hbase/conf/hbase-site.xml
sed -i 's/<configuration>/& \
\n\t<property> \
\n\t\t<name>hbase.master<\/name> \
\n\t\t<value>172.17.0.2:60000<\/value> \
\n\t<\/property> \
\n\t<property> \
\n\t\t<name>hbase.rootdir<\/name> \
\n\t\t<value>hdfs:\/\/172.17.0.2:9000\/hbase<\/value> \
\n\t<\/property> \
\n\t<property> \
\n\t\t<name>hbase.cluster.distributed<\/name> \
\n\t\t<value>true<\/value> \
\n\t<\/property> \
\n\t<property> \
\n\t\t<name>hbase.zookeeper.property.dataDir<\/name> \
\n\t\t<value>hdfs:\/\/172.17.0.2:9000\/zookeeper<\/value> \
\n\t<\/property> \
\n\t<property> \
\n\t\t<name>hbase.zookeeper.quorum<\/name> \
\n\t\t<value>172.17.0.2,172.17.0.3,172.17.0.4<\/value> \
\n\t<\/property> \
\n\t<property> \
\n\t\t<name>hbase.zookeeper.property.clientPort<\/name> \
\n\t\t<value>2181<\/value> \
\n\t<\/property> \
\n\t<property> \
\n\t\t<name>hbase.unsafe.stream.capability.enforce<\/name> \
\n\t\t<value>false<\/value> \
\n\t<\/property> \
\n\t<property> \
\n\t\t<name>zookeeper.znode.parent<\/name> \
\n\t\t<value>\/hbase<\/value> \
\n\t<\/property> \
/' /usr/local/hadoop/hbase/conf/hbase-site.xml
# copy hbase to edge node
scp -r /usr/local/hadoop/hbase/ $user@172.17.0.5:/usr/local/hadoop/hbase/
# region servers
sed -i '/localhost/s/^/#/g' /usr/local/hadoop/hbase/conf/regionservers
sed -i '$ a 172.17.0.3 \
\n172.17.0.4' /usr/local/hadoop/hbase/conf/regionservers
fi
if [ $ip != $mnode ] && [ $ip != $enode ]
then
sed -i '/<configuration>/,/<\/configuration>/{//!d}' /usr/local/hadoop/hbase/conf/hbase-site.xml
sed -i 's/<configuration>/& \
\n\t<property> \
\n\t\t<name>hbase.rootdir<\/name> \
\n\t\t<value>hdfs:\/\/172.17.0.2:9000\/hbase<\/value> \
\n\t<\/property> \
\n\t<property> \
\n\t\t<name>hbase.cluster.distributed<\/name> \
\n\t\t<value>true<\/value> \
\n\t<\/property> \
/' /usr/local/hadoop/hbase/conf/hbase-site.xml
fi
# hbase-env.sh
sed -i 's/JAVA_HOME/& \
export JAVA_HOME=\/usr\/lib\/jvm\/adoptopenjdk-8-hotspot-amd64 \
/' /usr/local/hadoop/hbase/conf/hbase-env.sh
#sed -i '/# export JAVA_HOME/d' /usr/local/hadoop/hbase/conf/hbase-env.sh
sed -i '/HBASE_MANAGES_ZK=true/s/^#//g' /usr/local/hadoop/hbase/conf/hbase-env.sh
# .bashrc
sed -i '$ a export HBASE_HOME=\/usr\/local\/hadoop\/hbase \
\nexport PATH=\$HBASE_HOME\/bin:\$PATH' /home/$user/.bashrc
source ~/.bashrc
logout
EOF
done