小白网-奉贤部落-奉贤免费信息发布平台

查看: 29|回复: 0
打印 上一主题 下一主题

centos7安装fastdfs集群nginx118生产环境

[复制链接]

2万

主题

2万

帖子

7万

积分

论坛元老

Rank: 8Rank: 8

积分
78182
跳转到指定楼层
楼主
发表于 2025-7-26 13:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
一.服务器信息
1.主机:服务器1-2、10.10.10.11、10.10.10.12
2.数据:/data1
二。部署服务
1.部署依赖于通用组件
yum install-y gcc gcc-c++ perl pcre pcre-devel zlib zlib-devel OpenSSL OpenSSL-devel libnl libnl-devel
下载相关源代码并编译和安装。
wget-O libfast common-master . zip https://code load . github . com/happy fish 100/libfast common/zip/master解压libfast common-master . zipCD libfast common-master。/make.sh。/make . sh installln-s/usr/lib 64/libfast common . so/usr/lib/libfast common . so
2.部署FastDFS
下载FastDFS源代码并编译和安装它。
wget-O fastdfs-master . zip https://code load . github . com/happy fish 100/fastdfs/zip/master解压fastdfs-master . zipCD fastdfs-master。/make.sh。/make.sh install` '
三。配置FastDFS
1.两个节点配置了跟踪器。
尝试
#创建tracker数据存储目录mkdir/data1/fdfs/tracker-p# IP地址并根据实际情况修改mv/etc/fdfs/tracker . conf . sample/etc/fdfs/tracker . confsed-I . Bind _ addr =/Bind _ addr = 10 . 10 . 10 . 11/g '/etc/fdfs/tracker . conf# modify base _ pathsed-I
2.两个节点配置了存储
#创建存储数据存储目录mkdir/data1/fdfs/storage-pmkdir/data1/fdfs/storage-p# IP地址根据实际修改mv/etc/fdfs/storage . conf . sample/etc/。storage . confsed-I ' s/bind _ addr =/bind _ addr = 10 . 10 . 10 . 11/g '/etc/fdfs/storage . conf#修改base _ path  sed-i快速DFS:base _ path =/data1/fdfs/storage:g '/etc/fdfs/storage . conf#修改文件存储目录sed-I ' s:store _ path 0 =/home/yuqistorage/data:g '/etc/Fdfs/storage . conf#修改跟踪器地址sed-I ' s/tracker _ server = 192 . 168 . 209 . 121:22122/tracker _ server = 10.10 Fdfs/storage . confsed-I '/tracker _ server/a tracker _ server = 10 . 10 . 12:22122 '/etc/Fdfs/storage . conf# If
四。启动服务
fdfs _ trackerd/etc/fdfs/tracker . conf startfdfs _ storaged/etc/fdfs/storage . conf start` ' '
动词 (verb的缩写)测试和验证
1.检查集群状态。
MV/etc/fdfs/client . conf . sample/etc/fdfs/client . confmkdir/data1/fdfs/client-p# modify base _ pathsed-I ' s:base _ path =/home/。DFS:base _ path =/data1/fdfs/client:g '/etc/fdfs/client . conf#修改tracker地址sed-I ' s/Tracker _ server = 192 . 168 . 0 . 197:22122 Tracker _ server = 10 . 10 . 10 . 11:22122/g '/etc/fdfs/client . conf#检查监控信息以及存储状态是否为活动
2.验证上传下载删除光盘
#上传后会返回一个IDFdfs _ upload _ file/etc/Fdfs/client . conf XXX . txtgropu/m00/00/00/CHX S9 L2 g 5 kapqexaaaabk 9 AVC 785 . txt#下载时可以指定下载的文件名,例如:xxx1 . txtFdfs _ download _ file/etc/Fdfs/client . conf group 1/m00/00/CHX S9 L2** -
不及物动词FastDFS和Nginx的集成
1.下载并修改fastdfs-nginx-module
wget-O fastdfs-nginx-module-master . zip https://code load . github . com/happy fish 100/fastdfs-nginx-module/zip/masterunzip fastdfs-nginx-module-master . zipsed-I ' s:/usr/local/include/fastdfs/usr/include/fast common:g ' fastdfs-nginx-module-master/src/config`
2.下载Nginx源码包并编译它
http://nginx.org/download/nginx-1.16.1.tar.gz WGETnginx-1.16.1.tar.gz塔尔xfmkdir/usr/local/nginx。yum zlib pcre pr-devel OpenSSL OpenSSL-develgd-devel-y#编译nginx 。/configure-prefix =/usr/local/nginx-with-http _ realip _ module -with-http _ sub _ module-with-http _ stub _ status _ module -with-http _ image _ filter _ module -with-http _ SSL _ module-add-module =/opt/soft/fast DFS-nginx-module-master/src/make-j
3.配置mod_fastdfs
# copy mod _ fastdfs . confcpfastdfs-nginx-module-master/src/mod _ fastdfs . conf/etc/fdfs/cpfastdfs-master/conf/mime . types/etc/fdfs/cpdfs-master/conf/http . conf/etc/fdfs/# modify mod _ fastdfs . conf配置mkdir/data1/fdfs/mod-p# 需要添加store_path1,2,3,(n-1)并修改store_path_count=n#如果访问的url在上传文件后要在ID中包含组,比如group0/M0/00/xx,URL _ have _ group _ name = truesed-I ' s/URL _ have _ group _ name = false/URL _ have _ group _ name = true/g '/etc/fdfs/mod _ fastdfs . conf#当有多个组时 例:#[group 1]# group _ name = group 1# Store _ server _ port = 23000# Store _ path _ count = 2# Store _ path 0 =/home Store _ path 1 =/home/Yuqing/fastdfs 1` ` `# # 4 .创建nginx配置文件` ` bashcatfdfs . confserver {server _ name localhost;location ~/group([1-9])/M0([0-9])/{ngx _ fastdfs _ module;}}` ' '
5.确认
curl localhost:8888/group 1/M00/00/00/CHX S9 L2 GL 5 kapqexaaaabkv 9 AVC 785 . txt
6.配置域名反向代理到两个节点的nginx模块。
cat file . xxxx . com . conf上游fdfs file {服务器10 . 10 . 10 . 11:8888;服务器10.10.10.12:8888备份;}server {listen 443 SSL;server _ name file.xxxx.com;SSL _ certificate/usr/local/nginx/conf/SSL/xxxx . com . PEM;SSL _ certificate _ key/usr/local/nginx/conf/SSL/xxxx . com . key;SSL _ session _ time out 5m;SSL _ protocols TLS v1 TLS v1.1 TLS v1.2;ssl_ciphers ALL:!DH:!导出:!RC4:+高:+中:!低:!阿努尔:eNULLSSL _ prefere _ server _ ciphers on;location/{valid _ referers * . xxxx . com;if($ invalid _ referer){return 403;}proxy _ pass http://fdfs file;proxy _ redirect off;proxy _ set _ header HOST $ HOST;proxy _ set _ header X-Real-IP $ remote _ addr;proxy _ set _ header X-Forwarded-For $ proxy _ add _ X _ Forwarded _ For;client _ max _ body _ size 100m;client _ body _ buffer _ size 1024k;proxy _ connect _ time out 90;proxy _ send _ time out 90;proxy _ read _ time out 90;proxy _ buffer _ size 32k;proxy _ buffers 4 32k;proxy _ busy _ buffers _ size 64k;proxy _ temp _ file _ write _ size 64k;}error _ page 500 502 503 504/50x . html;location =/50x . html {root html;}}
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|小白网-奉贤部落-奉贤免费信息发布平台  

GMT+8, 2025-8-21 14:29 , Processed in 0.056438 second(s), 21 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表