通过之前的努力,已经搭建好了一套基本的tfs环境,包括一台nameserver和一台dataserver以及独立的nginx-tfs,而在实际应用中的分布式文件系统,只有一台dataserver明显是不行的,因而本文将介绍tfs环境下添加data server的操作和配置过程。
环境介绍:
Tfs nameserver服务器IP: 192.168.1.225
Tfs dataserver服务器IP: 192.168.1.227
新增tfs dataserver服务器IP:192.168.1.228
Nginx tfs服务器IP:192.168.1.12
一:228服务器上安装tfs软件,修改配置文件
|
1
2
3
4
5
6
7
8
9
10
11
|
227服务器:# cd /usr/local/# tar -zcvpf tfs.tgz tfs/# scp tfs.tgz 192.168.1.228:/usr/local/ 228服务器:# cd /usr/local/# tar -zxvpf tfs.tgz # cd tfs# rm -rf dataserver_*# df -h |grep data |
|
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
|
# grep -v '^#' /usr/local/tfs/conf/ds.conf |grep -v '^$'[public]log_size=1073741824log_num = 16log_level=infotask_max_queue_size = 10240port = 9998 work_dir=/usr/local/tfsdev_name= eth0thread_count = 4ip_addr = 192.168.1.228[dataserver]ip_addr = 192.168.1.225ip_addr_list = 192.168.1.225|192.168.1.226port = 8108 heart_interval = 2check_interval = 2replicate_threadcount = 2block_max_size = 7549747 dump_visit_stat_interval = 60backup_type = 1backup_path = /data/tfsmount_name = /tfs/datamount_maxsize = 20971520 base_filesystem_type = 1superblock_reserve = 0avg_file_size = 40960mainblock_size = 7549747extblock_size = 419430block_ratio = 0.5hash_slot_ratio = 0.5ds_thread_count = 4 |
二:对磁盘进行初始化,启动dataserver服务
|
1
2
3
|
# cd /usr/local/tfs/scripts/# sh stfs format 1-3# df -h |grep data |
|
1
2
3
4
5
|
# sh tfs start_ds 1-3 dataserver 1 is up SUCCESSFULLY pid: 29264 dataserver 2 is up SUCCESSFULLY pid: 29290 dataserver 3 is up SUCCESSFULLY pid: 29309 # netstat -ntpl |grep data |
三: 查看添加是否成功,修改nameserver replicate为2
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
Name server服务器# grep 'replication' /usr/local/tfs/conf/ns.conf max_replication = 2min_replication = 2 # /usr/local/tfs/scripts/tfs stop_ns nameserver exit SUCCESSFULLY # /usr/local/tfs/scripts/tfs start_ns nameserver is up SUCCESSFULLY pid: 12037 # /usr/local/tfs/bin/ssm -s 192.168.1.225:8108show > machine -a |
# /usr/local/tfs/bin/ssm -s 192.168.1.225:8108 -i show server
# tail -f /usr/local/tfs/logs/nameserver.log
四:上传,读取测试,可以看到shadow文件存储到了228上
|
1
2
|
# /usr/local/tfs/bin/tfstool -s 192.168.1.225:8108TFS> put /etc/passwd |
|
1
|
TFS> put /etc/shadow |
本文出自 “斩月” 博客,谢绝转载!









