分布式文件系统fastDFS部署
admin
2023-03-25 18:41:33
0次

一、部署环境:(CentOS 6.9)

    tracker server:10.10.1.105

    storage server:10.10.1.106  10.10.1.107

    client:10.10.1.105


二、FastDFS: 开源的轻量级分布式文件系统;

    三个角色:

    tracker server :跟踪服务器,调度,在内存中记录所有存储组和存储服务器的状态信息; tracker.conf

    storage server :存储服务器,文件(data)和文件属性(metadata),一组服务器; storage.conf

    client :客户端,业务请求发起方,通过专用接口基于TCP协议与tracker以及storage server进行交互;client.conf

    

    存储:

    group_name/M##/&&/&&/file_name

    group_name :存储组的组名;上传完成后,需要客户端自行保存;

    M## :服务器配置的虚拟路径,与磁盘选项store_path#对应;

    两级以两位16进制数字名字的目录;

    文件名:与原文件名并不相同;由storage server根据特定信息生成,文件名包含:源存储服务器的IP地址、文件创建时间戳、文件大小、随机数和文件扩展名等;


三、安装

    1、安装依赖包libfastcommon

    2、安装fastDFS

    3、需要关闭iptables、selinux

    安装方式一:

    # git clone https://github.com/happyfish200/fastdfs.git

    # git clone https://github.com/happyfish200/libfastcommon.git

    # git clone https://github.com/happyfish200/fastdfs-nginx-module.git

    

    mv libfastcommon libfastcommon-1.0.36

    tar zcf libfastcommon-1.0.36.tar.gz libfastcommon-1.0.36

     

    mv fastdfs fastdfs-5.0.10

    tar zcf fastdfs-5.0.10.tar.gz fastdfs-5.0.10

    

    mkdir rpmbuild/{SOURCES,SPECS} -pv

    cp /tools/libfastcommon-1.0.36.tar.gz rpmbuild/SOURCES/

    cp /tools/fastdfs-5.0.10.tar.gz rpmbuild/SOURCES/

    

    cp /tools/libfastcommon-1.0.36/libfastcommon.spec rpmbuild/SPECS/

    cp /tools/fastdfs-5.0.10/fastdfs.spec rpmbuild/SPECS/

    

    yum install rpm-build

    rpmbuild -ba libfastcommon.spec 

    rpmbuild -ba fastdfs.spec 

    生成rpm包直接安装即可

    安装方式二:

    tar xzf libfastcommon_v1.23.tar.gz

    cd libfastcommon

    ./make.sh

    ./make.sh install

    

    tar xzf FastDFS_v5.08.tar.gz

    cd FastDFS

    ./make.sh

    ./make.sh install

    

    tracker和storage配置完成后测试上传:

    

    # fdfs_upload_file ./client.conf /usr/share/backgrounds/centos_2048x1536_logoonly.jpg

    group1/M00/00/00/CgoBalkG2PmAThTWAAD_7aV8rDY985.jpg

    

四、安装fastdfs-nginx-module模块,通过http协议访问文件

    注:以下两个文件需要复制到storage的目录

    cp fastdfs-5.0.10/conf/{http.conf,mime.types}   /etc/fdfs/

    

    安装此模块需要重新编译nginx

    1、./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module  --with-http_gzip_static_module --with-http_sub_module --add-module=/root/soft/fastdfs-nginx-module/src

    

    2、nginx.conf 文件加入以下配置

            location ~ /group[0-9]+/M00 {

                root /home/fastdfs/data;

                ngx_fastdfs_module;

            }

    3、ln -s /home/fastdfs/data  /home/fastdfs/data/M00

    

    4、配置mod_fastdfs.conf文件

    cp /root/soft/fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs/

    

    mod_fastdfs.conf重点配置项:

    tracker_server=10.10.1.105:22122

    url_have_group_name = true   ***开启组名访问

    

    group_count = 1

    [group1]

    group_name=group1

    storage_server_port=23000

    store_path_count=1

    store_path0=/home/fastdfs

    

    5、重载nginx服务器

    

    以组名访问时:

            location ~ /group[0-9]+/M00 {

                root /home/fastdfs/data;

                ngx_fastdfs_module;

            }

    https://cache.yisu.com/upload/information/20200309/32/49826.jpg

    

相关内容

热门资讯

空调连续工作多久需要停机休息 空调连续工作的时间取决于多个因素,包括空调的型号、功率、使用环境和维护情况等。一般来说,空调可以连续...
空调哪个符号是除湿的 空调除湿功能通常用一个水滴形状的符号表示。不同品牌和型号的空调遥控器可能会有所差异,但一般来说,除湿...
格力空调多长时间加一次氟利昂 1、一般情况下,空调对氟利昂的使用量是非常小的,所以在空调使用了四年左右的时候再考虑加也没问题。2、...
空调用多长时间需要加氟一次 一般情况下是五年。当出现以下这几种情况时,空调才需要加氟。1、空调的室内机和室外机各有两个接口,当接...
格调生活·C标思享荟:卡萨帝在... 9月12日的郑州龙湖金融岛,夜风轻拂,灯光璀璨。“C标时刻共传奇——卡萨帝思享荟暨20周年品牌盛典郑...
品牌价值破千亿、高端份额持续领... 9月12日,“C标时刻共传奇——卡萨帝思享荟暨20周年品牌盛典郑州站”在郑州龙湖金融岛举办。2026...
空调主板坏了修800还是换新的 空调主板坏了是修还是换新,需要考虑多个因素,以下是一些建议:1. 维修成本:如果维修费用较低,比如 ...
空调开多久需要休息多长时间 问题:空调开多久需要休息多长时间回答:1、在使用空调的过程中,一般空调开7~8个小时左右需要休息2~...
中央空调多长时间清洗一次 1、一般空调开机前清洗一次即可,空调开机中间时段再清洗一次,空调关机时清洗一次,这样比较合理。2、空...
中央空调氟利昂多久加一次 看空调制热和制冷程度,很多人的观点认为氟利昂必须一年放一次,其实这个观点是错误的,理解上面有点偏差,...