2013年6月10日 星期一

upgrading hypertable under cdh4

(0) environmental
     Hostname  processes          ip
     ========  =================  ================
     master01  Hypertable.Master  192.168.122.11
               Hyperspace
               DfsBroker
               RangeServer
               Namenode(CDH4)      
     smaster   SecondaryNamenode  192.168.122.10
               JobTracker
     knode020  DfsBroker          192.168.122.20
               RangeServer
               Datanode
               TaskTracker

     knode021  DfsBroker          192.168.122.21
               RangeServer
               Datanode
               TaskTracker

     old Hypertable Version: 
              hypertable-0.9.6.5.59309c4-linux-x86_64.tar.gz
     new Hypertable Version: 
              hypertable-0.9.7.7-linux-x86_64.rpm 



(1) download 0.9.7.7 rpm file
   ssh to master01 as root user:
   [root@master01~] cd /mnt/nfssvr/extras/hypertable/rpm
   [root@master01 rpm]# wget http://cdn.hypertable.com/packages/0.9.7.7/hypertable-0.9.7.7-linux-x86_64.rpm

(2) upgrading
     (a) stop your hypertable cluster(my Capfile is in /root)
     [root@master01 rpm] cd ~
     [root@master01 rpm] cap stop
     [root@master01 rpm] ps -ef | grep hyper
   # if there was any process exist, stop it

     [root@master01 rpm] /opt/hypertable/current/bin/stop-servers.sh

     (b) modify your Capfile
     [root@master01 rpm] cd ~
     [root@master01 ~] vi Capfile
         :

         #set :hypertable_version, "0.9.6.5.59309c4"
         set :hypertable_version, "0.9.7.7"
         #set :default_pkg, "/mnt/nfssvr/extras/hypertable/rpm/hypertable-0.9.6.5.59309c4-linux-x86_64.tar.gz"
         set :default_pkg, "/mnt/nfssvr/extras/hypertable/rpm/hypertable-0.9.7.7-linux-x86_64.rpm"
         :
         :

     (c) install it & upgrade it

     [root@master01 ~] cd ~
     [root@master01 ~] cap install_package
     [root@master01 ~] cap dist
     [root@master01 ~] ls /opt/hypertable

drwxr-xr-x 7 root root      4096 Jun  7 16:55 0.9.6.5.59309c4
drwxr-xr-x 8 root root      4096 Jun 10 14:05 0.9.7.7
lrwxrwxrwx 1 root root        15 Jun  7 16:55 current -> 0.9.6.5.59309c4
-rwxr-xr-x 1 root root 103614419 Jun  7 16:55 hypertable-0.9.6.5.59309c4-linux-x86_64.tar.gz


   #so far , /opt/hypertabl/0.9.7.7 was installed 
   #,but soft link "current" was still pointed to 0.9.6.5.59309c4
   #cap dist to update new version

     [root@master01 ~] cap upgrade
   #"cap upgrade" whill :
   # 1.verifying the format is Compatible (between old hypertable and new one). Also you could verify compatible by yourself "/opt/hypertable/current/upgrade-ok.sh"
   # 2.Copy folders(run/ conf/ run/...etc)from old(0.9.6.5.59309c4) version to new one
   # 3.redirect the soft link to "0.9.7.7"

     [root@master01 ~] ls /opt/hypertable

drwxr-xr-x 7 root root      4096 Jun  7 16:55 0.9.6.5.59309c4
drwxr-xr-x 7 root root      4096 Jun 10 14:06 0.9.7.7
lrwxrwxrwx 1 root root         7 Jun 10 14:06 current -> 0.9.7.7
-rwxr-xr-x 1 root root 103614419 Jun  7 16:55 hypertable-0.9.6.5.59309c4-linux-x86_64.tar.gz

      (d)soft link
      #disable  softlink liblog4cpp
     [root@master01 ~] vi /mnt/nfssvr/extras/lib_alias.sh
      :
      :
  #if [ ! -e /opt/hypertable/current/lib/liblog4cpp.so ]; then
  #    log4cpp_fname="$(ls /opt/hypertable/current/lib/liblog4cpp* | grep liblog4cpp.so.)"
  #    ln -s $log4cpp_fname       /opt/hypertable/current/lib/liblog4cpp.so

  #fi
  exit 0
    
     #relink lib alias
     [root@master01 ~] cap lib_alias
     [root@master01 ~]# ls -l /opt/hypertable/current/lib/*.so
           :
     lrwxrwxrwx 1 root root       45 2013-06-13 13:48 /opt/hypertable/current/lib/libevent.so -> /opt/hypertable/current/lib/libevent-1.4.so.2
           :
           :
           :
     lrwxrwxrwx 1 root root       46 2013-06-13 13:38 /opt/hypertable/current/lib/libthrift.so -> /opt/hypertable/current/lib/libthrift-0.8.0.so

     (e) start hypertable
     #Now you could start up hypertable normally. Under CDH4 , you need to do more before you startup (otherwise you would get a exception)
     

   [root@master01 ~]# cap shell
   cap> /opt/hypertable/current/bin/set-hadoop-distro.sh cdh4
    [establishing connection(s) to master01, knode020, knode021, smaster]
     ** [out :: knode020] Hypertable successfully configured for Hadoop cdh4
     ** [out :: knode021] Hypertable successfully configured for Hadoop cdh4
     ** [out :: master01] Hypertable successfully configured for Hadoop cdh4
     ** [out :: smaster] Hypertable successfully configured for Hadoop cdh4
    cap> quit
    exiting

   [root@master01 ~]# cap start



     (f) for makefile
   CC=g++
   CFLAGS=-c -Wall -D_REENTRANT -I/opt/hypertable/current/include \
          -I/opt/hypertable/current/include/thrift
   LDFLAGS=-rdynamic -L/opt/hypertable/current/lib -lHyperThrift \
           -lHyperCommon -lHypertable -lthrift -levent
   #        -lHyperCommon -lHypertable -lthrift -levent -llog4cpp
   BIN=../bin

   all: client_test candle candle2

   client_test: client_test.o
           $(CC) client_test.o $(LDFLAGS) -o client_test
           cp client_test $(BIN)
           :
           :
   client_test.o: client_test.cc
           $(CC) $(CFLAGS) client_test.cc
           :
           :
   clean:
           rm -rf *o client_test


           :
           :

see more:
     http://hypertable.com/documentation/administrator_guide/upgrading
    https://groups.google.com/forum/?fromgroups#!topic/hypertable-user/iuduinCcIjU

  

2013年6月4日 星期二

foremost recovery deleted cpp source code

1. download
   http://apt.sw.be/redhat/el6/en/x86_64/rpmforge/RPMS/foremost-1.5.7-1.el6.rf.x86_64.rpm

2. install
    rpm -ivh foremost-1.5.7-1.el6.rf.x86_64.rpm

3. make sure the location of your deleted files
    /home/user/<path-to-deleted-file>

[root@master01 ~]# df
Àɮרt²Î               1K-°Ï¬q      ¤w¥Î     ¥i¥Î ¤w¥Î% ±¾¸üÂI
/dev/sda2             20642428   2524600  17069252  13% /
tmpfs                  1027468         0   1027468   0% /dev/shm
/dev/sda1               198337     27712    160385  15% /boot
/dev/sda3            181515576    191876 172103248   1% /opt/kccs1
nfssvr:/home/nfs      20642432   2055808  17538048  11% /mnt/nfssvr
 
   /home/user/<path-to-deleted-file> belongs to /dev/sda2

4. recoverying the deleted files
   cd /home/user
   mkdir output
   foremost -vqQ -o output -t cpp -i /dev/sda2

5. lookup results
    ls -l /home/user/output


reference: http://www.unixmen.com/recover-deleted-files-with-foremost/
               http://maitnoobsatwork.blogspot.tw/2012/04/recover-lost-data-using-foremost.html

文章分類