天天看點

TFS檔案系統

TFS檔案系統

TFS(Taobao FileSystem)是一個高可擴充、高可用、高性能、面向網際網路服務的分布式檔案系統,其設計目标是支援海量的非結構化資料的存儲;TFS使用C++語言開發,需要運作在64bit Linux OS上,TFS為淘寶提供海量小檔案存儲,通常檔案大小不超過1M,滿足了淘寶對小檔案存儲的需求,被廣泛地應用 在淘寶各項應用中。它采用了HA架構和平滑擴容,保證了整個檔案系統的可用性和擴充性。同時扁平化的資料組織結構,可将檔案名映射到檔案的實體位址,簡化了檔案的通路流程,一定程度上為TFS提供了良好的讀寫性能。本文介紹如何在Linux環境編譯安裝TFS及相關使用說明:

一、安裝依賴的軟體包:

1、automake TFS基于automake工具建構:

1 yum install automake . noarch

2、libtool automake需要使用libtool:

1 yum install libtool

3、realine 用于指令行編輯的庫:

1 yum install readline - devel

4、libz-devel 用于資料壓縮/解壓縮:

1 yum install zlib - devel

5、uuid-devel 用于生成全局唯一ID:

1 2 yum install e2fsprogs - devel yum install libuuid - devel

6、tcmalloc google的記憶體管理庫(由玩googl被封,那就暫且跳過吧,可選)

二、安裝tb-common-utils

TFS使用tb-common-utils軟體包,tb-common-utils包含淘寶使用的基礎系統庫tbsys和網絡庫tbnet兩個元件;安裝tb-common-utils前需要設定環境變量TBLIB_ROOT,tbsys和tbnet将會被安裝TBLIB_ROOT對應的路徑(必須是絕對路徑)下,TFS會在這個路徑下查找tbsys、tbnet頭檔案和庫。

設定TBLIB_ROOT環境變量:

1、在~/.bash_profile檔案中加入,export TBLIB_ROOT=path_to_tbutil , 然後執行source:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ~ / . bash_profile   vi ~ / . bash_profile # .bash_profile   # Get the aliases and functions if [ - f ~ / . bashrc ] ; then . ~ / . bashrc fi   # User specific environment and startup programs   PATH = $ PATH : $ HOME / bin   export PATH export TBLIB_ROOT = / usr / local / tb - common - utils   # source ~/.bash_profile

2、下載下傳源碼:

1 # svn co -r 18 http://code.taobao.org/svn/tb-common-utils/trunk tb-common-utils

注意: 這裡不要checkout最新版本,version18以後的修改導緻部分接口不能前向相容

1 2 3 4 5 6 7 8 9 # cd /usr/local/tb-common-utils/ # sh build.sh   checking for C ++ compiler default output file name . . . configure : error : in ` / usr / local / tb - common - utils / tbnet ': configure: error: C++ compiler cannot create executables See `config.log' for more details . make : * * * No targets specified and no makefile found .    Stop . make : * * * No rule to make target ` install' .    Stop .

這個錯誤是因為缺少gcc-c++:

1 yum install gcc - c ++

如果一切順利,tb-common-utils已經安裝成功到$TBLIB_ROOT路徑下;

三、安裝TFS

TFS開源使用者大都隻使用TFS的基本功能,是以這個版本我們預設隻編譯TFS的nameserver,dataserver,client和tool,以去除對mysql的依賴,需要使用到rcserver(全局資源管理服務),metaserver(TFS自定義檔案名服務)的使用者請自行編譯安裝這兩個服務。

下載下傳源碼并安裝:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 # svn co http://code.taobao.org/svn/tfs/branches/dev_for_outer_users tfs # cd tfs/ # sh build.sh init + aclocal + libtoolize -- force -- copy libtoolize : putting auxiliary files in ` . '. libtoolize: copying file `./ltmain.sh' libtoolize : Consider adding ` AC_CONFIG_MACRO_DIR ( [ m4 ] ) ' to configure.ac and libtoolize: rerunning libtoolize, to keep the correct libtool macros in-tree. libtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile . am . libtoolize : ` AC_PROG _RANLIB ' is rendered obsolete by `LT_INIT' + autoconf -- force + automake -- foreign -- copy -- add - missing configure . ac : 16 : installing ` . / config . guess ' configure.ac:16: installing `./config.sub' configure . ac : 8 : installing ` . / install - sh ' configure.ac:8: installing `./missing' src / adminserver / Makefile . am : installing ` . / depcomp ' # ./configure --prefix=/usr/local/taobaoFS --with-release   checking for tc_cfree in -ltcmalloc... no configure: error: in `/usr/local/tfs/tfs' : configure : error : tcmalloc link failed ( -- without - tcmalloc to disable ) See ` config . log' for more details .

注意,這裡報錯了,是因為之前我們沒有安裝tcmalloc,是以這裡要改一下編譯條件:

1 2 3 # ./configure --prefix=/usr/local/taobaoFS --with-release --without-tcmalloc # make # make install

–prefix 指定tfs安裝路徑,預設會被安裝到~/tfs_bin目錄

–with-release 指定按release版本的參數進行編譯,如果不指定這個參數,則會按開發版本比較嚴格的參數編譯,包含-Werror參數,所有的警告都會被當錯誤,在高版本gcc下會導緻項目編譯不過,很多開源使用者回報的編譯問題都跟這個有關,因為gcc高版本對代碼的檢查越來越嚴格,淘寶内部使用的gcc版本是gcc-4.1.2。

四、配置檔案:

ns.conf:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 # cd /usr/local/taobaoFS/conf/ # cat ns.conf | grep -v ^# | grep -v ^$ [ public ] log_size = 1073741824 log_num = 8 log_level = info task_max_queue_size = 10240 port = 8108 work_dir = / usr / local / taobaoFS dev_name = eth0 thread_count = 32 ip_addr = 192.168.1.63 [ nameserver ] safe_mode_time = 360 ip_addr_list = 192.168.1.63 | 192.168.0.2 group_mask = 255.255.255.255 max_write_timeout = 3 cluster_id = 1 block_max_use_ratio = 98 block_max_size = 75497472 max_replication = 2 min_replication = 2 replicate_ratio = 50 max_write_filecount = 64 use_capacity_ratio = 96 heart_interval = 4 object_dead_max_time = 300 object_clear_max_time = 180 heart_thread_count = 4 heart_max_queue_size = 2048 report_block_thread_count = 6 report_block_max_queue_size = 32 report_block_hour_range = 2 ~ 4 report_block_time_interval = 1 repl_wait_time = 180 compact_delete_ratio =    10    compact_max_load = 200 compact_hour_range = 1 ~ 10 dump_stat_info_interval = 60000000 balance_percent = 0.05 add_primary_block_count = 3 task_percent_sec_size = 200 oplog_sync_max_slots_num = 1024 oplog_sync_thread_num = 1 group_count = 1 group_seq    = 0 discard_newblk_safe_mode_time = 360 choose_target_server_random_max_num = 128

ds.conf:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 # cat ds.conf | grep -v ^# | grep -v ^$ [ public ] log_size = 1073741824 log_num = 8 log_level = info task_max_queue_size = 10240 port = 8200 work_dir = / usr / local / taobaoFS dev_name = eth0 thread_count = 32 ip_addr = 192.168.1.64 [ dataserver ] ip_addr = 192.168.1.63 ip_addr_list = 192.168.1.63 | 192.168.0.2 port = 8108 heart_interval = 2 check_interval = 2 replicate_threadcount = 2 block_max_size = 75497472 dump_visit_stat_interval = 60 backup_type = 1 mount_name = / data / disk mount_maxsize = 768959044 base_filesystem_type = 1 superblock_reserve = 0 avg_file_size = 15360 mainblock_size = 75497472 extblock_size = 4194304 block_ratio = 0.5 hash_slot_ratio = 0.5

第三台伺服器的ds配置如下:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 # cat ds.conf | grep -v ^# | grep -v ^$ [ public ] log_size = 1073741824 log_num = 8 log_level = info task_max_queue_size = 10240 port = 8200 work_dir = / usr / local / taobaoFS dev_name = eth0 thread_count = 32 ip_addr = 192.168.1.66 [ dataserver ] ip_addr = 192.168.1.63 ip_addr_list = 192.168.1.63 | 192.168.0.2 port = 8108 heart_interval = 2 check_interval = 2 replicate_threadcount = 2 block_max_size = 75497472 dump_visit_stat_interval = 60 backup_type = 1 mount_name = / data / disk mount_maxsize = 768959044 base_filesystem_type = 1 superblock_reserve = 0 avg_file_size = 15360 mainblock_size = 75497472 extblock_size = 4194304 block_ratio = 0.5 hash_slot_ratio = 0.5

五、啟動說膽:

1、運作TFS

啟動nameserver

執行scripts目錄下的tfs:

1 2 # ./tfs start_ns nameserver is up SUCCESSFULLY pid : 24744

2、啟動DS

現有TFS可以在一台伺服器上啟動多個DataServer程序。一般每個DataServer程序負責一個磁盤。

将資料盤格式化成EXT4檔案系統,并挂載到/data/tfs1至/data/tfs(i),其中i為磁盤号。

啟動步驟:

A、存儲區預配置設定。執行scripts下的stfs format n (n為挂載點的序号,具體用法見stfs的Usage)。例如stfs format 2,4-6 則會對/data/tfs2,

/data/tfs4,/data/tfs5,/data/tfs6,進行預配置設定。運作完後會在生成/data/tfs2, /data/tfs4,/data/tfs5,/data/tfs6下預先建立主塊,擴充塊及相應的統計資訊。

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 # ./stfs clear 1 clear ds 1 SUCCESSFULLY [ 2014 - 08 - 07 10 : 59 : 11 ] INFO   blockfile_manager . cpp : 111 [ 140398366021408 ] clear block file system end . mount_point : / data / disk1 , ret : 1 # ./stfs format 1 format ds 1 SUCCESSFULLY mount name : / data / disk1 max mount size : 768959044 base fs type : 1 superblock reserve offset : 0 main block size : 75497472 extend block size : 4194304 block ratio : 0.5 file system version : 1 avg inner file size : 15360 hash slot ratio : 0.5 [ 2014 - 08 - 07 12 : 16 : 15 ] INFO   blockfile_manager . cpp : 1091 [ 140579583227680 ] super block mount point : / data / disk1 . [ 2014 - 08 - 07 12 : 16 : 15 ] INFO   blockfile_manager . cpp : 1171 [ 140579583227680 ] cal block count . avail data space : 783334178816 , main block count : 9338 , ext block count : 18676 tag TAOBAO mount time 1407384975 mount desc / data / disk1 max use space 787414061056 base filesystem 1 superblock reserve 0 bitmap start offset 324 avg inner file size 15360 block type ratio 0.5 main block count 9338 main block size 75497472 extend block count 18676 extend block size 4194304 used main block count 0 used extend block count 0 hash slot ratio 0.5 hash slot size 2730 first mmap size 122880 mmap size step 4096 max mmap size 3686400 version 1 [ 2014 - 08 - 07 12 : 16 : 15 ] INFO   blockfile_manager . cpp : 1213 [ 140579583227680 ] cal bitmap count . item count : 28015 , slot count : 3502

B、運作data server。有兩種方法:

通過adminserver來啟動dataserver(推薦): 執行scripts下的./tfs admin_ds

直接啟動dataserver,執行scripts下的./tfs start_ds 2,4-6, 則會啟動dataserver2,dataserver4,dataserver5,dataserver6

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 # ./tfs start_ds 1 dataserver 1 is up SUCCESSFULLY pid : 2212 # ./tfs start_ds 2 dataserver 2 is up SUCCESSFULLY pid : 28715   # netstat -lantp | grep dataserver tcp          0        0 0.0.0.0 : 8200                  0.0.0.0 : *                    LISTEN        2960 / dataserver     tcp          0        0 0.0.0.0 : 8201                  0.0.0.0 : *                    LISTEN        2960 / dataserver     tcp          0        0 192.168.1.64 : 36866            192.168.1.63 : 8108            ESTABLISHED 2960 / dataserver     tcp          0        1 192.168.1.64 : 38846            192.168.0.2 : 8108              SYN _SENT      2960 / dataserver      # netstat -lantp | grep dataserver tcp          0        0 0.0.0.0 : 8203                  0.0.0.0 : *                    LISTEN        29636 / dataserver     tcp          0        0 0.0.0.0 : 8202                  0.0.0.0 : *                    LISTEN        29636 / dataserver     tcp          0        0 192.168.1.66 : 56412            192.168.1.63 : 8108            ESTABLISHED 29636 / dataserver     tcp          0        1 192.168.1.66 : 49068            192.168.0.2 : 8108              SYN _SENT      29636 / dataserver

程式基本上啟動起來了

第六、相關操作

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 # /usr/local/taobaoFS/bin/ssm -s 192.168.1.63:8108 show > server - b SERVER_ADDR           CNT BLOCK 192.168.1.64 : 8200      194    2846    2847    2848    2849    2850    2851    2852    2853    2854    2855                            2856    2857    2858    2859    2860    2861    2862    2863    2864    2865                            2866    2867    2868    2869    2870    2871    2872    2873    2874    2875                            2876    2877    2878    2879    2880    2881    2882    2883    2884    2885                            2886    2887    2888    2889    2890    2891    2892    2893    2894    2895                            2896    2897    2898    2899    2900    2901    2902    2903    2904    2905                            2906    2907    2908    2909    2910    2911    2912    2913    2914    2915                            2916    2917    2918    2919    2920    2921    2922    2923    2924    2925                            2926    2927    2928    2929    2930    2931    2932    2933    2934    2935                            2936    2937    2938    2939    2940    2941    2942    2943    2944    2945                            2946    2947    2948    2949    2950    2951    2952    2953    2954    2955                            2956    2957    2958    2959    2960    2961    2962    2963    2964    2965                            2966    2967    2968    2969    2970    2971    2972    2973    2974    2975                            2976    2977    2978    2979    2980    2981    2982    2983    2984    2985                            2986    2987    2988    2989    2990    2991    2992    2993    2994    2995                            2996    2997    2998    2999    3000    3001    3002    3003    3004    3005                            3006    3007    3008    3009    3010    3011    3012    3013    3014    3015                            3016    3017    3018    3019    3020    3021    3022    3023    3024    3025                            3026    3027    3028    3029    3030    3031    3032    3033    3034    3035                            3036    3037    3038    3139 192.168.1.66 : 8202      194    2846    2847    2848    2849    2850    2851    2852    2853    2854    2855                            2856    2857    2858    2859    2860    2861    2862    2863    2864    2865                            2866    2867    2868    2869    2870    2871    2872    2873    2874    2875                            2876    2877    2878    2879    2880    2881    2882    2883    2884    2885                            2886    2887    2888    2889    2890    2891    2892    2893    2894    2895                            2896    2897    2898    2899    2900    2901    2902    2903    2904    2905                            2906    2907    2908    2909    2910    2911    2912    2913    2914    2915                            2916    2917    2918    2919    2920    2921    2922    2923    2924    2925                            2926    2927    2928    2929    2930    2931    2932    2933    2934    2935                            2936    2937    2938    2939    2940    2941    2942    2943    2944    2945                            2946    2947    2948    2949    2950    2951    2952    2953    2954    2955                            2956    2957    2958    2959    2960    2961    2962    2963    2964    2965                            2966    2967    2968    2969    2970    2971    2972    2973    2974    2975                            2976    2977    2978    2979    2980    2981    2982    2983    2984    2985                            2986    2987    2988    2989    2990    2991    2992    2993    2994    2995                            2996    2997    2998    2999    3000    3001    3002    3003    3004    3005                            3006    3007    3008    3009    3010    3011    3012    3013    3014    3015                            3016    3017    3018    3019    3020    3021    3022    3023    3024    3025                            3026    3027    3028    3029    3030    3031    3032    3033    3034    3035                            3036    3037    3038    3139 show > server - w SERVER_ADDR           CNT WRITABLE BLOCK 192.168.1.64 : 8200      90    2849    2850    2852    2856    2857    2859    2860    2862    2865    2866                            2871    2878    2879    2884    2886    2887    2891    2895    2899    2900                            2901    2905    2906    2907    2911    2912    2913    2914    2915    2917                            2920    2921    2925    2927    2929    2930    2932    2934    2935    2936                            2937    2938    2942    2944    2945    2946    2948    2950    2951    2955                            2957    2958    2959    2960    2961    2964    2967    2968    2978    2979                            2980    2982    2984    2985    2987    2988    2990    2993    2994    3000                            3004    3005    3006    3007    3010    3012    3013    3014    3015    3016                            3018    3020    3022    3025    3027    3029    3030    3035    3038    3139 192.168.1.66 : 8202      103    2846    2847    2848    2851    2853    2854    2855    2858    2861    2863                            2864    2867    2868    2869    2870    2872    2874    2875    2876    2877                            2880    2881    2882    2883    2885    2888    2889    2890    2892    2893                            2894    2896    2897    2898    2902    2903    2904    2908    2909    2910                            2916    2918    2919    2922    2923    2924    2926    2928    2931    2933                            2939    2940    2941    2943    2947    2949    2952    2953    2954    2956                            2962    2963    2965    2966    2969    2970    2971    2972    2973    2974                            2975    2976    2977    2981    2983    2986    2989    2991    2992    2995                            2996    2997    2998    2999    3001    3002    3003    3008    3009    3011                            3017    3019    3021    3023    3024    3026    3028    3031    3032    3033                            3034    3036    3037 show > server - m SERVER_ADDR           CNT MASTER BLOCK 192.168.1.64 : 8200      64    2849    2850    2852    2856    2857    2859    2860    2862    2865    2866                            2871    2878    2879    2884    2886    2887    2891    2895    2899    2900                            2901    2905    2906    2907    2911    2912    2913    2914    2915    2917                            2920    2921    2925    2927    2929    2930    2932    2934    2935    2936                            2937    2990    2993    2994    3000    3004    3005    3006    3007    3010                            3012    3013    3014    3015    3016    3018    3020    3022    3025    3027                            3029    3030    3035    3038 192.168.1.66 : 8202      64    2846    2847    2848    2851    2853    2854    2855    2858    2861    2863                            2864    2867    2868    2869    2870    2872    2874    2875    2876    2877                            2880    2881    2882    2883    2885    2969    2970    2971    2972    2973                            2974    2975    2976    2977    2981    2983    2986    2989    2991    2992                            2995    2996    2997    2998    2999    3001    3002    3003    3008    3009                            3011    3017    3019    3021    3023    3024    3026    3028    3031    3032                            3033    3034    3036    3037 show > machine - a    SERVER_IP     NUMS UCAP    / TCAP =    UR   BLKCNT   LOAD TOTAL_WRITE   TOTAL_READ   LAST_WRITE   LAST_READ   MAX_WRITE   MAX_READ -- -- -- -- -- -- -- - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -    -- -- -- -- --    -- -- -- -- --    -- -- -- -- -    -- -- -- --    -- -- -- -- -    192.168.1.64      1 15.16G 729.53G    2 %      194    10    4.1K      0      0      0      0      0      0      0    0      0    0      0    192.168.1.66      1 15.16G 729.53G    2 %      194    10    4.1K      0      3      0      0      0      0      0    0      0    0      0 Total : 2            2 30.31G    1.42T    2 %      388    10    8.3K      0      3      0      0      0      0      0   show > machine - p    SERVER_IP     NUMS UCAP    / TCAP =    UR   BLKCNT   LOAD LAST_WRITE   LAST_READ   MAX_WRITE   MAX_READ STARTUP_TIME -- -- -- -- -- -- -- - -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --    -- -- -- -- -    -- -- -- -- -    -- -- -- -- -- -- -- -- -- --    192.168.1.64      1 15.16G 729.53G    2 %      194    10      0      0      0      0      0      0      0      0 2014 - 08 - 07 18 : 57 : 11    192.168.1.66      1 15.16G 729.53G    2 %      194    10      0      0      0      0      0      0      0      0 2014 - 08 - 07 19 : 00 : 06 Total : 2            2 30.31G    1.42T    2 %      388    10        0      0      0      0

存資料至tfs:

1 2 3 4 5 6 7 8 # /usr/local/taobaoFS/bin/tfstool -s 192.168.1.63:8108 -i "put /root/haproxy.cfg" 中間省略 N行 . . . [ 2014 - 08 - 07 14 : 49 : 38 ] DEBUG tfs_file . cpp : 803 [ 139796598765408 ] do response success . index : 0 , phase : 3 , ret : 0 , blockid : 2866 , fileid : 1 , offset : 0 , size : 0 , crc : - 1605709817 , inneroffset : 0 , filenumber : 4612152245717303297 , status : 4 , rserver : 192.168.1.64 : 8200 , wserver : 192.168.1.64 : 8200. put / root / haproxy . cfg = > T1YybTByJT1RCvBVdK success . [ 2014 - 08 - 07 14 : 49 : 39 ] INFO   transport . cpp : 460 [ 139796598765408 ] DELIOC , IOCount : 1 , IOC : 0x26076b0 [ 2014 - 08 - 07 14 : 49 : 39 ] DEBUG socket . cpp : 122 [ 139796598765408 ] 1 ? ? fd = 4 , addr = 192.168.1.63 : 8108 [ 2014 - 08 - 07 14 : 49 : 39 ] INFO   transport . cpp : 460 [ 139796598765408 ] DELIOC , IOCount : 0 , IOC : 0x2609460 [ 2014 - 08 - 07 14 : 49 : 39 ] DEBUG socket . cpp : 122 [ 139796598765408 ] 1 ? ? fd = 6 , addr = 192.168.1.64 : 8200

從tfs取資料:

1 2 3 4 5 6 7 8 # /usr/local/taobaoFS/bin/tfstool -s 192.168.1.63:8108 -i "get T1YybTByJT1RCvBVdK /root/test/haproxy.cfg" 中間省略 N行 . . . [ 2014 - 08 - 07 15 : 27 : 27 ] DEBUG tfs_file . cpp : 225 [ 139699370776416 ] file read reach end , offset : 0 , size : 1048576 fetch T1YybTByJT1RCvBVdK = > / root / test / haproxy . cfg success . [ 2014 - 08 - 07 15 : 27 : 28 ] INFO   transport . cpp : 460 [ 139699370776416 ] DELIOC , IOCount : 1 , IOC : 0xb6e6b0 [ 2014 - 08 - 07 15 : 27 : 28 ] DEBUG socket . cpp : 122 [ 139699370776416 ] 1 ? ? fd = 4 , addr = 192.168.1.63 : 8108 [ 2014 - 08 - 07 15 : 27 : 28 ] INFO   transport . cpp : 460 [ 139699370776416 ] DELIOC , IOCount : 0 , IOC : 0xb70680 [ 2014 - 08 - 07 15 : 27 : 28 ] DEBUG socket . cpp : 122 [ 139699370776416 ] 1 ? ? fd = 6 , addr = 192.168.1.66 : 8202

存放大檔案至tfs:

1 2 3 4 5 6 7 8 9 # /usr/local/taobaoFS/bin/tfstool -s 192.168.1.63:8108 -i "putL /root/CentOS-6.5-x86_64-minimal-freewaf-1.2.1-release_21152.iso" 中間省略 N行 . . . put / root / CentOS - 6.5 - x86_64 - minimal - freewaf - 1.2.1 - release_21152 . iso = > L1YybTByZT1RCvBVdK success . [ 2014 - 08 - 07 17 : 03 : 50 ] INFO   transport . cpp : 460 [ 140184226105184 ] DELIOC , IOCount : 2 , IOC : 0x194c6b0 [ 2014 - 08 - 07 17 : 03 : 50 ] DEBUG socket . cpp : 122 [ 140184226105184 ] 1 ? ? fd = 4 , addr = 192.168.1.63 : 8108 [ 2014 - 08 - 07 17 : 03 : 50 ] INFO   transport . cpp : 460 [ 140184226105184 ] DELIOC , IOCount : 1 , IOC : 0x194e970 [ 2014 - 08 - 07 17 : 03 : 50 ] DEBUG socket . cpp : 122 [ 140184226105184 ] 1 ? ? fd = 8 , addr = 192.168.1.66 : 8202 [ 2014 - 08 - 07 17 : 03 : 50 ] INFO   transport . cpp : 460 [ 140184226105184 ] DELIOC , IOCount : 0 , IOC : 0x194f930 [ 2014 - 08 - 07 17 : 03 : 50 ] DEBUG socket . cpp : 122 [ 140184226105184 ] 1 ? ? fd = 9 , addr = 192.168.1.64 : 8200

取大檔案:

1 2 3 4 5 6 7 8 9 # /usr/local/taobaoFS/bin/tfstool -s 192.168.1.63:8108 -i "get L1YybTByZT1RCvBVdK /data/CentOS-6.5-x86_64-minimal-freewaf-1.2.1-release_21152.iso" [ 2014 - 08 - 07 17 : 08 : 14 ] DEBUG tfs_file . cpp : 201 [ 139878759466848 ] file read reach end , offset : 645128192 , size : 0 fetch L1YybTByZT1RCvBVdK = > / data / CentOS - 6.5 - x86_64 - minimal - freewaf - 1.2.1 - release_21152 . iso success . [ 2014 - 08 - 07 17 : 08 : 15 ] INFO   transport . cpp : 460 [ 139878759466848 ] DELIOC , IOCount : 2 , IOC : 0xc5a6b0 [ 2014 - 08 - 07 17 : 08 : 15 ] DEBUG socket . cpp : 122 [ 139878759466848 ] 1 ? ? fd = 4 , addr = 192.168.1.63 : 8108 [ 2014 - 08 - 07 17 : 08 : 15 ] INFO   transport . cpp : 460 [ 139878759466848 ] DELIOC , IOCount : 1 , IOC : 0xc5c7b0 [ 2014 - 08 - 07 17 : 08 : 15 ] DEBUG socket . cpp : 122 [ 139878759466848 ] 1 ? ? fd = 6 , addr = 192.168.1.64 : 8200 [ 2014 - 08 - 07 17 : 08 : 15 ] INFO   transport . cpp : 460 [ 139878759466848 ] DELIOC , IOCount : 0 , IOC : 0xc63790 [ 2014 - 08 - 07 17 : 08 : 15 ] DEBUG socket . cpp : 122 [ 139878759466848 ] 1 ? ? fd = 7 , addr = 192.168.1.66 : 8202

對比結果:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 [ root @ IP - 1 - 63 ~ ] # ll -h /root/ total 828M - rw -- -- -- - . 1 root root 1.1K Jul 31 10 : 48 anaconda - ks . cfg - rw - r -- r -- . 1 root root 3.5M Jul 31 14 : 16 Atlas - 2.1.el6.x86_64.rpm - rw - r -- r --    1 root root 616M Aug    3 13 : 27 CentOS - 6.5 - x86_64 - minimal - freewaf - 1.2.1 - release_21152 . iso - rw - r -- r -- . 1 root root 3.1K Jul 31 13 : 53 haproxy . cfg - rw - r -- r -- . 1 root root 8.4K Jul 31 10 : 48 install . log - rw - r -- r -- . 1 root root 3.4K Jul 31 10 : 47 install . log . syslog - rw - r -- r --    1 root root    51M Jun 19 06 : 05 Ipart . apk - rw - r -- r --    1 root root 137M Mar 22 14 : 47 lmnp . tar . gz - rw - r -- r --    1 root root    22M Nov 13    2013 Percona - Server - 5.5.31 - rel30 . 3.tar.gz drwxr - xr - x    2 root root 4.0K Aug    7 15 : 27 test   [ root @ IP - 1 - 63 ~ ] # ll -h test/ total 3.5M - rw - r -- r -- 1 root root 3.5M Aug    7 15 : 26 Atlas - 2.1.el6.x86_64.rpm - rw - r -- r -- 1 root root 3.1K Aug    7 15 : 27 haproxy . cfg   [ root @ IP - 1 - 63 ~ ] # ll  -h /data/ total 616M - rw - r -- r --    1 root root 616M Aug    7 17 : 08 CentOS - 6.5 - x86_64 - minimal - freewaf - 1.2.1 - release_21152 . iso drwx -- -- -- . 2 root root    16K Jul 31 10 : 45 lost + found

對比結果大小相同。

TFS

繼續閱讀