經過以前的努力,已經搭建好了一套基本的tfs環境,包括一臺nameserver和一臺dataserver以及獨立的nginx-tfs,而在實際應用中的分佈式文件系統,只有一臺dataserver明顯是不行的,於是本文將介紹tfs環境下添加data server的操做和配置過程。nginx
環境介紹:服務器
Tfs nameserver服務器IP: 192.168.1.225分佈式
Tfs dataserver服務器IP: 192.168.1.227ide
新增tfs dataserver服務器IP:192.168.1.228測試
Nginx tfs服務器IP:192.168.1.12 spa
一:228服務器上安裝tfs軟件,修改配置文件3d
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
# 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服務orm
# cd /usr/local/tfs/scripts/ # sh stfs format 1-3 # df -h |grep data
# 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爲2server
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 serverxml
# tail -f /usr/local/tfs/logs/nameserver.log
四:上傳,讀取測試,能夠看到shadow文件存儲到了228上
# /usr/local/tfs/bin/tfstool -s 192.168.1.225:8108 TFS> put /etc/passwd
TFS> put /etc/shadow