博客详情

centos7中安装fastdfs (原创)

作者: 朝如青丝暮成雪
发布时间:2020-10-08 16:26:12  文章分类:java编程   阅读(837)  评论(0)

centos7中安装fastdfs  

fastDFS是一款开源的分布式文件系统,由阿里巴巴工程师happyfish100 在2008年提交开源。fastDFS架构图:


更多介绍 ,请查阅官网

https://github.com/happyfish100/fastdfs.git




一、nginx的tar.gz源码安装

yum -y install gcc gcc-c++ autoconf automake make      
yum -y install zlib zlib-devel openssl openssl-devel pcre pcre-devel

tar -zxvf nginx-1.16.0.tar.gz   

cd nginx-1.16.0/
./configure --prefix=/usr/local/nginx

make && make install

启动nginx服务
cd /usr/local/nginx
sbin/nginx  

尝试访问nginx 
curl http://localhost   #ok


二、安装fastdfs服务

1、安装libfastcommon (源码编译安装)
git clone https://github.com/happyfish100/libfastcommon.git ( https://gitee.com/fastdfs100/libfastcommon.git)

cd libfastcommon
git checkout V1.0.43

./make.sh clean && ./make.sh && ./make.sh install

2、安装fastdfs (源码编译安装)
git clone  https://github.com/happyfish100/fastdfs.git

; git checkout V6.06
./make.sh clean && ./make.sh && ./make.sh install



3、复制修改相关配置

cd fastdfs
./setup.sh /etc/fdfs
 
 (
 vi /etc/fdfs/tracker.conf
 vi /etc/fdfs/storage.conf
 vi /etc/fdfs/client.conf
)

mkdir -p  /home/yuqing/fastdfs/tracker
mkdir -p  /home/yuqing/fastdfs/storage

vi /etc/fdfs/tracker.conf ,修改内容如下
base_path = /home/yuqing/fastdfs/tracker



vi /etc/fdfs/storage.conf,修改内容如下
base_path = /home/yuqing/fastdfs/storage
store_path0 = /home/yuqing/fastdfs/storage
tracker_server = 192.168.11.42:22122



vi /etc/fsfs/client.conf ,修改内容如下
base_path=/home/yuqing/fastdfs/tracker
tracker_server=192.168.11.42:22122


#启动服务
fdfs_trackerd /etc/fdfs/tracker.conf start 
fdfs_storaged /etc/fdfs/storage.conf start 

ps -ef | grep fdfs #查看相关进程



#测试上传文件,一个图片
fdfs_upload_file /etc/fdfs/client.conf filename 
 
[root@centos7 ~]# fdfs_upload_file  /etc/fdfs/client.conf 1.jpg 
group1/M00/00/00/wKgLKl9-yCaAby76AAAqYlq5ALE420.jpg  (返回这个路径很重要)



三、nginx中安装fastdfs模块插件

git clone git clone https://gitee.com/fastdfs100/fastdfs-nginx-module.git 

cd /root/nginx-1.16.0

#重新configure 
./configure --prefix=/usr/local/nginx/ --add-module=/root/fastdfs-nginx-module/src
make  
make install

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


vi /etc/fdfs/mod_fastdfs.conf,修改内容如下
connect_timeout=10
tracker_server=192.168.11.42:22122
url_have_group_name=true 
store_path0=/home/yuqing/fastdfs/storage


修改nginx的配置
cd /usr/local/nginx/conf/
vi nginx.conf ,在server中新增内容如下

  location ~/group[0-9]/ { 
                ngx_fastdfs_module;
  }

#重启nginx服务
nginx -s stop 
nginx 

浏览器访问: http://192.168.11.42/group1/M00/00/00/wKgLKl9-yCaAby76AAAqYlq5ALE420.jpg   ,ok






关键字:  fastDFS
评论信息
暂无评论
发表评论

亲,您还没有登陆,暂不能评论哦! 去 登陆 | 注册

博主信息
   
数据加载中,请稍候...
文章分类
   
数据加载中,请稍候...
阅读排行
 
数据加载中,请稍候...
评论排行
 
数据加载中,请稍候...

Copyright © 叮叮声的奶酪 版权所有
备案号:鄂ICP备17018671号-1

鄂公网安备 42011102000739号