分布式文件系统FastDF+Nginx环境搭建(单机测试版)

*4.5 FastDFS搭建*

可以使用一台虚拟机来模拟,只有一个Tracker、一个Storage服务。
配置nginx访问图片。

*4.5.1 搭建步骤*
第一步:把fastDFS都上传到linux系统。

第二步:安装FastDFS之前,先安装libevent工具包。

yum -y install libevent

第三步:安装libfastcommonV1.0.7工具包。

1、解压缩

2、./make.sh

3、./make.sh install

4、把/usr/lib64/libfastcommon.so文件向/usr/lib/下复制一份

第四步:安装Tracker服务。

**1**、解压缩

**2**、./make.sh

**3**、./make.sh install

安装后在/usr/bin/目录下有以fdfs开头的文件都是编译出来的。
配置文件都放到/etc/fdfs文件夹

4、把/root/FastDFS/conf目录下的所有的配置文件都复制到/etc/fdfs下。

5、配置tracker服务。修改/root/FastDFS/conf/tracker.conf文件。

6、启动tracker。 /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf
重启使用命令:/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart

第五步:安装storage服务。
1、如果是在不同的服务器安装,第四步的1~4需要重新执行。
2、配置storage服务。修改/root/FastDFS/conf/storage.conf文件
3、启动storage服务。
/usr/bin/fdfs_storaged /etc/fdfs/storage.conf restart

第六步:测试服务。
1、修改配置文件/etc/fdfs/client.conf
2、测试
/usr/bin/fdfs_test /etc/fdfs/client.conf upload anti-steal.jpg

第七步:搭建nginx提供http服务。
可以使用官方提供的nginx插件。要使用nginx插件需要重新编译。
fastdfs-nginx-module_v1.16.tar.gz
1、解压插件压缩包
2、修改/root/fastdfs-nginx-module/src/config文件,把其中的local去掉。
3、对nginx重新config

./configure \
--prefix=/usr/local/nginx \
--pid-path=/var/run/nginx/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--with-http_gzip_static_module \
--http-client-body-temp-path=/var/temp/nginx/client \
--http-proxy-temp-path=/var/temp/nginx/proxy \
--http-fastcgi-temp-path=/var/temp/nginx/fastcgi \
--http-uwsgi-temp-path=/var/temp/nginx/uwsgi \
--http-scgi-temp-path=/var/temp/nginx/scgi \
--add-module=/usr/java/fastdfs/bin/fastdfs-nginx-module/src

4、make
注意:此步骤可能make出错,找不到libfastclient.so,需要将lib64中的libfastclient.so
拷贝到lib下
5、make install
6、把/root/fastdfs-nginx-module/src/mod_fastdfs.conf文件复制到/etc/fdfs目录下。编辑:
7、nginx的配置
在nginx的配置文件中添加一个Server:

server {
        listen       80;
        server_name  192.168.101.3;

        location /group1/M00/{
                #root /home/FastDFS/fdfs_storage/data;
                ngx_fastdfs_module;
        }
}

8、将libfdfsclient.so拷贝至/usr/lib下
cp /usr/lib64/libfdfsclient.so /usr/lib/
9、启动nginx

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值