FastDFS增加存储路径配置

FastDFS在使用过程中最近碰到一种情况,存储被占满了,随即增加外挂存储映射到FastDFS所在服务器上,以下是新挂存储后FastDFS需要做的一些修改配置:

1.修改tracker.conf配置文件

# vim /etc/fdfs/tracker.conf
将 store_path=0 修改为 store_path=2
意思是从轮询的方式改为存储负载均衡的方式(选择剩余空间最大的目录存放文件)

2.修改storage.conf配置文件

# vim /etc/fdfs/storage.conf
将 store_path_count=1 改为 store_path_count=2
增加:store_path1=/fdfs/storage1

3.修改mod_fastdfs.conf配置文件

# vim /etc/fdfs/mod_fastdfs.conf
将 store_path_count=1 改为 store_path_count=2

在 store_path0=/opt/netstore/fdfs 下面增加一行store_path1=/opt/netstore1/fdfs

配置文件的最下面,[group1]下面
store_path_count=1改为store_path_count=2

在 store_path0=/opt/netstore/fdfs 下面增加一行store_path1=/opt/netstore1/fdfs

建立软连接:ln -s /opt/netstore1/fdfs/storage/data /opt/netstore1/fdfs/storage/data/M01

查看:ll /opt/netstore1/fdfs/storage/data/M01

4.修改nginx.conf配置文件

# vim /usr/local/nginx/conf/nginx.conf
# 在server中增加:

	location ~/group1/M01    {
        root /opt/netstore1/fdfs;
        ngx_fastdfs_module;
    }
        
	#设置group1的第二个路径的负载均衡参数
    location /group1/M01 {
        proxy_next_upstream http_502 http_504 error timeout invalid_header;
        proxy_cache http-cache;
        proxy_cache_valid  200 304 12h;
        proxy_cache_key $uri$is_args$args;
        proxy_pass http://fdfs_group1;
        expires 30d;
    }
    
    #设置group2的第二个路径的负载均衡参数
    location /group2/M01 {
        proxy_next_upstream http_502 http_504 error timeout invalid_header;
        proxy_cache http-cache;
        proxy_cache_valid  200 304 12h;
        proxy_cache_key $uri$is_args$args;
        proxy_pass http://fdfs_group2;
       expires 30d;
    }

5.重启tracker:

/usr/local/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart

6.重启storage:

/usr/local/bin/fdfs_storaged /etc/fdfs/storage.conf restart

7.查看storage状态,有两个ACTIVE则为正常:

/usr/local/bin/fdfs_monitor /etc/fdfs/storage.conf

8.重启nginx:

# /usr/local/nginx/sbin/nginx -s reload
  • 1
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值