也可以参考 tracker配置
首先是 tracker.conf
#-is this config file disabled
#-false for enabled
#-true for disabled
disabled=false
#-这个配置文件是否不生效,呵呵(改成是否生效是不是会让人感觉好点呢?) false 为生效(否则不生效) true反之
#-bind an address of this host
#-empty for bind all addresses of this host
bind_addr=
#-是否绑定IP,
#-bind_addr= 后面为绑定的IP地址 (常用于服务器有多个IP但只希望一个IP提供服务)。如果不填则表示所有的(一般不填就OK),相信较熟练的SA都常用到类似功能,很多系统和应用都有
#-the tracker server port
port=22122
#-提供服务的端口,不作过多解释了
#-connect timeout in seconds
#-default value is 30s
connect_timeout=30
#连接超时时间,针对socket套接字函数connect
#-network timeout in seconds
network_timeout=60
#- tracker server的网络超时,单位为秒。发送或接收数据时,如果在超时时间后还不能发送或接收数据,则本次网络通信失败。
#-the base path to store data and log files
base_path=/home/yuqing/fastdfs
#-base_path 目录地址(根目录必须存在,子目录会自动创建)
#-附目录说明:
tracker server目录及文件结构:
${base_path}
|__data
| |__storage_groups.dat:存储分组信息
| |__storage_servers.dat:存储服务器列表
|__logs
|__trackerd.log:tracker server日志文件
数据文件storage_groups.dat和storage_servers.dat中的记录之间以换行符(\n)分隔,字段之间以西文逗号(,)分隔。
storage_groups.dat中的字段依次为:
- group_name:组名
- storage_port:storage server端口号
storage_servers.dat中记录storage server相关信息,字段依次为:
- group_name:所属组名
- ip_addr:ip地址
- status:状态
- sync_src_ip_addr:向该storage server同步已有数据文件的源服务器
- sync_until_timestamp:同步已有数据文件的截至时间(UNIX时间戳)
- stat.total_upload_count:上传文件次数
- stat.success_upload_count:成功上传文件次数
- stat.total_set_meta_count:更改meta data次数
- stat.success_set_meta_count:成功更改meta data次数
- stat.total_delete_count:删除文件次数
- stat.success_delete_count:成功删除文件次数
- stat.total_download_count:下载文件次数
- stat.success_download_count:成功下载文件次数
- stat.total_get_meta_count:获取meta data次数
- stat.success_get_meta_count:成功获取meta data次数
- stat.last_source_update:最近一次源头更新时间(更新操作来自客户端)
- stat.last_sync_update:最近一次同步更新时间(更新操作来自其他storage server的同步)
#-max concurrent connections this server supported
#-max_connections worker threads start when this service startup
max_connections=256
#-系统提供服务时的最大连接数。对于V1.x,因一个连接由一个线程服务,也就是工作线程数。
#-对于V2.x,最大连接数和工作线程数没有任何关系
#-work thread count, should <= max_connections
#-default value is 4
#-since V2.00
#-V2.0引入的这个参数,工作线程数,通常设置为CPU数
work_threads=4
#-the method of selecting group to upload files
#-0: round robin
#-1: specify group
#-2: load balance, select the max free space group to upload file
store_lookup=2
#-上传组(卷) 的方式 0:轮询方式 1: 指定组 2: 平衡负载(选择最大剩余空间的组(卷)上传)
#-这里如果在应用层指定了上传到一个固定组,那么这个参数被绕过
#-which group to upload file
#-when store_lookup set to 1, must set store_group to the group name
store_group=group2
#-当上一个参数设定为1 时 (store_lookup=1,即指定组名时),必须设置本参数为系统中存在的一个组名。如果选择其他的上传方式,这个参数就没有效了。
#-which storage server to upload file
#-0: round robin (default)
#-1: the first server order by ip address
#-2: the first server order by priority (the minimal)
store_server=0
#-选择哪个storage server 进行上传操作(一个文件被上传后,这个storage server就相当于这个文件的storage server源,会对同组的storage server推送这个文件达到同步效果)
#-0: 轮询方式
#-1: 根据ip 地址进行排序选择第一个服务器(IP地址最小者)
#-2: 根据优先级进行排序(上传优先级由storage server来设置,参数名为upload_priority)
#-which path(means disk or mount point) of the storage server to upload file
#-0: round robin
#-2: load balance, select the max free space path to upload file
store_path=0
#-选择storage server 中的哪个目录进行上传。storage server可以有多个存放文件的base path(可以理解为多个磁盘)。
#-0: 轮流方式,多个目录依次存放文件
#-2: 选择剩余空间最大的目录存放文件(注意:剩余磁盘空间是动态的,因此存储到的目录或磁盘可能也是变化的)
#-which storage server to download file
#-0: round robin (default)
#-1: the source storage server which the current file uploaded to
download_server=0
#-选择哪个 storage server 作为下载服务器
#-0: 轮询方式,可以下载当前文件的任一storage server
#-1: 哪个为源storage server 就用哪一个 (前面说过了这个storage server源 是怎样产生的) 就是之前上传到哪个storage server服务器就是哪个了
#-reserved storage space for system or other applications.
#-if the free(available) space of any stoarge server in
#-a group <= reserved_storage_space,
#-no file can be uploaded to this group.
#-bytes unit can be one of follows:
###-G or g for gigabyte(GB)
###-M or m for megabyte(MB)
###-K or k for kilobyte(KB)
###-no unit for byte(B)
###-XX.XX% as ratio such as reserved_storage_space = 10%
reserved_storage_space = 10%
#-storage server 上保留的空间,保证系统或其他应用需求空间。可以用绝对值或者百分比(V4开始支持百分比方式