(转)FastDFS_v5.05安装配置

http://my.oschina.net/shking/blog/165326

http://blog.csdn.net/yecong111/article/details/42646523

http://www.cnblogs.com/seven7seven/p/4195736.html 

http://my.oschina.net/guol/blog/72845

 

cd var/download/

1、软件下载:
wget https://github.com/happyfish100/libfastcommon/archive/V1.0.7.tar.gz
wget http://jaist.dl.sourceforge.net/project/fastdfs/FastDFS%20Nginx%20Module%20Source%20Code/fastdfs-nginx-module_v1.16.tar.gz
wget https://github.com/happyfish100/fastdfs/archive/V5.05.tar.gz
wget http://nginx.org/download/nginx-1.8.0.tar.gz
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.36.tar.gz
wget http://zlib.net/zlib-1.2.8.tar.gz


 


2、libfastcommon安装:
cp V1.0.7 /usr/local/
tar -zxvf V1.0.7
cd libfastcommon-1.0.7
./make.sh
./make.sh install


 libfastcommon.so默认安装到了/usr/lib64/libfastcommon.so,而FastDFS主程序设置的lib目录是/usr/local/lib,所以设置软连接
 ln -s /usr/lib64/libfastcommon.so /usr/local/lib/libfastcommon.so
 ln -s /usr/lib64/libfastcommon.so /usr/lib/libfastcommon.so
 ln -s /usr/lib64/libfdfsclient.so /usr/local/lib/libfdfsclient.so
 ln -s /usr/lib64/libfdfsclient.so /usr/lib/libfdfsclient.so

3、安装FastDFS:
(1)tar -zxvf V5.05 -C /usr/local
cd /usr/local/fastdfs-5.05/

./make.sh
./make.sh install
cd /etc/fdfs

(2)配置文件设置:
cp tracker.conf.sample tracker.conf
cp storage.conf.sample storage.conf
cp client.conf.sample client.conf

详细设置见附件
tracker.conf配置中要修改的几个项:
bind_addr=202.98.27.31
port=22122
http.server_port=8080  

base_path=/usrdata/fastdfs


storage.conf配置中要修改的几个项:
group_name=group1
bind_addr=202.98.27.31
port=23000
base_path=/usrdata/fastdfs
store_path0=/usrdata/fastdfs
tracker_server=202.98.27.31:22122
http.server_port=8888

(3)启动
启动tracker storage.conf
fdfs_trackerd /etc/fdfs/tracker.conf
fdfs_storaged /etc/fdfs/storage.conf

直接kill即可让server进程正常退出,可以使用killall命令,例如: 


killall fdfs_trackerd 

killall fdfs_storaged 


4、安装nginx插件:
(1)安装
tar -zxvf fastdfs-nginx-module_v1.16.tar.gz
cd fastdfs-nginx-module/src/

(2)config文件修改:
vi config

修改如下配置,我这里原来是
CORE_INCS="$CORE_INCS /usr/local/include/fastdfs /usr/local/include/fastcommon/"
改成
CORE_INCS="$CORE_INCS /usr/include/fastdfs /usr/include/fastcommon/"
这个是很重要的,不然在nginx编译的时候会报错的,我看网上很多在安装nginx的fastdfs的插件报错,都是这个原因,而不是版本不匹配。

cp  mod_fastdfs.conf /etc/fdfs

修改配置
group_name=group1
tracker_server=202.98.27.31:22122
store_path0=/usrdata/fastdfs
base_path=/usrdata/fastdfs
url_have_group_name = true




2)、配置文件服务器的软连接
ln -s /usrdata/fastdfs/data /usrdata/fastdfs/data/M00  (配置文件中stoage存放数据的路径)


同时将以下两个文件复制到/etc/fdfs/
cp /usr/local/fastdfs-5.05/conf/http.conf /etc/fdfs/
cp /usr/local/fastdfs-5.05/conf/mime.types /etc/fdfs/


5、nginx安装:
在每个Storage服务器上安装Nginx

(1)pcre安装:
tar -zxvf pcre-8.36.tar.gz
cd pcre-8.36
./configure
make && make install
cd ../

ln -s /usr/local/lib/libpcre.so.1 /lib64/

(2)zlib安装:
tar -zxvf zlib-1.2.8.tar.gz
cd zlib-1.2.8
./configure
make && make install
cd ../

(3)nginx安装:
tar -zxvf nginx-1.8.0.tar.gz
cd nginx-1.8.0

// ./configure --prefix=/usr/local/nginx --add-module=/home/yq/fastdfs-nginx-module/src

./configure --prefix=/usr/local/nginx --add-module=/var/download/fastdfs-nginx-module/src
make
make install


cd /usr/local/nginx/conf
vi nginx.conf


在server中添加

location /group1/M00{
    root /usrdata/fastdfs/data;
    ngx_fastdfs_module;
}


启动:
/usr/local/nginx/sbin/nginx

netstat -natp | grep nginx 是否启动 看一下输出 
 安装完成。
./nginx  -s stop

./nginx  -s relaod
6、测试文件上传:
/usr/bin/fdfs_test /etc/fdfs/client.conf upload benz.jpg


根据提示访问文件


附件:
tracker.conf
storage.conf
client.conf

group测试步骤

服务器10.188 存储组group1

cd /usrdata/

/usr/bin/fdfs_test /etc/fdfs/client.conf upload QQ截图20160426104112.png 

上传到group2中成功

关闭10.190 的存储组 group2

killall fdfs_storaged    

在10.188重新上传

cd /usrdata/

/usr/bin/fdfs_test /etc/fdfs/client.conf upload QQ截图20160426104112.png 

 

 vi /usr/local/nginx/conf/nginx.conf

 

 

posted @ 2018-03-21 10:21  爱吃醋的工程师  阅读(132)  评论(0编辑  收藏  举报