fastdfs搭建
一、安装依赖:
yum install -y gcc-c++ wget unzip perl pcre-devel zlib-devel libevent
二、下载:
1、下载fastdfs:
wget https://github.com/happyfish100/fastdfs/archive/V5.11.tar.gz
2、下载libfastcommon:
wget https://github.com/happyfish100/libfastcommon/archive/V1.0.36.tar.gz
3、下载fastdfs-nginx-module:
git clone https://github.com/happyfish100/fastdfs-nginx-module.git
4、下载nginx:
wget https://nginx.org/download/nginx-1.14.0.tar.gz
三:安装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下。
cd /root/FastDFS/conf
cp * /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服务
1、解压fastdfs-nginx-module
2、解压nginx
3、对nginx重新config
./configure --prefix=/usr/local/nginx --add-module=../fastdfs-nginx-module/src/
4、make
5、make install(如果有错,按提示安装依赖)
6、把/root/fastdfs-nginx-module/src/mod_fastdfs.conf文件复制到/etc/fdfs目录下。编辑:
7、nginx的配置
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
参考:http://blog.51cto.com/niubdada/1750635
转载于:https://my.oschina.net/starhq/blog/1802789