2012年7月31日 星期二

Installing HyperTable(with Hadoop) on Centos 6 x86_64 -- single node


(1)Intalling Preparation
    Environment: (@vmware)
        host : CentOS-6.0

        kernel: 2.6.32-71.el6.x86_64 #1 SMP
        MemTotal: 7891424 kB(/proc/meminfo)
        CPU(Quad core) : Intel(R) Core(TM) i3-2130 CPU @ 3.40GHz
        HDD: 1TB*2 (LVM ==> 2T)

        guest: CentOS-6.0
        kernel: 2.6.32-71.el6.x86_64 #1 SMP
        MemTotal: 1G
        CPU *1
        HDD: 100GB
        hostname: hyper
        /etc/hosts
           192.168.65.146   hyper hypertable   ## single node for hypertable and hadoop with hdfs
           192.168.65.135   metaserver            ## single node for kfs

(2)pre-installing tools and hypertable
    login as root  go through with following steps:

    1)gcc , make and date tools
    yum -y install gcc gcc-c++  make ntpdate -y

    ##execute the following command , and append it into /etc/rc.local or/and cronjob
    /usr/sbin/ntpdate -b time.stdtime.gov.tw;/sbin/hwclock --systohc --utc

    2)BerkeleyDB 4.8.X

    cd /usr/local

    wget http://hi.baidu.com/cpuramdisk/item/3410d0ccc53e3f0b0ad93a00
        or
    wget http://download.oracle.com/berkeley-db/db-4.8.26.tar.gz
    tar –xzvf db-4.8.26.tar.gz;
    cd db-4.8.26/build_unix/;
    ../dist/configure --prefix=/usr/local/berkeleydb --enable-cxx (--enable-java)

    make
    sudo make install

    3)boost
    cd /usr/local

    wget http://nchc.dl.sourceforge.net/project/boost/boost/1.49.0/boost_1_49_0.tar.gz
    tar zxvf boost_1_49_0.tar.gz

    cd boost_1_49_0
    cd tools/build/v2/
    ./bootstrap.sh
    ./b2 install --prefix=/usr/local

    4)log4cpp 1.0
   cd /usr/local

   wget http://downloads.sourceforge.net/project/log4cpp/log4cpp-1.0.x%20%28current%29/log4cpp-1.0/log4cpp-1.0.tar.gz
   tar zxvf log4cpp-1.0.tar.gz
   cd log4cpp-1.0
   ./configure
   make
   make install
   ##you might got a error here

   BasicLayout.cpp:37: error: expected constructor, destructor, or type conversion before'< 'token

   ##The error is just because of GCC 4.4 default was not included some libraries, you need to modify src/BasicLayout.cpp and add a line for more #include , as :
   :
   #include "PortabilityImpl.hh"
   #include < log4cpp /BasicLayout.hh >
   #include < log4cpp /Priority.hh >
   #include < log4cpp /FactoryParams.hh >
   #ifdef LOG4CPP_HAVE_SSTREAM
   #include < sstream >
   #endif
   #include < memory >
   namespace log4cpp {
   :


   ##after that , you make again , an other error :

   PatternLayout.cpp:373: error: call of overloaded 'abs(int&)' is ambiguous

   ##it also exist in GCC 4.3 about abs(int &) , modify it as:

      component = new FormatModifierComponent(component, std::abs(minWidth), maxWidth, minWidth < 0);

   ##replace as:

      component = new FormatModifierComponent(component, minWidth > 0 ? minWidth : -minWidth, maxWidth, minWidth < 0);


    5)install other
    yum install expat-devel readline-devel perl-Bit-Vector perl-IO-Zlib perl-IO-Socket-INET6 perl-IO-Socket-SSL perl-IO-String.noarch perl-libwww-perl-5.833-2.el6.noarch


    6)install hypertable
    cd ~
    wget http://cdn.hypertable.com/packages/0.9.5.6/hypertable-0.9.5.6-linux-x86_64.rpm
    rpm -ivh hypertable-0.9.5.6-linux-x86_64.rpm

   
(3)more installation
    1) ruby and gem
        yum install ruby ruby-devel ruby-doc
        cd /usr/local
        wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz
        tar zxvf rubygems-1.3.5.tgz

        cd rubygems-1.3.5
        ruby setup.rb
        gem update
        gem install capistrano
        gem update --system

    2)install hadoop(with hdfs)
        useradd -u 1000 hadoop
        su - hadoop
        mkdir ~/.ssh; ssh-keygen -t dsa
        mv ~/.ssh/id_dsa.pub ~/.ssh/authorized_keys  ## for ssh password-less

        yum install java-1.6.0-openjdk.x86_64 java-1.6.0-openjdk-devel.x86_64 -y

        wget wget http://archive.cloudera.com/cdh/3/hadoop-0.20.2-cdh3u3.tar.gz
        ## I had tried for cdh3u3 and cdh3u4 . cdh3u4 seems with some problems when hypertable connected to
        tar -zxvf  hadoop-0.20.2-cdh3u3.tar.gz

        ln -s  hadoop-0.20.2-cdh3u3 hadoop
 
        ## append the following line into /etc/profile(by root user) , ~/.bashrc(by hadoop user) , /home/hadoop/hadoop/conf/hadoop-env.sh(by hadoop user)
        export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64
 
        ## configure (by hadoop user)
        vi /home/hadoop/hadoop/conf/core-site.xml
                <?xml version="1.0"?>

                <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
                <configuration>
                    <property>
                        <name>fs.default.name</name>
                        <value>hdfs://localhost:9000</value>
                    </property>
                </configuration>


            value of fs.default.name also could be hdfs://hyper:9000

        vi /home/hadoop/hadoop/conf/hdfs-site.xml
                <?xml version="1.0"?>

                <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
                <configuration>
                    <property>
                        <name>dfs.replication</name>
                        <value>1</value>
                    </property>
                </configuration>
              

        vi /home/hadoop/hadoop/conf/mapred-site.xml
                <?xml version="1.0"?>

                <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
                <configuration>
                    <property>
                        <name>mapred.job.tracker</name>
                        <value>localhost:9001</value>
                    </property>
                </configuration>

              value of mapred.job.tracker also could be hyper:9001

        vi /home/hadoop/hadoop/conf/masters
                localhost

          "hyper" is also fine.

        vi /home/hadoop/hadoop/conf/slaves

                localhost


          "hyper" is also fine.


        ## startup hadoop (by hadoop user)
        su - hadoop; cd ~/hadoop
        bin/hadoop namenode -format
        #if you got error , it might be your JAVA_HOME is not setting correct.
        bin/hadoop fs -mkdir /hypertable
        bin/hadoop fs -chmod 777 /hypertable ##(or bin/hadoop fs -chmod -R 777 / )
        bin/hadoop fs -ls /

        bin/start-all.sh   ## you could stop hadoop by bin/stop-all.sh

        netstat -tplnu | grep 9000 ## check hdfs listen port


    3)startup hypertable
        cd /opt/hypertable
        ln -s 0.9.5.6 current
        cd current
        vi conf/hypertable.cfg
       
            #

            # hypertable.cfg
            #


            # HDFS Broker
            HdfsBroker.fs.default.name=hdfs://localhost:9000
           
            # Ceph Broker
            CephBroker.MonAddr=10.0.1.245:6789


            # Local Broker
            DfsBroker.Local.Root=fs/local
           
            # DFS Broker - for clients
            DfsBroker.Port=38030


            # Hyperspace
            Hyperspace.Replica.Host=localhost
            Hyperspace.Replica.Port=38040
            Hyperspace.Replica.Dir=hyperspace
           
            # Hypertable.Master
            Hypertable.Master.Port=38050
           
            # Hypertable.RangeServer
            Hypertable.RangeServer.Port=38060


            Hyperspace.KeepAlive.Interval=30000
            Hyperspace.Lease.Interval=1000000
            Hyperspace.GracePeriod=200000


            # ThriftBroker
            ThriftBroker.Port=38080

        ## startup hypertable
            bin/start-hyperspace.sh
            bin/start-dfsbroker.sh hadoop
            bin/start-master.sh

            bin/start-rangeserver.sh

            bin/start-thriftbroker.sh


        ## stop hypertable
            bin/stop-servers.sh

        ## restart hypertable
           #before you restart it , please checking :
             (a) all hyper-xxx process was stop
             (b) date time already adjust via ntpdate command
             (c) firewall and selinux setting
             (d) hadoop/hdfs is up(netstat -tplnu  | grep 9000)
             (e) following the execute command

                          bin/start-hyperspace.sh

                          bin/start-dfsbroker.sh hadoop
                          bin/start-master.sh
                          bin/start-rangeserver.sh
                          bin/start-thriftbroker.sh

        ## testing hypertable
            bin/ht shell
            hypertable> create namespace test1;
            hypertable> use test1;
            hypertable> create table foo(c1,c2);
            hypertable> INSERT INTO foo VALUES('001', 'c1', 'very'), ('000', 'c1', 'Hypertable'), ('001', 'c2', 'easy'), ('000', 'c2', 'is');
            hypertable> select * from foo;
                000 c1 Hypertable
                000 c2 is
                001 c1 very
                001 c2 easy


    reference: http://hf200012.iteye.com/blog/1565545



沒有留言:

張貼留言

文章分類