大家都知道tfs分布式存储安装方法,特别是v1版本的,v2版本的几乎没人讲,维护的文档更是少之又
少,tfs要是用好了确实是好东西,虽说开源了,但是很少人敢于尝试,主要是坑太多,坑太多是因为
需要了解的知识点太多,没有完善的文档,所以一直推广不起来,只能淘宝和与之相关的公司在用了
。
不多说了,能开源就不错啦,本篇只讲下tfs三大管理工具:tfstool ssm admintool。
一,tfstool
[[email protected] ~]# /usr/local/tfs/bin/tfstool -s 192.168.88.197:8100
[2016-10-25 09:42:18] DEBUG base_packet_factory.cpp:48 [140724280203104] pcode: 20,
length: 28
[2016-10-25 09:42:18] DEBUG socket.cpp:113 [140724280203104] 打开, fd=4,
addr=192.168.88.197:8100
[2016-10-25 09:42:18] INFO transport.cpp:394 [140724280203104] ADDIOC, SOCK: 4,
192.168.88.197:8100, RON: 1, WON: 1, IOCount:1, IOC:0x195ec90
[2016-10-25 09:42:18] DEBUG channelpool.cpp:57 [140724280203104] 分配的Channel总数:25
(48)
[2016-10-25 09:42:18] INFO tfs_session.cpp:812 [140724280203104] get cluster id from
nameserver success. cluster id: 1
[2016-10-25 09:42:18] INFO tfs_client_impl.cpp:584 [140724280203104] set cache time:
1800
[2016-10-25 09:42:18] INFO tfs_client_impl.cpp:565 [140724280203104] set cache items:
1000
TFS> help
supported command:
@ file batch run command in file
batch file batch run command in file
cd [directory] change work directory
cfi tfsname check file info
exit exit
get tfsname localfile get file from tfs
help show help info
hide tfsname [action] hide tfs file
listblock blockid list block server list
ls [directory] list directory content
lsf blockid [detail] [serverip:port] list file list in block
put localfile [tfsname [suffix] [force]] put file to tfs
putl localfile [suffix] put file to tfs large file
pwd print current directory
quit quit
rename tfsname newsuffix rename tfs file to new suffix
rm tfsname remove tfs file
stat tfsname stat tfs file
statblk blockid [serverip:port] stat a block
undel tfsname undelete tfs file
uput localfile [tfsname [suffix] [force]] unique put file to tfs
urm tfsname unique remove tfs file
vcblk serverip:port count visit count block
TFS> listblock 1010 #可以查看块数据放在那台服务器那块盘上
[2016-10-25 09:42:47] DEBUG base_packet_factory.cpp:48 [140724280203104] pcode: 2,
length: 12
list block 1010 success.
------block: 1010, has 2 replicas------
block: 1010, (0)th server: 192.168.88.185:8202
block: 1010, (1)th server: 192.168.88.184:8246
TFS> lsf blockid
invalid blockid: 0
TFS> lsf blockid 1010
invalid blockid: 0
TFS> lsf 1010
[2016-10-25 09:43:27] DEBUG base_packet_factory.cpp:48 [140724280203104] pcode: 2,
length: 12
[2016-10-25 09:43:27] DEBUG base_packet_factory.cpp:48 [140724280203104] pcode: 14,
length: 12
[2016-10-25 09:43:27] DEBUG socket.cpp:113 [140724280203104] 打开, fd=5,
addr=192.168.88.185:8202
[2016-10-25 09:43:27] INFO transport.cpp:394 [140724280203104] ADDIOC, SOCK: 5,
192.168.88.185:8202, RON: 1, WON: 1, IOCount:2, IOC:0x197b570
[2016-10-25 09:43:27] DEBUG channelpool.cpp:57 [140724280203104] 分配的Channel总数:50
(48)
FileList Size = 711
T1byxTByJT1RCvBVdK
T1byxTByhT1RCvBVdK
T1byxTByxT1RCvBVdK
T1byxTByZT1RCvBVdK
T1byxTBydT1RCvBVdK
T1byxTByDT1RCvBVdK
......
T1byxTBQh_1RCvBVdK
T1byxTBQx_1RCvBVdK
T1byxTBQZ_1RCvBVdK
T1byxTBQd_1RCvBVdK
T1byxTBQD_1RCvBVdK
T1byxTBQY_1RCvBVdK
Total : 711 files
TFS> stat T1byxTBQY_1RCvBVdK #可以查看具体文件状态
[2016-10-25 09:44:09] DEBUG tfs_session.cpp:376 [140724280203104] local cache miss,
blockid: 1010
[2016-10-25 09:44:09] DEBUG base_packet_factory.cpp:48 [140724280203104] pcode: 2,
length: 12
[2016-10-25 09:44:09] DEBUG local_key.cpp:58 [140724280203104] block_id: 1010, select ds
1, 192.168.88.184:8246
[2016-10-25 09:44:09] DEBUG tfs_session.cpp:916 [140724280203104] local cache insert,
blockid: 1010
[2016-10-25 09:44:09] DEBUG local_key.cpp:58 [140724280203104] block_id: 1010, select ds
1, 192.168.88.184:8246
[2016-10-25 09:44:09] DEBUG tfs_file.cpp:118 [140724280203104] tfs open success: get
block info success, blockid: 1010, fileid: 711, mode: 32, ret: 0
[2016-10-25 09:44:09] DEBUG local_key.cpp:58 [140724280203104] block_id: 1010, select ds
1, 192.168.88.184:8246
[2016-10-25 09:44:09] DEBUG tfs_file.cpp:1451 [140724280203104] req stat file flag: 32
[2016-10-25 09:44:09] DEBUG base_packet_factory.cpp:48 [140724280203104] pcode: 17,
length: 16
[2016-10-25 09:44:09] DEBUG socket.cpp:113 [140724280203104] 打开, fd=6,
addr=192.168.88.184:8246
[2016-10-25 09:44:09] INFO transport.cpp:394 [140724280203104] ADDIOC, SOCK: 6,
192.168.88.184:8246, RON: 1, WON: 1, IOCount:3, IOC:0x197c420
[2016-10-25 09:44:09] DEBUG channelpool.cpp:57 [140724280203104] 分配的Channel总数:75
(48)
[2016-10-25 09:44:09] DEBUG tfs_file.cpp:755 [140724280203104] do request success.
client: 0x197b3c0, index: 0, phase: 6, ret: 0, blockid: 1010, fileid: 711, offset: 0,
size: 0, crc: 0, inneroffset: 0, filenumber: 1, status: 1, rserver: 192.168.88.184:8246,
wserver: 192.168.88.185:8202.
[2016-10-25 09:44:09] DEBUG tfs_file.cpp:588 [140724280203104] send packet. request size:
1, successful request size: 1
[2016-10-25 09:44:09] DEBUG tfs_file.cpp:668 [140724280203104] get success response.
client id: 0x197b3c0, request size: 1, get response size: 1
[2016-10-25 09:44:09] DEBUG tfs_file.cpp:803 [140724280203104] do response success.
index: 0, phase: 6, ret: 0, blockid: 1010, fileid: 711, offset: 0, size: 0, crc: 0,
inneroffset: 0, filenumber: 1, status: 4, rserver: 192.168.88.184:8246, wserver:
192.168.88.185:8202.
[2016-10-25 09:44:09] DEBUG local_key.cpp:58 [140724280203104] block_id: 1010, select ds
1, 192.168.88.184:8246
stat T1byxTBQY_1RCvBVdK success.
FILE_NAME: T1byxTBQY_1RCvBVdK
BLOCK_ID: 1010
FILE_ID: 711
OFFSET: 74398237
SIZE: 79661
OCCUPY SIZE: 79697
MODIFIED_TIME: 2016-07-08 18:
38:56
CREATE_TIME: 2016-07-08 18:38:56
STATUS: 0
CRC: 1772954053
TFS>
二,ssm
[[email protected] ~]# /usr/local/tfs/bin/ssm -s 192.168.88.197:8100
show > help
supported command:
block [-n num] [-d block_id] [-s] [-c] [-i] [> filename] show block info.
-n the number of one fetch, default 1024, optional.
-d block id, optional.
-s print server list, optional.
-c execute times, default 1, optional.
-i interval time, default 2, optional.
> redirect to file, optional.
server [-n num] [-r server_ip] [-b] [-w] [-m] [-c] [-i] [> filename] show server info.
-n the number of one fetch, default 1024, optional.
-r server ip string, when parameter -n is invalid.
-b print block list, optional.
-w print writable block list, optional.
-m print master block list, optional.
-c execute times, optional.
-i interval time, optional.
> redirect to file, optional.
machine [-a] [-p] [-f] [-c] [-i] [> filename] show machine info.
-a print all info, optional.
-p print part of infos, optional.
-f print stat of certain infos, for monitor, optional.
-c execute times, optional.
-i interval
> redirect to file, optional.
batch exec cmd in batch
quit(q) quit
exit exit
help(h) show help info
show > block -n 10 -d 1010 #查看block简单状态,admintool可以查看详细状态
BLOCK_ID VERSION FILECOUNT SIZE DEL_FILE DEL_SIZE SEQ_NO COPYS
1010 711 711 74477934 0 0 712 2
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.88.182 24 13.63T 36.67T 37% 178596 92 1.5M 0 1 0 0
0 0 0 0 0 0 0
192.168.88.183 24 13.63T 36.67T 37% 178608 27 1.5M 0 4 0 0
0 0 0 0 0 0 0
......
show > server -n 10 #查看磁盘状态
SERVER_ADDR UCAP / TCAP = UR BLKCNT LOAD TOTAL_WRITE TOTAL_READ
LAST_WRITE LAST_READ STARTUP_TIME
192.168.88.182:8200 581.17G 1.53T 37% 7439 73 62.2K 0 0 0 64.0K
0 0 0 2016-10-08 19:23:49
192.168.88.183:8200 581.56G 1.53T 37% 7444 23 62.4K 0 0 0 80.5K
0 0 0 2016-10-08 19:24:13
......
show >
三,admintool
[[email protected] ~]# /usr/local/tfs/bin/admintool -s 192.168.88.197:8100
[2016-10-25 09:54:40] DEBUG base_packet_factory.cpp:48 [140137745778528] pcode: 20,
length: 28
[2016-10-25 09:54:40] DEBUG socket.cpp:113 [140137745778528] 打开, fd=4,
addr=192.168.88.197:8100
[2016-10-25 09:54:40] INFO transport.cpp:394 [140137745778528] ADDIOC, SOCK: 4,
192.168.88.197:8100, RON: 1, WON: 1, IOCount:1, IOC:0xd5e5a0
[2016-10-25 09:54:40] DEBUG channelpool.cpp:57 [140137745778528] 分配的Channel总数:25
(48)
[2016-10-25 09:54:40] INFO tfs_session.cpp:812 [140137745778528] get cluster id from
nameserver success. cluster id: 1
[2016-10-25 09:54:40] INFO tfs_client_impl.cpp:584 [140137745778528] set cache time:
1800
[2016-10-25 09:54:40] INFO tfs_client_impl.cpp:565 [140137745778528] set cache items:
1000
TFS > help
supported command:
aci dsip:port [startrow returnrow] get dataserver access information, such as write
or read times
addblk blockid add block
batch file batch run command in file
clearsystemtable clear system table 1--task, 2--write block, 4--
report block server, 8--delete block queue.
compactblk blockid compact block
dumpplan [nsip:port] dump plan server
exit exit
getbpr get balance percent ratio, float value, ex:
1.000000 or 0.000005
help show help info
listblk blockid list block server list
loadblk blockid dsip:port build relationship between block and dataserver.
param name [set value [extravalue]] set/get param value
quit quit
removeblk blockid [serverip:port|flag] remove block. flag: 1--remove block from both ds
and ns, 2--just relieve relation from ns, default is 1.
replblk blockid type [[action] [src] [dest]] replicate block. type: 1--action, 2--src, 3
--dest, 4--action src, 5--action dest, 6--src dest, 7--action src dest
rotatelog rotate log file. it will move nameserver.log to
nameserver.log.currenttime, and create new nameserver.log
setacl dsip:port type [v1 [v2]] set dataserver access control. it can reject the
request of certain ip or network segmenttype: 1--ACL_FLAG, 2--ACL_IPMASK, 3--ACL_IPLIST,
4--ACL_CLEAR, 5--ACL_RELOAD
setbpr value1 value2 set balance percent ratio. value1: integer part,
0 or 1, value2 should be 0 if value1 is 1. value2: float part.
TFS > listblk 1010 #查看blcok在那些服务器那些磁盘上
[2016-10-25 09:54:57] DEBUG base_packet_factory.cpp:48 [140137745778528] pcode: 2,
length: 12
list block 1010 success.
------block: 1010, has 2 replicas------
block: 1010, (0)th server: 192.168.88.185:8202
block: 1010, (1)th server: 192.168.88.184:8246
TFS >