python -m SimpleHTTPServer 8888
#!/bin/bash
sed -i 's/^#//g' /etc/yum.repos.d/centos7.4.repo
sed -i 's/enabled=0/enabled=1/g' /etc/yum.repos.d/centos7.4.repo
rm -rf /etc/salt/pki/minion/minion_master.pub
systemctl stop firewalld.service
systemctl disable firewalld
mshn=cnsz17pl2287
msip=10.116.100.149
hn="hadoop_datanode_"$(hostname)
yum install salt-minion -y
sed -i "s/^#master:.*/master: $mshn/g" /etc/salt/minion
sed -i "s/^master:.*/master: $mshn/g" /etc/salt/minion
sed -i "s/^#id:.*/id: $hn/g" /etc/salt/minion
sed -i "s/^id:.*/id: $hn/g" /etc/salt/minion
echo "$msip $mshn" >> /etc/hosts
systemctl restart salt-minion.service
systemctl enable salt-minion
echo "TERM=linux" >> /etc/profile
source /etc/profile
wget http://10.116.102.155:8888/jdk.tar.gz
wget http://10.116.102.155:8888/hadoop.tar.gz
wget http://10.116.102.155:8888/hadoop-conf.tar.gz
wget http://10.116.102.155:8888/falcon-agent-standard.tar.gz
wget http://10.116.102.155:8888/service.tar.gz
tar -xvf falcon-agent-standard.tar.gz
tar -xvf jdk.tar.gz
tar -xvf hadoop.tar.gz
tar -xvf hadoop-conf.tar.gz
tar -xvf service.tar.gz
cat service/profile.txt >> /etc/profile
ln -s hadoop-2.7.3-snappy hadoop
chmod -R 755 /app/*
cp service/*.service /etc/systemd/system
mkdir -p /root/.ssh
cp service/authorized_keys /root/.ssh
mkdir -p /log/balant
chown -R hdfs. /log/balant
chmod -R 777 /log/balant
mkdir -p /app/var/run/hadoop-hdfs
chown -R hdfs. /app/var/run/hadoop-hdfs
chmod -R 755 /app/var/run/hadoop-hdfs
useradd hdfs
useradd yarn
if [ ! -d "/log/hadoop" ]
then
mkdir -p /log/hadoop
fi
if [ ! -d "/log/yarn" ]
then
mkdir -p /log/yarn
fi
chown -R hdfs. /log/hadoop
chown -R yarn. /log/yarn
for i in `seq 1 12`
do
if [ ! -d "/HDATA/$i/dfs" ]
then
mkdir -p /HDATA/$i/dfs/local
chown -R hdfs. /HDATA/$i/dfs
fi
if [ ! -d "/HDATA/$i/mapred" ]
then
mkdir -p /HDATA/$i/mapred/local
chown -R yarn. /HDATA/$i/mapred
fi
if [ ! -d "/HDATA/$i/yarn" ]
then
mkdir -p /HDATA/$i/yarn/local
mkdir -p /HDATA/$i/yarn/logs
chown -R yarn. /HDATA/$i/yarn
fi
done
systemctl enable datanode.service
systemctl enable nodemanager.service
systemctl enable falconagent.service
useradd falcon
touch /etc/sudoers.d/falcon
echo "falcon ALL=(ALL) ALL" >>/etc/sudoers.d/falcon
chown -R falcon:falcon /app/falcon
systemctl start falconagent.service
cd /app/falcon
sudo -u falcon ./open-falcon monitor agent
#!/bin/bash
dn=($(cat dn.txt | awk '{print $1}'))
line=$(cat dn.txt | awk '{print $1}' | wc -l)
echo $line
for(( i=0;i<${#dn[@]} ;i++))
do
hostname="hadoop_datanode_"${dn[$i]}
salt $hostname cmd.run 'mkdir -p /log/balant'
salt $hostname cmd.run 'chown -R hdfs. /log/balant'
salt $hostname cmd.run 'chmod -R 777 /log/balant'
salt $hostname cmd.run 'mkdir -p /app/var/run/hadoop-hdfs'
salt $hostname cmd.run 'chown -R hdfs. /app/var/run/hadoop-hdfs'
salt $hostname cmd.run 'chmod -R 755 /app/var/run/hadoop-hdfs'
done