FastDFS安装

FastDFS安装

标签(空格分隔): FastDFS


安装libfastcommon

root安装libfastcommon

# cd /home/urmp/libs/fastdfs/
# unzip libfastcommon-master.zip 
# cd libfastcommon-master
# ./make.sh
# ./make.sh install

root安装fastdfs

# cd /home/urmp/libs/fastdfs/
# unzip fastdfs-5.08.zip
# cd fastdfs-5.08
# ./make.sh
# ./make.sh install
  1. 配置Tracker

    cp/etc/fdfs/tracker.conf.sample/etc/fdfs/tracker.conf c p / e t c / f d f s / t r a c k e r . c o n f . s a m p l e / e t c / f d f s / t r a c k e r . c o n f vim /etc/fdfs/tracker.conf

替换如下内容:

base_path=/home/urmp/libs/fastdfs/tracker/
http.server_port=8088 ##Nginx监听端口一致

创建Tracker存储路径

# mkdir -p /home/urmp/libs/fastdfs/tracker

启动Tracker

# /usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf restart
查看监听程序:
# netstat -ntpl | grep tracker
查看日志文件:
# tail -100f /home/urmp/libs/fastdfs/tracker/logs/trackerd.log
  1. 配置Storage

    cp/etc/fdfs/storage.conf.sample/etc/fdfs/storage.conf c p / e t c / f d f s / s t o r a g e . c o n f . s a m p l e / e t c / f d f s / s t o r a g e . c o n f vim /etc/fdfs/storage.conf

替换如下内容:

base_path=/home/urmp/libs/fastdfs/storage/
store_path0=/home/urmp/libs/fastdfs/storage/
tracker_server=10.92.82.34:22122
tracker_server=10.92.82.35:22122
http.server_port=8088 ##Nginx监听端口一致

创建Storage存储路径

# mkdir -p /home/urmp/libs/fastdfs/storage/

启动Storage

# /usr/bin/fdfs_storaged /etc/fdfs/storage.conf restart
查看监听程序:
# netstat -ntpl | grep storage
查看日志文件:
# tail -100f /home/urmp/libs/fastdfs/storage/logs/storaged.log 
  1. 配置Client

    cp/etc/fdfs/client.conf.sample/etc/fdfs/client.conf c p / e t c / f d f s / c l i e n t . c o n f . s a m p l e / e t c / f d f s / c l i e n t . c o n f vim /etc/fdfs/client.conf

替换如下内容:

base_path=/home/urmp/libs/fastdfs/client/
tracker_server=10.92.82.34:22122
tracker_server=10.92.82.35:22122
http.tracker_server_port=8088 ##Nginx监听端口一致
##include http.conf 调整为:
#include /home/urmp/libs/fastdfs/fastdfs-nginx-module-master/src/http.conf

创建Client存储路径

# mkdir -p /home/urmp/libs/fastdfs/client/
  1. 集成Nginx

下载fastdfs-nginx-module

# cd /home/urmp/libs/fastdfs/
# unzip fastdfs-nginx-module-master.zip
# cd fastdfs-nginx-module-master/src
查看当前所在位置
# pwd
如:/home/urmp/libs/fastdfs/fastdfs-nginx-module-master/src
# vim config
搜索/etc/fdfs/mod_fastdfs.conf替换为/home/urmp/libs/fastdfs/fastdfs-nginx-module-master/src/mod_fastdfs.conf

移动编辑http.conf 和 mime.types、anti-steal.jpg
cp /home/urmp/libs/fastdfs/fastdfs-5.08/conf/http.conf /home/urmp/libs/fastdfs/fastdfs-nginx-module-master/src/
cp /home/urmp/libs/fastdfs/fastdfs-5.08/conf/mime.types /home/urmp/libs/fastdfs/fastdfs-nginx-module-master/src/
cp /home/urmp/libs/fastdfs/fastdfs-5.08/conf/anti-steal.jpg /home/urmp/libs/fastdfs/fastdfs-nginx-module-master/src/

修改项目Nginx配置,增加fastdfs配置
$ cd /home/urmp/libs/nginx/
$ vim vhosts/urmp.conf
新增如下内容:
    location ~/group([0-9])/M00 {
        root /home/urmp/libs/fastdfs/storage/data/;
        ngx_fastdfs_module;
    }

配置Nginx-FastDFS
# vim /home/urmp/libs/fastdfs/fastdfs-nginx-module-master/src/mod_fastdfs.conf
查找替换以下内容:
base_path=/home/urmp/libs/fastdfs/storage/
tracker_server=10.92.82.34:22122
tracker_server=10.92.82.35:22122
log_filename=/home/urmp/libs/nginx/logs/ngx-fdfs.log
store_path0=/home/urmp/libs/fastdfs/storage/
url_have_group_name = true
group_count = 1

[group1]
base_path=/home/urmp/libs/fastdfs/storage/
group_name=group1
storage_server_port=23000
store_path_count=1
store_path0=/home/urmp/libs/fastdfs/storage/    

重新编译安装Nginx        
$ cd /home/urmp/soft/nginx/nginx-1.11.6
$ ./configure --prefix=/home/urmp/libs/nginx --conf-path=/home/urmp/libs/nginx/nginx.conf --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --add-module=/home/urmp/soft/nginx/ngx_cache_purge-master --add-module=/home/urmp/soft/nginx/nginx_upstream_check_module-master --add-module=/home/urmp/libs/fastdfs/fastdfs-nginx-module-master/src
$ make && make install
查看安装组件
$ /home/urmp/libs/nginx/sbin/nginx -V
重启Nginx
$ for sid in `ps -ef | grep nginx | awk '{print $2}'`;  do kill -9 $sid; done
$ /home/urmp/libs/nginx/sbin/nginx
查看Nginx是否启动错误
$ tail -100f /home/urmp/libs/nginx/logs/ngx-fdfs.log
$ tail -100f /home/urmp/libs/nginx/logs/error.log
  1. run test program

run the client test program:

/usr/bin/fdfs_test <client_conf_filename> <operation>
/usr/bin/fdfs_test1 <client_conf_filename> <operation>
#for example, upload a file:
/usr/bin/fdfs_test /etc/fdfs/client.conf upload /home/urmp/data/123.png
/usr/bin/fdfs_test1 /etc/fdfs/client.conf upload /home/urmp/data/fastdfs.png
  1. run monitor program

    run the monitor program:

    /usr/bin/fdfs_monitor /etc/fdfs/client.conf

©️2020 CSDN 皮肤主题: 书香水墨 设计师:CSDN官方博客 返回首页