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

Last change on this file was 243, checked in by jazz, 13 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
RevLine 
[129]1#!/bin/bash
2mkdir -p /lib/jvm
3mkdir -p /opt
[143]4
[129]5if [ ! -x /lib/jvm/jdk* ]; then
[241]6  echo "Installing Sun JDK ...."
[129]7  unzip /usr/src/jdk*.zip -d /lib/jvm/
8fi
[143]9
[129]10if [ ! -x /opt/hadoop ]; then
[241]11  echo "Installing Hadoop ...."
[129]12  tar zxvf /usr/src/hadoop-*.tar.gz -C /opt/
[241]13  mv /opt/hadoop-* /opt/hadoop
[242]14  cp /opt/hadoop/conf/ /opt/hadoop/conf-local
15  mv /opt/hadoop/conf/ /opt/hadoop/conf-pseudo
[241]16  ln -s /opt/hadoop/conf-pseudo /opt/hadoop/conf
[242]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
[243]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
[129]51fi
[143]52
[129]53export JAVA_HOME=$(dirname /lib/jvm/jdk*/bin/)
[136]54echo export JAVA_HOME=$JAVA_HOME >> /opt/hadoop/conf/hadoop-env.sh
55echo export HADOOP_HOME=/opt/hadoop >> /opt/hadoop/conf/hadoop-env.sh
[140]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
[129]60cd $JAVA_HOME
61chmod a+x `find . -name "*.exe"`
62chmod a+x `find . -name "*.dll"`
63cd /opt/hadoop
[236]64/opt/hadoop/bin/hadoop namenode -format
[232]65source /etc/profile
[140]66/bin/start-hadoop
[241]67sleep 10
68/opt/hadoop/bin/hadoop dfsadmin -safemode leave
[236]69/opt/hadoop/bin/hadoop fs -mkdir tmp
[140]70echo "/bin/stop-hadoop" > ~/.bash_logout
71echo "/bin/stop-hadoop" > /etc/skel/.bash_logout
[129]72cygstart http://localhost:50070
[139]73cygstart http://localhost:50030
[236]74exit
Note: See TracBrowser for help on using the repository browser.