FastDFS安装配置以及整合Nginx测试

来源:互联网 发布:全国流动人口监测数据 编辑:程序博客网 时间:2024/05/16 03:19

FastDFS安装配置以及整合Nginx测试

本机平台:ubuntu 17.4
第一步:安装前准备:
1:安装pthread库
buntu 下默认是没有pthread库的 ,用下面的指令安装 就可以了(可以不安装,但是我的好像不安装有点问题)view p cop
  1. sudo apt-get install glibc-docsudo apt-get install manpages-posix-dev

2:安装Git

fastdfs依赖libfastcommon,需要从github上clone到本地编译安装。因此首先需要安装Git

执行命令:

[html] view plain copy
  1. apt-get install git  

3:克隆libfastcommon库

libfastcommon的源在项目 https://github.com/happyfish100/libfastcommon 需要使用git将其clone至本地安装。
[html] view plain copy
  1. git clone https://github.com/happyfish100/libfastcommon.git  

4:安装libfastcommon依赖

进入libfastcommon目录,依次执行脚本:

[html] view plain copy
  1. ./make.sh  

[html] view plain copy
  1. ./make.sh install  

5:设置环境变量和软链接

在32位ubuntu中,libfastcommon会安装在/usr/lib 中,64位系统则安装在 /usr/lib64 中。依次执行以下命令:(根据自己的操作系统选择路径)

[html] view plain copy
  1. export LD_LIBRARY_PATH=/usr/lib/  

[html] view plain copy
  1. ln -s /usr/lib/libfastcommon.so /usr/local/lib/libfastcommon.so  

6.下载源文件和nginx插件,以及上传
放出地址:http://download.csdn.net/download/java__han/9947167
上传直linux
第二步:安装以及配置

1:安装Tracker服务

1、解压缩

2、./make.sh

3、./make.shinstall

安装后在/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.confrestart

2:安装storage服务。

1、如果是在不同的服务器安装,第四步的1~4需要重新执行。

2、配置storage服务。修改/root/FastDFS/conf/storage.conf文件

3、启动storage服务。

/usr/bin/fdfs_storaged /etc/fdfs/storage.conf restart

3:测试服务。

1、修改配置文件/etc/fdfs/client.conf

2、测试

/usr/bin/fdfs_test/etc/fdfs/client.conf upload anti-steal.jpg

4:搭建nginx提供http服务。

可以使用官方提供的nginx插件。要使用nginx插件需要重新编译。

fastdfs-nginx-module_v1.16.tar.gz

1、解压插件压缩包

2、修改/root/fastdfs-nginx-module/src/config文件,把其中的local去掉。

3、对nginx重新config

./configure--sbin-path=/usr/local/nginx/nginx \

--conf-path=/usr/local/nginx/nginx.conf\

--pid-path=/usr/local/nginx/nginx.pid\

--with-http_ssl_module\

--add-module=/home/hc/upload/fastdfs-nginx-module/src

4、make 然后make install

5、把/root/fastdfs-nginx-module/src/mod_fastdfs.conf文件复制到/etc/fdfs目录下。编辑:

6、nginx的配置

在nginx的配置文件中添加一个Server:

[html] view plain copy
  1. server {
            listen       80;
            server_name  192.168.101.3;
     
            location /group1/M00/{
                    #root/home/FastDFS/fdfs_storage/data;
                    ngx_fastdfs_module;
            }


7、将libfdfsclient.so拷贝至/usr/lib下

cp /usr/lib64/libfdfsclient.so /usr/lib/

8、启动nginx

上传测试成功






原创粉丝点击