Skip to content

Commit 978c99e

Browse files
committed
hadoop
1 parent 4824a82 commit 978c99e

File tree

2 files changed

+158
-0
lines changed

2 files changed

+158
-0
lines changed

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ kjyw
55

66
简单 高效 快捷!
77

8+
这里面的脚本是运维经常使用的脚本,方便大家使用!
9+
10+
如果您有好用的脚本,希望一起来分享,可以联系邮件ppabc#qq.com,或关注https://github.com/aqzt(微信扫描头像)
11+
812
运维就是踩坑,踩坑的最高境界就是:踩遍所有的坑,让别人无坑可踩!
913

1014
做事的宗旨是:一条命令的事,一个脚本的事!

hadoop/start.sh

+154
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
#!/bin/bash
2+
#addgroup hadoop
3+
#adduser --ingroup hadoop hadoop
4+
#ssh-keygen -t rsa
5+
#ssh-copy-id -i $HOME/.ssh/id_rsa.pub hadoop@master
6+
cat >> /etc/hosts <<EOF
7+
192.168.1.31 hdfs1
8+
192.168.1.32 hdfs2
9+
192.168.1.33 hdfs3
10+
192.168.1.34 hdfs4
11+
192.168.1.35 hdfs5
12+
192.168.1.36 hdfs6
13+
EOF
14+
path="/usr/local/java"
15+
pwd=`pwd`
16+
if [ ! -d "$path" ];
17+
then
18+
cd $pwd
19+
mkdir -p /usr/local/java
20+
mv jdk-6u45-linux-x64.bin /usr/local/java/
21+
cd /usr/local/java/
22+
chmod 777 jdk-6u45-linux-x64.bin
23+
echo -e "\n" | ./jdk-6u45-linux-x64.bin
24+
echo $pwd
25+
else
26+
echo java is already installed!
27+
fi
28+
hadoop="/home/hadoop/hadoop"
29+
if [ ! -d "$hadoop" ];
30+
then
31+
#/usr/sbin/groupadd hadoop
32+
#/usr/sbin/useradd hadoop -g hadoop
33+
cd $pwd
34+
tar zxvf hadoop-1.1.2.tar.gz
35+
mkdir /home/hadoop
36+
mv hadoop-1.1.2 /home/hadoop/hadoop
37+
else
38+
echo hadoop is already installed!
39+
fi
40+
cat >> /etc/profile <<EOF
41+
HADOOP_HOME=/home/hadoop/hadoop
42+
JAVA_HOME=/usr/local/java/jdk1.6.0_45
43+
JRE_HOME=/usr/local/java/jdk1.6.0_45/jre
44+
EOF
45+
echo "PATH=$JAVA_HOME/bin:$PATH:$HADOOP_HOME/bin" >> /etc/profile
46+
echo "CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH" >> /etc/profile
47+
echo "export JAVA_HOME CLASSPATH PATH HADOOP_HOME" >> /etc/profile
48+
#PATH=$JAVA_HOME/bin:$PATH:$HADOOP_HOME/bin
49+
#CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
50+
#export JAVA_HOME CLASSPATH PATH HADOOP_HOME
51+
#cat >> /home/hadoop/.bashrc <<EOF
52+
#export PATH=/home/hadoop/hadoop/bin:$PATH
53+
#EOF
54+
source /etc/profile
55+
cat >> /home/hadoop/.bashrc <<EOF
56+
HADOOP_HOME=/home/hadoop/hadoop
57+
JAVA_HOME=/usr/local/java/jdk1.6.0_45
58+
JRE_HOME=/usr/local/java/jdk1.6.0_45/jre
59+
EOF
60+
echo "PATH=$JAVA_HOME/bin:$PATH:$HADOOP_HOME/bin" >> /home/hadoop/.bashrc
61+
echo "CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH" >> /home/hadoop/.bashrc
62+
echo "export JAVA_HOME CLASSPATH PATH HADOOP_HOME" >> /home/hadoop/.bashrc
63+
64+
cat >> /etc/sysctl.conf <<EOF
65+
net.ipv6.conf.all.disable_ipv6 = 1
66+
net.ipv6.conf.default.disable_ipv6 = 1
67+
net.ipv6.conf.lo.disable_ipv6 = 1
68+
EOF
69+
chmod 777 /tmp
70+
chown -R hadoop:hadoop /home/hadoop/hadoop
71+
source /etc/profile
72+
sysctl -p
73+
cat > /home/hadoop/hadoop/conf/masters <<EOF
74+
hdfs1
75+
EOF
76+
cat > /home/hadoop/hadoop/conf/slaves <<EOF
77+
hdfs1
78+
EOF
79+
cat > /home/hadoop/hadoop/conf/core-site.xml <<EOF
80+
<?xml version="1.0"?>
81+
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
82+
83+
<!-- Put site-specific property overrides in this file. -->
84+
85+
<configuration>
86+
<property>
87+
<name>fs.default.name</name>
88+
<value>hdfs://hdfs1:9000</value>
89+
</property>
90+
</configuration>
91+
EOF
92+
cat > /home/hadoop/hadoop/conf/hdfs-site.xml <<EOF
93+
<?xml version="1.0"?>
94+
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
95+
96+
<!-- Put site-specific property overrides in this file. -->
97+
98+
<configuration>
99+
<property>
100+
<name>dfs.name.dir</name>
101+
<value>/home/hadoop/dfs/filesystem/name</value>
102+
</property>
103+
<property>
104+
<name>dfs.data.dir</name>
105+
<value>/home/hadoop/dfs/filesystem/data</value>
106+
</property>
107+
<property>
108+
<name>dfs.replication</name>
109+
<value>3</value>
110+
</property>
111+
<property>
112+
<name>dfs.balance.bandwidthPerSec</name>
113+
<value>1048576</value>
114+
<description>
115+
Specifies the maximum amount of bandwidth that each datanode can utilize for the balancing purpose in term of the number of bytes per second.
116+
</description>
117+
</property>
118+
</configuration>
119+
EOF
120+
cat > /home/hadoop/hadoop/conf/mapred-site.xml <<EOF
121+
<?xml version="1.0"?>
122+
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
123+
124+
<!-- Put site-specific property overrides in this file. -->
125+
126+
<configuration>
127+
<property>
128+
<name>mapred.job.tracker</name>
129+
<value>hdfs1:9001</value>
130+
</property>
131+
<property>
132+
<name>mapred.tasktracker.map.tasks.maximum</name>
133+
<value>4</value>
134+
</property>
135+
<property>
136+
<name>mapred.tasktracker.reduce.tasks.maximum</name>
137+
<value>4</value>
138+
</property>
139+
<property>
140+
<name>mapred.system.dir</name>
141+
<value>/home/hadoop/mapreduce/system</value>
142+
</property>
143+
<property>
144+
<name>mapred.local.dir</name>
145+
<value>/home/hadoop/mapreduce/local</value>
146+
</property>
147+
</configuration>
148+
EOF
149+
#cat > /home/hadoop/hadoop/conf/slaves <<EOF
150+
#hdfs1
151+
#EOF
152+
#cat > /home/hadoop/hadoop/conf/slaves <<EOF
153+
#hdfs1
154+
#EOF

0 commit comments

Comments
 (0)