【Linux】fastDFS 设置多个存储组

在 FastDFS 中配置多个存储组时,需要在每个存储组中配置相应的存储路径。以下是配置 FastDFS Storage 的步骤:

storage 配置修改
  1. 打开 storage.conf 配置文件,通常位于 /etc/fdfs 目录下;
  2. 给每个group创建不同的storage_*.conf文件;
    cd /etc/fdfs
    cp storage.conf.sample storage_*.conf
    vim storage_*.conf

  3. 为每个存储组配置其他参数;
    设置不同的groupName,port 
    # and storage_ids.conf must be configured correctly.
    group_name = CheckPoint
    
    # the storage server port
    port = 23000
    
    # the base path to store data and log files
    base_path=/data/fastdfs/check_point
     
    # store_path#, based 0, if store_path0 not exists, it's value is base_path
    # the paths must be exist
    store_path0=/data/fastdfs/check_point
     
    
    # store_path (disk), value can be 1 to 256, default value is 256
    # 自动生成的子路径数量,默认 256
    subdir_count_per_path = 1
    
    # tracker_server can ocur more than once, and tracker_server format is
    #  "host:port", host can be hostname or ip address
    #配置tracker跟踪器ip端口
    tracker_server=172.16.111.152:22122

  4.  创建目录,命令:
    mkdir -p /data/fastdfs/check_point
    mkdir -p /data/fastdfs/lora
    mkdir -p /data/fastdfs/vae
    mkdir -p /data/fastdfs/embedding

  5. 防火墙中打开存储器端口
    # 查看防火墙状态
    sudo ufw status
     
    # 添加开放SSH端口
    sudo ufw allow 23000
    sudo ufw allow 23001 
    sudo ufw allow 23002 
    sudo ufw allow 23003 
    
    # 开启完成,需要重启防火墙生效
    sudo ufw reload      //重启ufw防火墙
     


    在CentOS系统中:
    # 添加开放SSH端口
    sudo firewall-cmd --zone=public --add-port=23001/tcp --permanent
    sudo firewall-cmd --zone=public --add-port=23002/tcp --permanent
    sudo firewall-cmd --zone=public --add-port=23003/tcp --permanent
    sudo firewall-cmd --zone=public --add-port=23004/tcp --permanent
    
    
    
    # 查看开放端口
    sudo iptables -L -n
    
    # 重启防火墙
    sudo systemctl restart firewalld
    
    

  6. 启动 Storage 

nginx 配置修改 
  1. nginx.conf 修改
    cd /usr/local/nginx/conf
    
    sudo vim nginx.conf

  2.  mod_fastdfs.conf 修改
    对应storage_*.conf修改
    cd /etc/fdfs
    
    sudo vim mod_fastdfs.conf
    
    # 第一个存储组 - CheckPoint
    # [CheckPoint]
    group_name=CheckPoint
    storage_server_port=23000
    store_path_count=1
    store_path0=/data/fastdfs/check_point
    
    # 第二个存储组 - Lora
    # [Lora]
    group_name=Lora
    storage_server_port=23001
    store_path_count=1
    store_path0=/data/fastdfs/lora
    
    # 第三个存储组 - VAE
    # [VAE]
    group_name=VAE
    storage_server_port=23002
    store_path_count=1
    store_path0=/data/fastdfs/vae
    
    # 第四个存储组 - Embedding
    # [Embedding]
    group_name=Embedding
    storage_server_port=23003
    store_path_count=1
    store_path0=/data/fastdfs/embedding

  • 22
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
以下是Linux FastDFS安装与配置的步骤: 1.下载FastDFS安装包并解压缩: ```shell wget https://github.com/happyfish100/fastdfs/archive/V5.11.tar.gz tar -zxvf V5.11.tar.gz ``` 2.安装libfastcommon: ```shell cd fastdfs-5.11/libfastcommon/ ./make.sh ./make.sh install ``` 3.安装FastDFS: ```shell cd ../fastdfs/ ./make.sh ./make.sh install ``` 4.配置Tracker服务器: ```shell cp /etc/fdfs/tracker.conf.sample /etc/fdfs/tracker.conf vi /etc/fdfs/tracker.conf ``` 在tracker.conf中修改base_path和http.server_port参数,例如: ``` base_path=/data/fastdfs/tracker http.server_port=8080 ``` 5.配置Storage服务器: ```shell cp /etc/fdfs/storage.conf.sample /etc/fdfs/storage.conf vi /etc/fdfs/storage.conf ``` 在storage.conf中修改base_path、store_path0、tracker_server参数,例如: ``` base_path=/data/fastdfs/storage store_path0=/data/fastdfs/storage tracker_server=192.168.36.100:22122 tracker_server=192.168.36.103:22122 ``` 6.配置客户端: ```shell cp /etc/fdfs/client.conf.sample /etc/fdfs/client.conf vi /etc/fdfs/client.conf ``` 在client.conf中修改base_path和tracker_server参数,例如: ``` base_path=/data/fastdfs/client tracker_server=192.168.36.100:22122 tracker_server=192.168.36.103:22122 ``` 7.配置Nginx: ```shell cp /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf.bak vi /usr/local/nginx/conf/nginx.conf ``` 在http节点下添加如下配置: ``` location /group1/M00 { root /data/fastdfs/storage/data; ngx_fastdfs_module; } ``` 8.启动Tracker和Storage服务器: ```shell /etc/init.d/fdfs_trackerd start /etc/init.d/fdfs_storaged start ``` 9.测试FastDFS: ```shell echo "Hello, FastDFS!" > test.txt /usr/bin/fdfs_upload_file /etc/fdfs/client.conf test.txt ``` 以上是Linux FastDFS安装与配置的步骤。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值