通过之前的努力,已经搭建好了一套基本的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=1073741824
log_num = 16
log_level=info
task_max_queue_size = 10240
port = 9998
work_dir=/usr/local/tfs
dev_name= eth0
thread_count = 4
ip_addr = 192.168.1.228
[dataserver]
ip_addr = 192.168.1.225
ip_addr_list = 192.168.1.225|192.168.1.226
port = 8108
heart_interval = 2
check_interval = 2
replicate_threadcount = 2
block_max_size = 7549747
dump_visit_stat_interval = 60
backup_type = 1
backup_path = /data/tfs
mount_name = /tfs/data
mount_maxsize = 20971520
base_filesystem_type = 1
superblock_reserve = 0
avg_file_size = 40960
mainblock_size = 7549747
extblock_size = 419430
block_ratio = 0.5
hash_slot_ratio = 0.5
ds_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 = 2
min_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:8108
show > 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:8108
TFS> put /etc/passwd
|
1
|
TFS> put /etc/shadow
|
本文转自斩月博客51CTO博客,原文链接http://blog.51cto.com/ylw6006/1558916如需转载请自行联系原作者
ylw6006