source: hadoop4win-setup/my_packages/hadoop/bin/hadoop4win-init @ 250

Last change on this file since 250 was 243, checked in by jazz, 14 years ago
  • modified start-hadoop-daemon
    • leave safe mode after started
  • modified start-hadoop-daemon
    • configure /opt/hadoop/conf/mapred-site.xml
  • Property svn:executable set to *
File size: 2.2 KB
Line 
1#!/bin/bash
2mkdir -p /lib/jvm
3mkdir -p /opt
4
5if [ ! -x /lib/jvm/jdk* ]; then
6  echo "Installing Sun JDK ...."
7  unzip /usr/src/jdk*.zip -d /lib/jvm/
8fi
9
10if [ ! -x /opt/hadoop ]; then
11  echo "Installing Hadoop ...."
12  tar zxvf /usr/src/hadoop-*.tar.gz -C /opt/
13  mv /opt/hadoop-* /opt/hadoop
14  cp /opt/hadoop/conf/ /opt/hadoop/conf-local
15  mv /opt/hadoop/conf/ /opt/hadoop/conf-pseudo
16  ln -s /opt/hadoop/conf-pseudo /opt/hadoop/conf
17  cat > /opt/hadoop/conf/core-site.xml << EOF
18<?xml version="1.0"?>
19<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
20<configuration>
21  <property>
22    <name>fs.default.name</name>
23    <value>hdfs://localhost:9000</value>
24  </property>
25  <property>
26    <name>hadoop.tmp.dir</name>
27    <value>/var/hadoop/hadoop-\${user.name}</value>
28  </property>
29</configuration>
30EOF
31  cat > /opt/hadoop/conf/hdfs-site.xml << EOF
32<?xml version="1.0"?>
33<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
34<configuration>
35  <property>
36    <name>dfs.replication</name>
37    <value>1</value>
38  </property>
39</configuration>
40EOF
41  cat > /opt/hadoop/conf/mapred-site.xml << EOF
42<?xml version="1.0"?>
43<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
44<configuration>
45  <property>
46    <name>mapred.job.tracker</name>
47    <value>localhost:9001</value>
48  </property>
49</configuration>
50EOF
51fi
52
53export JAVA_HOME=$(dirname /lib/jvm/jdk*/bin/)
54echo export JAVA_HOME=$JAVA_HOME >> /opt/hadoop/conf/hadoop-env.sh
55echo export HADOOP_HOME=/opt/hadoop >> /opt/hadoop/conf/hadoop-env.sh
56echo export HADOOP_CLASSPATH=/opt/hadoop >> /opt/hadoop/conf/hadoop-env.sh
57echo export HADOOP_CONF_DIR=/opt/hadoop/conf >> /opt/hadoop/conf/hadoop-env.sh
58echo export JAVA_HOME=$JAVA_HOME >> /etc/profile
59echo "export PATH=/opt/hadoop/bin/:$JAVA_HOME/bin:\$PATH" >> /etc/profile
60cd $JAVA_HOME
61chmod a+x `find . -name "*.exe"`
62chmod a+x `find . -name "*.dll"`
63cd /opt/hadoop
64/opt/hadoop/bin/hadoop namenode -format
65source /etc/profile
66/bin/start-hadoop
67sleep 10
68/opt/hadoop/bin/hadoop dfsadmin -safemode leave
69/opt/hadoop/bin/hadoop fs -mkdir tmp
70echo "/bin/stop-hadoop" > ~/.bash_logout
71echo "/bin/stop-hadoop" > /etc/skel/.bash_logout
72cygstart http://localhost:50070
73cygstart http://localhost:50030
74exit
Note: See TracBrowser for help on using the repository browser.