本文共 2920 字,大约阅读时间需要 9 分钟。
本文介绍了tfs 2.2.16版本在centos linux 6.3 64位系统上单台nameserver和dataserver环境的配置过程。
在Tfs体系架构中把服务器角色分配为nameserver, dataserver, rcs server,meta server等,其中nameserver和data server是核心,nameserver在TFS中类似DNS服务器的作用,客户端通过向nameserver发起请求,查询dataserver的相关信息,然后在dataserver上进行添加,删除,更新等文件操作。更详细的介绍请参考官方文档!http://tfs.taobao.org
环境介绍:
Tfs nameserver: 192.168.1.225/24
Tfs dataserver: 192.168.1.227/24
一:nameserver配置文件, 各项配置参数的具体含义可参考注释或官方文档说明。
[root@localhost ~]# grep -v '^#' /usr/local/tfs/conf/ns.conf |grep -v '^$'[public]log_size=1073741824log_num = 16 log_level=infotask_max_queue_size = 10240port = 8108work_dir=/usr/local/tfsdev_name= eth0thread_count = 4ip_addr = 192.168.1.225[nameserver]safe_mode_time = 300 ip_addr_list = 192.168.1.225|192.168.1.226group_mask = 255.255.255.255block_max_size = 83886080 max_replication = 1min_replication = 1 use_capacity_ratio = 98block_max_use_ratio = 98heart_interval = 2object_dead_max_time = 3600cluster_id = 1replicate_ratio_ = 50max_write_filecount = 16heart_thread_count = 2 heart_max_queue_size = 10repl_max_time = 60compact_delete_ratio = 15 compact_max_load = 200object_dead_max_time = 86400object_clear_max_time = 300max_wait_write_lease = 15lease_expired_time = 3max_lease_timeout = 3000cleanup_lease_threshold = 102400build_plan_interval = 10run_plan_expire_interval = 120build_plan_ratio = 25dump_stat_info_interval = 60000000 build_plan_default_wait_time = 2 balance_max_diff_block_num = 5add_primary_block_count = 3block_chunk_num = 32task_percent_sec_size = 200 task_max_queue_size = 10000oplog_sync_max_slots_num = 1024oplog_sync_thread_num = 1
二:dataserver配置文件,各项配置参数的具体含义可参考注释或官方文档说明。
[root@localhost ~]# 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.227[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
三: 启动nameserver
# /usr/local/tfs/scripts/tfs start_ns nameserver is up SUCCESSFULLY pid: 10609 # netstat -ntpl |grep name
四: 启动dataserver
# cd /usr/local/tfs/scripts/# ./stfs format 1-3 //这里的format 1-3指格式化第一到第三个挂载点# df -h |grep data
# ./tfs start_ds 1-3 dataserver 1 is up SUCCESSFULLY pid: 28821 dataserver 2 is up SUCCESSFULLY pid: 28847 dataserver 3 is up SUCCESSFULLY pid: 28866 # netstat -ntpl |grep data
五:连接测试
# /usr/local/tfs/bin/ssm -s 192.168.1.225:8108 -i show server# /usr/local/tfs/bin/ssm -s 192.168.1.225:8108 -i show machine
六:写入测试,写入后会吐出几个关键的信息,block_id,file_id和file_name
转载地址:http://zeubl.baihongyu.com/