Unix/Linux ϵͳ×Ô¶¯»¯¹ÜÀí: Êý¾Ý±¸·ÝÓëͬ²½Æª(2)

À´Ô´:developerWorks Öйú ×÷Õß:³Ì Ñà
¡¡¡¡
  • bosinst.data ¸ÃÎļþÖ¸¶¨Ä¿±êϵͳµÄÐèÇóÒÔ¼°»ù±¾²Ù×÷ϵͳ°²×°³ÌÐòÊÇÔõÑùÔËÐÐ
  • image.data ¸ÃÎļþ°üº¬°²×°¹ý³ÌÖÐʵ¼Ê°²×°µÄ¾µÏñµÄÃèÊöÊý¾Ý£¨Îļþ´óС¡¢Ãû³Æ¡¢×°ÈëµãµÈ£©¡£
  • ±í 3. mksysb ÃüÁîµÄ³£ÓòÎÊý£º

    ²ÎÊý º¬Òå
    -e ¸Ã²ÎÊý½«²»±¸·Ý /etc/exclude.rootvg ÎļþÖж¨ÒåµÄÎļþ
    -i ¸Ã²ÎÊý½«µ÷Óà mkszfile ÃüÁî×Ô¶¯Éú³ÉÒ»¸öÐ嵀 image.data Îļþ
    -m ¸Ã²ÎÊý½«µ÷Óà mkszfile ÃüÁîÉú³ÉÓ³ÉäÎļþ

    ÔÚÔËÐÐ mksysb Ç°£¬¿ÉÒÔÔËÐÐ mksysb -i ÃüÁîÀ´×Ô¶¯Éú³ÉÒ»¸öÐ嵀 image.data Îļþ¡£ÐéÄâ TOC ¿ÉÒÔÈ·±£ mksysb ´Å´øÖаüº¬µÄ¾µÏñÊýÓë»ù±¾²Ù×÷ϵͳ°²×°´Å´øÖеľµÏñÊýÏàͬ¡£×îºó£¬rootvg Êý¾Ý°üº¬Óà mksysb ÃüÁ·ÝµÄʵ¼ÊÊý¾Ý¡£Ëüʵ¼ÊÉÏ»áʹÓà backup ÃüÁî±£´æ rootvg ÖÐËùÓÐ×°ÈëµÄÎļþϵͳµÄÄÚÈÝ¡£

    Èç¹û¶ÔÓû§¾í×é½øÐб¸·ÝµÄ»°£¬¿ÉʹÓÃÏÂÁеÄÃüÁ

     # savevg -if /dev/rmt0 uservg 
    

    ÆäÖУ¬-i ²ÎÊý½«µ÷Óà mkvgdata ÃüÁ-f ²ÎÊý½«Êý¾Ý´æ´¢µ½Ö¸¶¨É豸»òÎļþÖС£

    backup ½éÉÜ

    backup ÊÇ AIX ϵͳÌṩµÄÒ»ÖÖ±¸·ÝÎļþºÍÎļþϵͳµÄ·½·¨£¬Æä±¾Éí¾Í¿ÉÒÔÖ§³ÖÔöÁ¿±¸·ÝºÍ¶à¼¶±¸·Ý£¬²»±Ø½èÖúÆäËü·½Ê½£¬ÆäºÃ´¦Ôڴ˲»ÔÚ׸Êö¡£

    ±í 4. backup ÃüÁîµÄ³£ÓòÎÊý£º

    ²ÎÊý º¬Òå
    -level ¸Ã²ÎÊýÖ¸¶¨±¸·Ý¼¶±ð£¨0£­9£©, ĬÈÏÊÇ 9
    -i ¸Ã²ÎÊý½«°´Ãû³Æ±¸·ÝÕû¸öÎļþϵͳ
    -f ¸Ã²ÎÊý½«Êý¾Ý±¸·Ýµ½Ö¸¶¨É豸ÖÐ
    -p ¸Ã²ÎÊýÔڹ鵵֮ǰÏÈ´ò°ü»òѹËõ£¬ÇÒСÓÚ 2G µÄÎļþ¡£ÊÊÓÃÓÚ²»»î¶¯µÄÎļþϵͳ
    -q ¸Ã²ÎÊýÖ¸¿ÉÒƶ¯½éÖÊÒÑ×¼±¸¾ÍÐ÷
    -u ¸Ã²ÎÊý½«ÓÃÎļþϵͳµÄԭʼÉ豸Ãû³Æ , ʱ¼äÈÕÆÚÒÔ¼°±¸·Ý¼¶±ðÀ´¸üР/etc/dumpdates Îļþ
    -v ¸Ã²ÎÊý½«ÔÚ backup ʱÏÔʾ¸½¼ÓÐÅÏ¢

    ½« /CriticalDate Ŀ¼ºÍËüµÄËùÓÐÎļþºÍ×ÓĿ¼±¸·Ýµ½Ö¸¶¨É豸£¬Ê¹Óãº

     # find /CriticalDate -depth | backup -i -f /dev/rmt0 
    

    ½«-level ºÍ -u ²ÎÊý½áºÏ£¬¿ÉÒÔ½øÐж༶ºÍÔöÁ¿±¸·Ý£º

     # backup -0 -uf /dev/rmt0 /home 
    

    rsync ½éÉÜ

    Èç¹û½«Êý¾Ý±¸·ÝÓëÔ¶³Ì´«Êä½áºÏÆðÀ´£¬Æ©Èç scp£¬¾Í¿ÉÒÔʵÏÖÊý¾ÝµÄÔ¶³Ì±¸·Ý¡£µ«Í¨³£µÄ±¸·Ý·½·¨£¬¶¼ÎÞ·¨¶Ô±¾µØºÍÔ¶³ÌĿ¼ÖеÄÄÚÈݽøÐÐͬ²½¡£

    rsync£¨Remote Sync£©ÊÇ Unix/Linux ϵͳÏÂÒ»¿îÓÅÐãµÄÊý¾Ý±¸·ÝÓëͬ²½¹¤¾ß¡£Ëü¿ÉÒÔ¶ÔÎļþ¼¯½øÐÐͬ²½¡£È»¶ø¸üÓмÛÖµµÄÊÇ£¬rsync ʹÓÃÎļþµÄÔöÁ¿£¬Ò²¾ÍÊÇ˵£¬ËüÔÚÍøÂçÖнö·¢ËÍÁ½¸öÎļþ¼¯ºÏÓÐÇø±ðµÄ²¿·Ö¡£ÕâÑù¿ÉÒÔÕ¼ÓøüÉٵĴø¿í£¬²¢ÇÒËٶȸü¿ì¡£

    rsync µÄÌØÐÔ£º

    • Äܹ»¸üÐÂÕû¸öĿ¼Ê÷ºÍÎļþϵͳ
    • ±£³ÖÔ­ÎļþµÄȨÏÞ£¬Ê±¼ä£¬ÈíÓ²Á´½Ó
    • °²×°ÎÞÐèÌØÊâȨÏÞ
    • ÓÅ»¯µÄÁ÷³Ì£¬Îļþ´«ÊäËÙÂʸß
    • ¿ÉÒÔͨ¹ýÖ±½ÓµÄ socket Á¬½Ó´«ÊäÎļþ£¬»òÕßÑ¡Ôñ rsh£¬ssh µÈ·½Ê½
    • Ö§³ÖÄäÃû´«Êä

    ±í 5. rsync ÃüÁîµÄ³£ÓòÎÊý£º

    ²ÎÊý º¬Òå
    -a ¸Ã²ÎÊý±íʾÒԵݹ鷽ʽ´«ÊäÎļþ£¬²¢±£³ÖËùÓÐÎļþÊôÐÔ
    -v ¸Ã²ÎÊýÏÔʾÏêϸµÄ´«Êä´¦Àí
    -z ¸Ã²ÎÊý¶Ô±¸·ÝµÄÎļþÔÚ´«Êäʱ½øÐÐѹËõ´¦Àí
    -P ¸Ã²ÎÊý½«ÏÔʾ±¸·Ý¹ý³Ì

    Èç¹ûÔÚ¿Í»§¶Ë¶Ô·þÎñÆ÷ÉϵÄÖØÒªÊý¾Ý½øÐб¸·ÝµÄ»°£¬¿ÉʹÓÃÏÂÁеÄÃüÁ


    Çåµ¥ 1. rsync ÃüÁîÑÝʾ
     
     #rsync – avzP rsync@Server::CriticalData /Backup 
    
     =========================== 
     This is Critical Data Server 
     =========================== 
    
     receiving file list ... 
     9 files to consider 
     Location/ 
     Location/Locationlist1 
        97164953  13%    1.11MB/s    0:08:57 
    
    
       706609152 100%    1.17MB/s    0:09:37 (xfer#1, to-check=5/9) 
     Name/Name1 
              44 100%    0.16kB/s    0:00:00 (xfer#2, to-check=3/9) 
     Name/Name2 
              22 100%    0.08kB/s    0:00:00 (xfer#3, to-check=2/9) 
     Time/Monday 
              17 100%    0.06kB/s    0:00:00 (xfer#4, to-check=0/9) 
    
     sent 32111 bytes  received 497214837 bytes  847820.88 bytes/sec 
     total size is 706609242  speedup is 1.42 
    

    Ê״δ«Êä¹ý³Ì½øÐÐÍêÈ«±¸·Ý£¬µ±ÔÙ´ÎÔËÐиÃÃüÁîʱ£¬rsync ½«Ö»´«ÊäÊý¾ÝµÄÔöÁ¿¡£´Ó¶øÍê³ÉÔöÁ¿±¸·Ý¡£

    Èç¹ûÔÚ¿Í»§¶Ë¶Ô·þÎñÆ÷ÉϵÄÖØÒªÊý¾Ý½øÐÐͬ²½µÄ»°£¬¿ÉʹÓÃÏÂÁеÄÃüÁ

     # rsync -avzP --delete rsync@Server::CriticalData /Backup 
    

    ÕâÀïµ÷Óà --delete Ñ¡Ï±íʾ¿Í»§¶ËÉϵÄÊý¾ÝÒªÓë·þÎñÆ÷¶ËÍêÈ«Ò»Ö£¬Èç¹û /Backup Ŀ¼ÖÐÓзþÎñÆ÷²»´æÔÚµÄÎļþ£¬Ôòɾ³ý¡£´Ó¶ø±£³Ö¿Í»§¶ËÓë·þÎñÆ÷µÄÊý¾Ýͬ²½¡£

    ×¢Ò⣺½÷É÷ʹÓà --delete Ñ¡Ï×îºÃ²»Òª°ÑÒѾ­ÓÐÖØÒªÊýËù¾ÝµÄĿ¼µ±×ö¿Í»§¶ËµÄ±¸·ÝĿ¼£¬·ñÔò»áÎóɾ³ýÖØÒªÊý¾Ý¡£

    Èç¹ûÓÿͻ§¶ËµÄ±¸·ÝÊý¾ÝÈ¥»Ö¸´·þÎñÆ÷£¬¿ÉʹÓÃÏÂÁеÄÃüÁ

     #rsync – avzPO  /Backup/ rsync@Server::CriticalData 
    

    ÕâÀïÐèÒª½« rsync.conf ÖÐ read only ÉèÖÃΪ false£¬Í¬Ê±Ê¹ /CirticalData Ŀ¼¾ßÓÐдȨÏÞ¡£

    ×¢Ò⣺Ҳ¿Éµ÷Óà --delete Ñ¡ÏîÀ´±£³Ö¿Í»§¶ËÓë·þÎñÆ÷¶ËµÄÊý¾Ýͬ²½¡£ÔÚºóÃ棬½«Ïêϸ½éÉÜ rsync.conf µÄÅäÖá£-O ²ÎÊýÓÃÓÚºöÂÔĿ¼µÄʱ¼äÊôÐÔ¡£





    Êý¾Ý±¸·ÝÓëͬ²½µÄ×Ô¶¯»¯ÊµÏÖ

    ϵͳ¹ÜÀíÔ±±ØÐëÖ´ÐеÄÊý¾Ý±¸·ÝÓëͬ²½ÈÎÎñ´ó¶àÇ£É浽ijÖÖÐÎʽµÄϵͳÅäÖ㬵±¹ÜϽµÄÈÎÎñ±È½ÏÅÓ´ó£¬Êý¾ÝÁ¿½Ï¶à£¬µ«²Ù×÷Ò»ÑùÇÒÓй̶¨ÖÜÆÚʱ£¬²ÉÓÃ×Ô¶¯»¯½Å±¾¾Í³ÉΪ±ØÈ»¡£ÓÈÆäÊÇΪ¶à¸ö²Ù×÷ϵͳÌṩ֧³Öʱ¡£

    ҪʵÏÖ×Ô¶¯»¯²Ù×÷£¬½Å±¾±àÖÆÊDZØÐëÕÆÎյĻù±¾¼¼ÄÜ¡£Ò»¸ö½Å±¾ÓÉһϵÁÐÃüÁî¹¹³É£¬ÕâЩÃüÁÔðÖ´Ðи÷ÖÖ¸÷ÑùµÄÈÎÎñ¡£ÏµÍ³¹ÜÀíÔ±ÔÚÖظ´Ö´ÐÐÁ˼¸±éÀàËƵÄÃüÁîºó£¬Í¨³£¾ÍÄÜ׼ȷµØÕÆÎÕÒªµã£¬²¢Ï£ÍûÀûÓýű¾£¬½«Öظ´ÐԵŤ×÷½»¸ø¼ÆËã»úÈ¥×ö¡£³£ÓõĽű¾ÓïÑÔÓÐ Shell£¬Perl£¬Tcl/Expect µÈ¡£

    ʵÓÃÃüÁîµÄ×Ô¶¯»¯ÊµÏÖ

    ±¾ÎĵÄʾÀýÖ÷ÒªÊÇͨ¹ý Shell À´ÊµÏֵġ£Shell ÊÇÒ»ÖÖ“½âÊÍÐÔ”ÓïÑÔ£¬ÁгöÁ˹ÜÀíԱͨ¹ý¼üÅÌÇÃÈëµÄÏàͬÃüÁ ²¢ÇÒÿ´ÎÖ´ÐÐÒ»´ÎÕâÑùµÄÃüÁî¡£


    ʱ¼ä:2009-08-20 16:46 À´Ô´:developerWorks Öйú ×÷Õß:³Ì Ñà Ô­ÎÄÁ´½Ó

    ºÃÎÄ,¶¥Ò»ÏÂ
    (1)
    100%
    ÎÄÕÂÕæ²î,²ÈÒ»ÏÂ
    (0)
    0%
    ------·Ö¸ôÏß----------------------------


    °Ñ¿ªÔ´´øÔÚÄãµÄÉí±ß-¾«ÃÀlinuxС¼ÍÄîÆ·
    ÎÞÃÙÏà¹ØÎÄÕ²å¼þ£¬¿ìËÙÌáÉýÁ÷Á¿