FastDFS中Tracker server主要是负载均衡和调度,Storage server主要是文件存储。
1.1 系统环境
[root@ centos fastdfs]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core) 1.2 软件包(需要包的话可以在评论区留言)
FastDFS v5.05
libfastcommon v1.0.7
fastdfs-nginx-module v1.16
nginx v1.12.1 1.3 安装依赖
yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel 1.4 安装libfastcommon
tar zxvf libfastcommonV1.0.7.tar.gz
cd libfastcommon-1.0.7/
./make.sh
./make.sh install 1.5 安装FastDFS
tar zxvf FastDFS_v5.05.tar.gz
cd FastDFS/
./make.sh
./make.sh install
cp -r conf/* /etc/fdfs/ 1.5.1 配置tracker
cd /etc/fdfs
mkdir -p /data/fastdfs
vi tracker.conf
修改
base_path=/data/fastdfs
http.server_port=80
启动tracker
/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf start
建立软链
ln -s /usr/bin/fdfs_trackerd /usr/local/bin
ln -s /usr/bin/stop.sh /usr/local/bin
ln -s /usr/bin/restart.sh /usr/local/bin 1.5.2 配置 Storage 服务
mkdir -p /data/fastdfs/storage
vim storage.conf
修改
base_path=/data/fastdfs/storage
store_path0=/data/fastdfs/storage
tracker_server=本机IP:22122 ln -s /usr/bin/fdfs_storaged /usr/local/bin
service fdfs_storaged start 1.5.3 重启服务
service fdfs_trackerd restart
service fdfs_storaged restart
netstat -unltp|grep fdfs 1.5.4 监控tracker与storage的通信
/usr/bin/fdfs_monitor /etc/fdfs/storage.conf
ip_addr = ip(hm) ACTIVE 1.5.5 配置client.conf
vim client.conf
base_path=/data/fastdfs/storage
tracker_server=本机IP:22122 1.5.6 上传文件测试
/usr/bin/fdfs_upload_file /etc/fdfs/client.conf /root/2.txt
1.5.7 文件存储位置
/data/fastdfs/storage/data/00/00 1.6 安装nginx与fastdfs-nginx-module
tar zxvf fastdfs-nginx-module_v1.16.tar.gz
tar -zxvf nginx-1.12.1.tar.gz
cd nginx
./configure --prefix=/usr/local/nginx --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --with-ipv6 --with-http_sub_module --with-openssl=/usr/local/src/lnmp1.4-full/src/openssl-1.0.2l --add-module=/root/fastdfs/fastdfs-nginx-module/src 1.6.1 查看安装的模块
/usr/local/nginx/sbin/nginx -V cd /解压目录/fastdfs-nginx-module-1.17/src/
vim mod_fastdfs.conf
修改
tracker_server=192.168.198.129:22122
url_have_group_name = true
store_path0=/data/fastdfs/storage
cp mod_fastdfs.conf /etc/fdfs 1.6.2 配置文件
vim nginx.conf
user www www;
include /usr/local/nginx/conf.d/*.conf; fastdfs.conf
server {
listen 80;
server_name 域名/IP;
rewrite ^(.*) https://$server_name$1 permanent;
}
server {
listen 443;
server_name 域名/IP;
ssl on;
ssl_certificate /usr/local/nginx/conf/vhost/Nginx/server.crt;
ssl_certificate_key /usr/local/nginx/conf/vhost/Nginx/server.key;
access_log /usr/local/nginx/logs/acc_fastdfs.log;
error_log /usr/local/nginx/logs/err_fastdfs.log;
location / {
root html;
index index.html index.htm;
} location ~/group([0-9])/M00 { root /data/fastdfs/storage/;
ngx_fastdfs_module;
} error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
} 1.6.3 重启nginx(不用reload,不生效)
/usr/local/nginx/sbin/nginx -s stop
/usr/local/nginx/sbin/nginx 设置开机自启(/etc/rc.local)
/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart
/usr/bin/fdfs_storaged /etc/fdfs/storage.conf restart
/usr/local/nginx/sbin/nginx 1.7 问题
1.7.1 问题1
nginx fastdfs 配置后 上传成功 但访问报404 bad request 两种解决方法
方法一:修改nginx.conf配置文件加上一行 user www
chown -R www:www /data/fastdfs/storage 方法二:配置 /etc/fdfs/mod_fastdfs.conf
url_have_group_name = false 改为true(使用组名访问) 两种方法最后都要 执行 /usr/local/nginx/sbin/nginx -s reload 重新加载配置文件生效,最后就可以访问了
注意 如果两者都用了还没效果后 就很可能是防火墙没关闭
关闭防火墙:
service firewalld stop 停止防火墙
service firewalld disable 永久停止
selinux: getenforce 1.7.2 问题2
fastdfs升级为https加密存取
server {
listen 80;
server_name 域名/IP;
rewrite ^(.*) https://$server_name$1 permanent;
}
server {
listen 443;
server_name 域名/IP;
ssl on;
ssl_certificate /usr/local/nginx/conf/vhost/Nginx/server.crt;
ssl_certificate_key /usr/local/nginx/conf/vhost/Nginx/server.key;
access_log /usr/local/nginx/logs/acc_fastdfs.log;
error_log /usr/local/nginx/logs/err_fastdfs.log;
location / {
root html;
index index.html index.htm;
} location ~/group([0-9])/M00 { root /data/fastdfs/storage/;
ngx_fastdfs_module;
} error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
} 附加:
# grep http |grep server_port tracker.conf
http.server_port=443
# grep http |grep server_port storage.conf
http.server_port=443
# grep http |grep server_port client.conf
http.tracker_server_port=443 1.7.3 问题3
root/fastdfs-nginx-module/src//common.c:21:25: fatal error: fdfs_define.h: No such file or directory
#include "fdfs_define.h"
cp /usr/lib64/libfdfsclient.so /usr/lib/
vim /usr/local/src/fastdfs-nginx-module/src/config
CORE_INCS="$CORE_INCS /usr/include/fastdfs /usr/include/fastcommon/"
CORE_LIBS="$CORE_LIBS -L/usr/lib -lfastcommon -lfdfsclient"
(把CORE_INCS和CORE_LIBS的所有路径都修改为/usr/include和/usr/lib)

Centos系统FastDFS搭建与排错的更多相关文章

  1. CentOS系统下搭建tomcat服务器

    下载相应的linux版jdk和tomcat,本文讲解jdk版本jdk-7u79-linux-x64.tar.gz,tomcat版本apache-tomcat-7.0.69.tar.gz [配置jdk] ...

  2. Linux(Centos)系统上搭建SVN以及常见错误解答

    本文主要介绍怎样在Centos上搭建SVN,文章内容比较基础,适合小白用户学习. 1.Linux版本Centos 6.5 查看linux版本命令: cat /etc/issue 2.查看本机上是否已经 ...

  3. Linux(CentOS)系统下搭建svn服务器

    由于GitHub的私有项目需要收费,gitlab对服务器的要求必须是4GB内存以上.对于一些个人的小型项目,想要免费的版本控制工具来管理自己的代码,又不想代码公开,无疑SVN是比较好的选择.windo ...

  4. Net分布式系统之二:CentOS系统搭建Nginx负载均衡

    一.关于CentOS系统介绍 CentOS(Community Enterprise Operating System,中文意思是:社区企业操作系统)是Linux发行版之一,它是来自于Red Hat ...

  5. 基于CentOS与VmwareStation10搭建Oracle11G RAC 64集群环境:4.安装Oracle RAC FAQ-4.1.系统界面报错Gnome

    1.错误信息:登录系统后,屏幕弹出几个错误对话框,无菜单.无按钮 GConf error: Failed to contact configuration server; some possible ...

  6. hadoop-2.6.0.tar.gz + spark-1.6.1-bin-hadoop2.6.tgz的集群搭建(单节点)(CentOS系统)

    福利 => 每天都推送 欢迎大家,关注微信扫码并加入我的4个微信公众号:   大数据躺过的坑      Java从入门到架构师      人工智能躺过的坑         Java全栈大联盟   ...

  7. CentOS 系统下Gitlab搭建与基本配置 以及代码备份迁移过程

    GitLab 是一个开源的版本管理系统,提供了类似于 GitHub 的源代码浏览,管理缺陷和注释等功能,你可以将代码免费托管到 GitLab.com,而且不限项目数量和成员数.最吸引人的一点是,可以在 ...

  8. [转帖]使用fastdfs搭建文件管理系统

    使用fastdfs搭建文件管理系统 https://www.jianshu.com/p/4e80069c84d3 今天同事说他们的系统用到了这个分布式文件管理系统. 一.FastDFS介绍 FastD ...

  9. FastDFS搭建单机图片服务器(二)

    防丢失转载:https://blog.csdn.net/MissEel/article/details/80856194 根据 分布式文件系统 - FastDFS 在 CentOS 下配置安装部署 和 ...

随机推荐

  1. pytorch错误:Missing key(s) in state_dict、Unexpected key(s) in state_dict解决

    版权声明:本文为博主原创文章,欢迎转载,并请注明出处.联系方式:460356155@qq.com 在模型训练时加上: model = nn.DataParallel(model)cudnn.bench ...

  2. hashChange & url change & QRCode & canvas to image

    hashChange & url change & QRCode & canvas to image "use strict"; /** * * @auth ...

  3. element 给table的个别表格框添加样式 ---重构里面的组件

    <el-table ref="singleTable" :show-header='false' :data="tableData" align='cen ...

  4. sql中检查时间是否重叠

    先画一个时间轴,方便理解. 设新的时间块,开始时间为@BeginDate,结束时间为@EndDate.数据库中的数据为BeginDate和EndDate 这样可以直观的看出来,新的时间块插入进来,只需 ...

  5. hdu-1711(hash)

    题意:给你T组数据,每组数据分别输入n,m和长度为n的数字数组,和长度为m的数字数组,问你长度为m的数组第一次出现在长度为n的数组的位置 解题思路:标准字符串匹配问题,一般用kmp解,拿来练hash ...

  6. layui table默认选中指定行

    表格默认选中行,在回调里写入 done: function (res, curr, count) { tableData = res.data; $("[data-field='id']&q ...

  7. nginx 提示the "ssl" directive is deprecated, use the "listen ... ssl" directive instead

    该问题是由于新版nginx采用新的方式进行监听https请求了 解决方式 在listen中改为 listen 443 ssl; 删除ssl配置 # ssl on; 完美解决: 解决完成前后的配置如下 ...

  8. Python机器学习第一章

    1. 机器学习 (Machine Learning, ML)            1.1 概念:多领域交叉学科,涉及概率论.统计学.逼近论.凸分析.算法复杂度理论等多门学科.专门研究计算机怎样模拟或 ...

  9. python_类与对象学习笔记

    class Phone: #手机属性===>类属性 # color='black' # price=4500 # brand='oppo' # size='5.5' #参数化-魔法方法--初始化 ...

  10. k8s常用命令演示

    kubectl run --image=xxx name_xx --port kubectl run --image=nginx nginx-app --port=80 kubectl expose ...