Skip to content

Instantly share code, notes, and snippets.

@nalingarg2
Last active August 29, 2015 14:26
Show Gist options
  • Save nalingarg2/b3ef1420c90b02d9dc48 to your computer and use it in GitHub Desktop.
Save nalingarg2/b3ef1420c90b02d9dc48 to your computer and use it in GitHub Desktop.
prereq for cluster setup
#!/bin/bash
set -x
#IFS=":"
LIST="87 90 89 88 91 85"
for i in $LIST; do
ssh root@10.2.1.$i '
passwd
chkconfig iptables off
/etc/init.d/iptables stop
chkconfig iptables --list
setenforce 0
cat > /etc/sysconfig/selinux <<\EOF
SELINUX=disabled
SELINUXTYPE=targeted
EOF
ip=`ifconfig eth0 2>/dev/null|awk '/inet addr:/ {print $2}' | sed 's/addr://'`
echo $ip
if [[ "$ip" == "10.2.1.85" ]]; then
hostname server
cat > /etc/sysconfig/network <<\EOF
NETWORKING=yes
HOSTNAME=server
EOF
elif [[ "$ip" == "10.2.1.87" ]]; then
hostname namenode
cat > /etc/sysconfig/network <<\EOF
NETWORKING=yes
HOSTNAME=namenode
EOF
elif [[ "$ip" == "10.2.1.88" ]]; then
hostname snn
cat > /etc/sysconfig/network <<\EOF
NETWORKING=yes
HOSTNAME=snn
EOF
elif [[ "$ip" == "10.2.1.89" ]]; then
hostname datanodeone
cat > /etc/sysconfig/network <<\EOF
NETWORKING=yes
HOSTNAME=datanodeone
EOF
elif [[ "$ip" == "10.2.1.90" ]]; then
hostname datanodetwo
cat > /etc/sysconfig/network <<\EOF
NETWORKING=yes
HOSTNAME=datanodetwo
EOF
elif [[ "$ip" == "10.2.1.91" ]]; then
hostname datanodethree
cat > /etc/sysconfig/network <<\EOF
NETWORKING=yes
HOSTNAME=datanodethree
EOF
cat >> /etc/hosts <<\EOF
10.2.1.85 server
10.2.1.87 nn
10.2.1.88 snn
10.2.1.89 datanodeone
10.2.1.90 datanodetwo
10.2.1.91 datanodethree
EOF
reboot
'
done
# change disk space
#!/bin/bash
#p,n,p,3,20806, ,p,w
set -x
#IFS=":"
LIST="87 90 89 88 91 85"
for i in $LIST; do
ssh root@10.2.1.$i '
fdisk -l
lsblk
fdisk /dev/vda
'
done
vgextend VolGroup00 /dev/vda3
lvextend -l +100%FREE /dev/VolGroup00/LogVol00
resize2fs /dev/VolGroup00/LogVol00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment