Tracker server:10.2.84.200
Storage server:10.2.84.20210.2.84.204
I. Installation and Deployment
1. Configure Tracker server, storage server
# Unzip Libfastcommon-master.zip
# CD Libfastcommon-master
#./make.sh
#./make.sh Install
Libfastcommon.so installed to/usr/lib64/libfastcommon.so, but the FASTDFS main program is set to the Lib directory is/usr/local/lib, so you need to create a soft link
# ln-s/usr/lib64/libfastcommon.so/usr/local/bin/libfastcommon.so
# ln-s/data/usr/lib64/libfdfsclient.so/usr/local/bin/libfdfsclient.so
# ln-s/data/usr/lib64/libfdfsclient.so/usr/local/lib/libfdfsclient.so
# tar ZXVF fastdfs_v5.05.tar.gz
# CD Fastdfs
# Vim Make.sh
Destdir=/data
#./make.sh
#./make.sh Install
Create a storage directory
# Mkdir-pv/data/fastdfs
Second, modify the configuration Tracker server side files
# cd/data/etc/fdfs/
# CP Client.conf.sample client.conf
# CP Tracker.conf.sample tracker.conf
# Vim Tracker.conf
bind_addr=10.2.84.200
Base_path=/data/fastdfs
# Vim Client.conf
Base_path=/data/fastdfs
tracker_server=10.2.84.200:22122
Start:
#/data/usr/bin/fdfs_trackerd/data/etc/fdfs/tracker.conf
Third, modify the storage server-side file
# cd/data/etc/fdfs/
# CP Client.conf.sample client.conf
# CP Storage.conf.sample storage.conf
# Vim Storage.conf
bind_addr=10.2.84.202
Base_path=/data/fastdfs
Store_path0=/data/fastdfs
tracker_server=10.2.84.200:22122
# Vim Client.conf
Base_path=/data/fastdfs
tracker_server=10.2.84.200:22122
Start:
#/data/usr/bin/fdfs_storaged/data/etc/fdfs/storage.conf
Iv. installing Ngxin, fastdfs-nginx-module on storage server
Fastdfs through the tracker server, the file is placed on the storage server store, but the server between the same group needs to copy files, there is a delay problem. Suppose the tracker server uploads the file to 10.2.84.202, the file ID has been returned to the client,
At this point, the background will copy this file to 10.2.84.204, if the replication is not completed, the client will use this ID in the 10.2.84.204 to fetch files, there will definitely be an error
This fastdfs-nginx-module can redirect connections to the source server to fetch files, preventing the client from having errors due to replication delays.
# mkdir-pv/data/nginx/
# MV Fastdfs-nginx-module/soft/nginx/
# TAR/ROOT/ZXVF Fastdfs-nginx-module_v1.16.tar.gz
# CD Fastdfs-nginx-module
# Vim Src/config
core_incs= "$CORE _incs/usr/local/include/fastdfs/usr/local/include/fastcommon/"
Modified to: In fact, is to remove the/local directory
core_incs= "$CORE _incs/data/usr/include/fastdfs/usr/include/fastcommon/"
# yum Install-y pcre-devel Openssl-devel
# tar Zxvf/root/nginx-1.9.12.tar.gz
# cd/root/nginx-1.9.12
#./configure--prefix=/soft/nginx--conf-path=/soft/nginx/conf/nginx.conf--with-select_module--with-poll_module- -with-http_ssl_module--with-http_flv_module--with-http_gzip_static_module--with-http_gunzip_module--with-http_ Stub_status_module--with-http_auth_request_module--ADD-MODULE=/SOFT/NGINX/FASTDFS-NGINX-MODULE/SRC
# make
# make Install
# cp/soft/nginx/fastdfs-nginx-module/src/mod_fastdfs.conf/data/etc/fdfs/
# vim/data/etc/fdfs/mod_fastdfs.conf
Base_path=/data/fastdfs
tracker_server=10.2.84.200:22122
Url_have_group_name = True
Store_path0=/data/fastdfs
# cp/root/fastdfs/conf/http.conf/data/etc/fdfs/
# cp/root/fastdfs/conf/mime.types/data/etc/fdfs/
# vim/data/etc/fdfs/http.conf
Http.anti_steal.token_check_fail=/data/fastdfs/conf/anti-steal.jpg
# vim/soft/nginx/conf/nginx.conf
location/m00 {
Root/data/fastdfs;
Ngx_fastdfs_module;
}
# ln-s/DATA/FASTDFS/DATA/DATA/FASTDFS/M00
# vim/etc/ld.so.conf
/usr/local/lib
#/sbin/ldconfig
#/soft/nginx/sbin/nginx-t
#/soft/nginx/sbin/nginx
Shut down:
#/data/usr/bin/stop.sh/data/etc/fdfs/storage.conf
Open:
#/data/usr/bin/fdfs_storaged/data/etc/fdfs/storage.conf
#/data/usr/bin/fdfs_trackerd/data/etc/fdfs/tracker.conf
Test upload:
#/data/usr/bin/fdfs_upload_file/data/etc/fdfs/client.conf/root/a.txt
FASTDFS installation Configuration