在巡检时发现,fastdfs 容量使用量比较大,原先规划的是1T,经过半年的运行已使用500G左右,并且按照每月100G左右
 的量再增加。
 fastdfs本身是分布式文件系统,扩容的方式有 添加storage磁盘 与 添加 group, 通过综合对比 添加storage磁盘在操作上比
 较方便。
 1、申请在主机上挂载1T磁盘,并做相应的初始化动作,挂载磁盘
 2、修改相关配置
 # 查看新增的磁盘
 fdisk -l
 # 格式化
 mkfs.xfs /dev/sdb
 # 添加自动挂载
 vi /etc/fstab
 # 挂载
 mount -a
2、修改相关配置
 # 查看新增的磁盘
 fdisk -l
 # 格式化
 mkfs.xfs /dev/sdb
 # 添加自动挂载
 vi /etc/fstab
 # 挂载
 mount -a
 /etc/fdfs/tracker.conf Collapse source
vim /etc/fdfs/tracker.conf
 修改其中的 store_path=2 ; 0代表轮询,2代表负载均衡、优先磁盘空闲大的
 # 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=2
 storage配置Collapse source
vim /etc/fdfs/storage.conf
 修改store_path_count=2 ; 代表有2个存储store
 在store_path0 下添加store_path1
 # path(disk or mount point) count, default value is 1
 store_path_count=2
 # store_path#, based 0, if store_path0 not exists, it's value is base_path
 # the paths must be exist
 store_path0=/export/server/fastdfs/storage
 store_path1=/fdfs_store_1
mod Collapse source
vim /etc/fdfs/mod_fastdfs.conf
 添加 store_path_count=2
 在 store_path0 下添加 store_path1
 # store_path#, based 0, if store_path0 not exists, it's value is base_path
 # the paths must be exist
 # must same as storage.conf
 store_path0=/export/server/fastdfs/storage
 store_path1=/fdfs_store_1
 url_have_group_name = true
 #store_path1=/home/yuqing/fastdfs1
 store_path_count=2
3、重启服务
 systemctl restart fdfs_trackerd fdfs_storaged
4、验证服务
 fdfs_monitor /etc/fdfs/storage.conf
 查看total storage 是否增加, store_path_count是否为2
5、验证上传及同步
 fdfs_upload_file /etc/fdfs/client.conf 1.jpg
 查看相应的文件夹内是否存在该文件/fdfs_store_1/data/53/A4/AlIQFmAIGheAKEM0AAAABJUN3iw867.jpg
6、修改nginx配置并验证
 location ~/group1/M0[0-9] {
 ngx_fastdfs_module;
 }