本文介绍了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配置文件, 各项配置参数的具体含义可参考注释或官方文档说明。
[[email protected] ~]# grep -v ‘^#‘ /usr/local/tfs/conf/ns.conf |grep -v ‘^$‘ [public] log_size=1073741824 log_num = 16 log_level=info task_max_queue_size = 10240 port = 8108 work_dir=/usr/local/tfs dev_name= eth0 thread_count = 4 ip_addr = 192.168.1.225 [nameserver] safe_mode_time = 300 ip_addr_list = 192.168.1.225|192.168.1.226 group_mask = 255.255.255.255 block_max_size = 83886080 max_replication = 1 min_replication = 1 use_capacity_ratio = 98 block_max_use_ratio = 98 heart_interval = 2 object_dead_max_time = 3600 cluster_id = 1 replicate_ratio_ = 50 max_write_filecount = 16 heart_thread_count = 2 heart_max_queue_size = 10 repl_max_time = 60 compact_delete_ratio = 15 compact_max_load = 200 object_dead_max_time = 86400 object_clear_max_time = 300 max_wait_write_lease = 15 lease_expired_time = 3 max_lease_timeout = 3000 cleanup_lease_threshold = 102400 build_plan_interval = 10 run_plan_expire_interval = 120 build_plan_ratio = 25 dump_stat_info_interval = 60000000 build_plan_default_wait_time = 2 balance_max_diff_block_num = 5 add_primary_block_count = 3 block_chunk_num = 32 task_percent_sec_size = 200 task_max_queue_size = 10000 oplog_sync_max_slots_num = 1024 oplog_sync_thread_num = 1
二:dataserver配置文件,各项配置参数的具体含义可参考注释或官方文档说明。
[[email protected] ~]# 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.227 [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
三: 启动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
时间: 2024-10-12 10:12:39