FastDFS的配置、部署与API使用解读(6)FastDFS配置详解之Storage配置

来源:互联网 发布:android 开发mac 教程 编辑:程序博客网 时间:2024/05/16 01:27


1 基本配置

disabled

#func:该配置文件是否生效#valu:## true:无效## false:生效disabled=false

group_name

#func;本storage server所属组名group_name=group1

bind_addr

#func:绑定本storage server的IPbind_addr=

client_bind

#func:bind_addr是针对server的,当指定bind_addr时,本参数才有效。#valu:## true:绑定bind_addr所指定的IP## false:绑定本机的任意IPclient_bind=true

port

#func:storage server端口port=23000

connect_timeout

#func:连接超时connect_timeout=30

network_timeout

#func:网络超时network_timeout=60

heart_beat_interval

#func:本storage向tracker发送心跳时间间隔heart_beat_interval=30

stat_report_interval

#func:硬盘存储空间使用情况检测时间间隔stat_report_interval=60

base_path

#func:base_pathbase_path=/home/michael/fdfs/base4storage

max_connections

#func:本storage server支持的最大并发连接数max_connections=256

buff_size

#func:buff size to recv/send databuff_size=256KB

work_thread

#func:work thread count, should <= max_connections#valu:默认为4#sinc:v2.0work_thread=4

store_path_count / store_path

#func:storage path的个数#valu:默认为1store_path_count=1#func:根据store_path_count的值,如果是N个,就要有store_path0, store_path1 ... store_path(N-1)#valu:store_path0=/home/michael/fdfs/storage0

subdir_count_per_path

#func:FastDFS存储文件时,默认采用了两级目录。这里配置存放文件的目录个数subdir_count_per_path=32

tracker_server

#func:tracker_server 的列表 要写端口号tracker_server=192.168.6.188:22122tracker_server=192.168.6.189:22122tracker_server=192.168.6.190:22122

log_level

#func:log_level=info

run_by_group

#func:run_by_group

run_by_user

#funcrun_by_user

allow_hosts

#func:允许连接的客户端IP列表allow_hosts=*

file_distribute_path_mode

#func:文件分布到data path的方式#valu:## 0:轮询## 1:随机,根据哈希codefile_distribute_path_mode=0

file_distribute_rotate_count

#func:当file_distribute_path_mode设置为0(轮询)时,该值才有效。功能是,当写文件计数打到该值时,转至下一个path。file_distribute_rotate_count=100

thread_stack_size

#func:线程栈大小#valu:要求至少512KBthread_stack_size=512KB

upload_priority

#func:上传优先级。只有tracker.conf中store_server=2时,才有效。#valu:值约小,优先级越高。默认为10.upload_priority=10

if_alias_prefix

#func:#valu:if_alias_prefix=

check_file_duplicate

#func:是否检查file重复。但为1时,使用FastDHT存储文件索引#valu:默认为0## 1, yes, true or on:check## 0, no, false or off:不checkcheck_file_duplicate=0

key_namespace

#func:当上个参数设定为1或yes时(true/on也是可以的),在FastDHT中的命名空间key_namespace=FastDFS

keep_alive

#func:与FastDHT的连接方式#valu:默认为0,短连接## 0:短连接(short connection)## 1:长连接(persistent connection)keep_alive=0

2 IO

disk_rw_separated

#func:是否I/O分离#valu:默认为true## true:分离## false:不分离disk_rw_separated=true

disk_rw_direct

#func:是否直接写,不使用cache#value:## true:直接写## false:不直接写disk_rw_direct=false

disk_reader_threads

#func:每个storage base path的读线程数。对于disk_rw_separated=true的方式该值为0.#valu:默认为1disk_reader_threads=1

disk_writer_threads

#func:每个storage base path的写线程数。对于disk_rw_separated=true的方式该值为0.#valu:默认为1disk_writer_threads=1

3 同步

#func:同步文件时,如果从binlog中没有读到要同步的文件,休眠N毫秒后重新读取。#valu:单位为毫秒。0表示不休眠,立即再次尝试读取。sync_wait_msec=50

sync_interval

#func:同步一个文件后,在下次进行同步前的休息时间#valu:单位为毫秒sync_interval=0

sync_start_time

#func:每天存储同步的开始时间。#valu:HH:mmsync_start_time=00:00

sync_end_time

#func:每天存储同步的结束时间。#valu:HH:mmsync_end_time=23:59

write_mark_file_freq

#func:把storage的mark文件定期同步到磁盘的时间间隔#valu:单位为秒write_mark_file_freq=500

fsync_after_written_bytes

#func:当写大文件时,每写入N个字节,调用一次系统函数fsync将内容强行同步到硬盘。#valu:0表示从不调用fsyncfsync_after_written_bytes=0

sync_log_buff_interval

#func:同步或刷新日志信息到硬盘的时间间隔#valu:单位为秒sync_log_buff_interval=10

sync_binlog_buff_interval

#func:同步binlog(更新操作日志)到硬盘的时间间隔#valu:单位为秒sync_binlog_buff_interval=60

sync_stat_file_interval

#func:把storage的stat文件同步到磁盘的时间间隔#valu:单位为秒sync_stat_file_interval=300

4 HTTP 相关

是否启用 HTTP

#func:是否开启HTTPhttp.disabled

domain

#func:如果将该项留空,则使用IP,否则可以通过tracker来redirect。http.domain_name=

server port

#func:HTTP端口号http.server_port

trunk size

#func:trunk file sizehttp.trunk_size=256KB

否需要从文件扩展名确定文件内容

#func:是否需要从文件扩展名确定文件内容http.need_find_content_type=true