source: hadoop4win-setup/my_packages/hbase/bin/hbase-init @ 232

Last change on this file since 232 was 232, checked in by jazz, 14 years ago
  • 加入 0.1.3 變更內容,保留 0.1.2 的 cygwin_mirror/setup.ini
  • Property svn:executable set to *
File size: 2.0 KB
Line 
1#!/bin/bash
2if [ ! -f /usr/src/hbase-*.tar.gz ]; then
3  echo "Hbase tar ball not found at /usr/src/hbase-*.tar.gz!!"
4  exit
5fi
6
7if [ ! -f /opt/hase* ]; then
8  tar zxvf /usr/src/hbase-*.tar.gz -C /opt
9  ln -s /opt/hbase-* /opt/hbase
10
11  cp /opt/hadoop/conf/core-site.xml /opt/hbase/conf
12  cp /opt/hadoop/conf/hdfs-site.xml /opt/hbase/conf
13  cp /opt/hadoop/conf/mapred-site.xml /opt/hbase/conf
14
15cat >> /opt/hbase/conf/hbase-env.sh << EOF
16  export JAVA_HOME=$JAVA_HOME
17  export HADOOP_CONF_DIR=/opt/hadoop/conf
18  export HBASE_HOME=/opt/hbase
19  export HBASE_MANAGES_ZK=true
20EOF
21
22cat > /opt/hbase/conf/hbase-site.xml << EOF
23<?xml version="1.0"?>
24<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
25<configuration>
26  <property>
27    <name>hbase.rootdir</name>
28    <value>hdfs://localhost:9000/hbase</value>
29  </property>
30  <property>
31    <name>hbase.cluster.distributed</name>
32    <value>true</value>
33  </property>
34</configuration>
35EOF
36
37  echo "export PATH=/opt/hbase/bin/:\$PATH" >> /etc/profile
38  echo "/bin/stop-hbase" > ~/.bash_logout
39  echo "/bin/stop-hadoop" >> ~/.bash_logout
40  echo "/bin/stop-hbase" > /etc/skel/.bash_logout
41  echo "/bin/stop-hadoop" >> /etc/skel/.bash_logout
42
43cat > ~/hbase-test << EOF
44create 'test','data'
45put 'test','row1','data:1','v1'
46put 'test','row2','data:2','v2'
47put 'test','row3','data:3','v3'
48scan 'test'
49disable 'test'
50drop 'test'
51list
52exit
53EOF
54
55cat >> /etc/profile << EOF
56  echo "============================================"
57  echo " Use 'start-hadoop' to start hadoop daemons."
58  echo " Use 'start-hadoop' to stop  hadoop daemons."
59  echo " ."
60  echo " run 'start-hbase' to start hbase daemons.  "
61  echo " run 'stop-hbase'  to stop hbase daemons.   "
62  echo " run 'hbase shell hbase-test'  to test      "
63  echo " hbase services.                            "
64  echo " ."
65  echo " Use 'jps' to check java process for        "
66  echo " troubleshooting.                           "
67  echo "============================================"
68EOF
69
70  echo " Starting HBase ....."
71  /bin/start-hbase
72fi
Note: See TracBrowser for help on using the repository browser.