Centos系统FastDFS搭建与排错
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搭建与排错的更多相关文章
- CentOS系统下搭建tomcat服务器
下载相应的linux版jdk和tomcat,本文讲解jdk版本jdk-7u79-linux-x64.tar.gz,tomcat版本apache-tomcat-7.0.69.tar.gz [配置jdk] ...
- Linux(Centos)系统上搭建SVN以及常见错误解答
本文主要介绍怎样在Centos上搭建SVN,文章内容比较基础,适合小白用户学习. 1.Linux版本Centos 6.5 查看linux版本命令: cat /etc/issue 2.查看本机上是否已经 ...
- Linux(CentOS)系统下搭建svn服务器
由于GitHub的私有项目需要收费,gitlab对服务器的要求必须是4GB内存以上.对于一些个人的小型项目,想要免费的版本控制工具来管理自己的代码,又不想代码公开,无疑SVN是比较好的选择.windo ...
- Net分布式系统之二:CentOS系统搭建Nginx负载均衡
一.关于CentOS系统介绍 CentOS(Community Enterprise Operating System,中文意思是:社区企业操作系统)是Linux发行版之一,它是来自于Red Hat ...
- 基于CentOS与VmwareStation10搭建Oracle11G RAC 64集群环境:4.安装Oracle RAC FAQ-4.1.系统界面报错Gnome
1.错误信息:登录系统后,屏幕弹出几个错误对话框,无菜单.无按钮 GConf error: Failed to contact configuration server; some possible ...
- hadoop-2.6.0.tar.gz + spark-1.6.1-bin-hadoop2.6.tgz的集群搭建(单节点)(CentOS系统)
福利 => 每天都推送 欢迎大家,关注微信扫码并加入我的4个微信公众号: 大数据躺过的坑 Java从入门到架构师 人工智能躺过的坑 Java全栈大联盟 ...
- CentOS 系统下Gitlab搭建与基本配置 以及代码备份迁移过程
GitLab 是一个开源的版本管理系统,提供了类似于 GitHub 的源代码浏览,管理缺陷和注释等功能,你可以将代码免费托管到 GitLab.com,而且不限项目数量和成员数.最吸引人的一点是,可以在 ...
- [转帖]使用fastdfs搭建文件管理系统
使用fastdfs搭建文件管理系统 https://www.jianshu.com/p/4e80069c84d3 今天同事说他们的系统用到了这个分布式文件管理系统. 一.FastDFS介绍 FastD ...
- FastDFS搭建单机图片服务器(二)
防丢失转载:https://blog.csdn.net/MissEel/article/details/80856194 根据 分布式文件系统 - FastDFS 在 CentOS 下配置安装部署 和 ...
随机推荐
- JAVA基础知识回顾(面试资料)
关于数据库知识和面试:https://www.cnblogs.com/yanqb/p/9894943.html 关于数据库知识和面试:https://www.cnblogs.com/yanqb/p/1 ...
- 为Spring Cloud Ribbon配置请求重试(Camden.SR2+)
当我们使用Spring Cloud Ribbon实现客户端负载均衡的时候,通常都会利用@LoadBalanced来让RestTemplate具备客户端负载功能,从而实现面向服务名的接口访问. 下面的例 ...
- 如何在django视图中使用asyncio(协程)和ThreadPoolExecutor(多线程)
Django视图函数执行,不在主线程中,直接 loop = asyncio.new_event_loop() # 更不能loop = asyncio.get_event_loop() 会触发 Runt ...
- python监控机器(第1版)
# coding:utf-8 import configparser import logging import os import psutil import ctypes import platf ...
- P5057 [CQOI2006]简单题
题目描述 有一个 n 个元素的数组,每个元素初始均为 0.有 m 条指令,要么让其中一段连续序列数字反转——0 变 1,1 变 0(操作 1),要么询问某个元素的值(操作 2). 例如当 n = 20 ...
- Apache No installed service named "Apache2.4"的解决办法
windows安装Apache后,用cmd开启apache服务时,提示No installed service named "Apache2.4" 解决步骤: 1.cmd窗口,进入 ...
- 使用vue全家桶制作博客网站
前面的话 笔者在做一个完整的博客上线项目,包括前台.后台.后端接口和服务器配置.本文将详细介绍使用vue全家桶制作的博客网站 概述 该项目是基于vue全家桶(vue.vue-router.vuex.v ...
- Ffmpeg使用
ffmpeg官网 刚开始安装的推荐博客|--利用FFmpeg 开发音视频流:一.二.三 1.分辨率码率 主要视频格式与码率: 分辨率 200p——对应的码率是256kpbs,也就是说,一分钟需要流量1 ...
- python中方法的总结
# 1.用函数实现过滤掉集合list1=[' ','hello',None,'python' ]中的空格和空值 # 2.用函数方法实现计算集合list1 = [1,2,3,4,5]中,所有元素的和 c ...
- 【转】C语言堆栈入门——堆和栈的区别
@2019-04-25 [小记] C语言堆栈入门——堆和栈的区别