Group 1:
group name = group1
disk total space = 6818 MB
disk free space = 2169 MB
trunk free space = 0 MB
storage server count = 1
active server count = 1
storage server port = 23000
storage HTTP port = 8888
store path count = 1
subdir count per path = 256
current write server index = 0
current trunk file id = 0
Storage 1:
id = 192.168.111.11
ip_addr = 192.168.111.11 ACTIVE
http domain =
version = 5.05
join time = 2016-09-23 11:15:54
up time = 2016-09-23 12:33:26
total storage = 6818 MB
free storage = 2169 MB
upload priority = 10
store_path_count = 1
subdir_count_per_path = 256
storage_port = 23000
storage_http_port = 8888
current_write_path = 0
source storage id =
if_trunk_server = 0
connection.alloc_count = 256
connection.current_count = 0
connection.max_count = 0
total_upload_count = 0
success_upload_count = 0
total_append_count = 0
success_append_count = 0
total_modify_count = 0
success_modify_count = 0
total_truncate_count = 0
success_truncate_count = 0
total_set_meta_count = 0
success_set_meta_count = 0
total_delete_count = 0
success_delete_count = 0
total_download_count = 0
success_download_count = 0
total_get_meta_count = 0
success_get_meta_count = 0
total_create_link_count = 0
success_create_link_count = 0
total_delete_link_count = 0
success_delete_link_count = 0
total_upload_bytes = 0
success_upload_bytes = 0
total_append_bytes = 0
success_append_bytes = 0
total_modify_bytes = 0
success_modify_bytes = 0
stotal_download_bytes = 0
success_download_bytes = 0
total_sync_in_bytes = 0
success_sync_in_bytes = 0
total_sync_out_bytes = 0
success_sync_out_bytes = 0
total_file_open_count = 0
success_file_open_count = 0
total_file_read_count = 0
success_file_read_count = 0
total_file_write_count = 0
success_file_write_count = 0
last_heart_beat_time = 2016-09-23 12:58:59
last_source_update = 1970-01-01 08:00:00
last_sync_update = 1970-01-01 08:00:00
last_synced_timestamp = 1970-01-01 08:00:00
如上所示,看到192.168.111.11 ACTIVE 字样即可说明storage服务器已经成功登记到了tracker服务器,同理别忘了添加开机启动,打开/etc/rc.d/rc.local并将如下配置追加到文件中:
service fdfs_storage start至此我们就已经完成了fastdfs的全部配置,此时也就可以用客户端工具进行文件上传下载的测试了。
初步测试测试时需要设置客户端的配置文件,编辑/etc/fdfs目录下的client.conf 文件,打开文件后依次做以下修改:
base_path=/opt/fastdfs_tracker #tracker服务器文件路径
tracker_server=192.168.111.11:22122 #tracker服务器IP地址和端口号
http.tracker_server_port=6666 # tracker 服务器的 http 端口号,必须和tracker的设置对应起来
配置完成后就可以模拟文件上传了,先给/opt目录下放一张图片(暴雪爸爸的LOGO):
然后通过执行客户端上传命令尝试上传:
/usr/bin/fdfs_upload_file /etc/fdfs/client.conf /opt/BLIZZARD.jpg运行后可以发现给我们返回了一个路径:
这就表示我们的文件已经上传成功了,当文件存储到某个子目录后,即认为该文件存储成功,接下来会为该文件生成一个文件名,文件名由group、存储目录、两级子目录、fileid、文件后缀名(由客户端指定,主要用于区分文件类型)拼接而成,如下图:
同时在之前配置的storage服务器的实际文件存储路径中也可以根据返回的路径找到实际文件:
接下来尝试用浏览器发送HTTP请求访问一下文件: