Environment: Centos x86_64 0.205 and 0.206 are both tracker and storage
192.168.0.205 Storage Tracker
192.168.0.206 Storage Tracker
0.205 and 0.206 installation configuration similar, the following one for example
1, install the dependency package, add Fastdfs running user
Yum install-y zlib zlib-devel pcre pcre-devel gcc gcc-c++ OpenSSL openssl-devel libevent libevent-devel perl unzipuseradd -s/sbin/nologin Fastdfs
2. Create a data store directory
Mkdir-p/export/fastdfs/{storage,tracker}[[email protected] src]# ll/export/fastdfstotal 0drwxr-xr-x 2 root root 6 Dec 1 0 15:18 Storage #Storage目录保存运行日志及其data数据 drwxr-xr-x 2 root root 6 Dec 15:17 tracker #tracker目录保存运行日志
3, install Libfastcommon
Download latest Version: Libfastcommonwget https://github.com/happyfish100/libfastcommon/archive/master.zipunzip MASTER.ZIPCD libfastcommon-master/./make.sh./make.sh Install
4, install Fastdfs
wget http://sourceforge.net/projects/fastdfs/files/FastDFS%20Server%20Source%20Code/FastDFS%20Server%20with% 20php%20extension%20source%20code%20v5.05/fastdfs_v5.05.tar.gz/downloadtar ZXF FastDFS_v5.05.tar.gz && CD fastdfs./make.sh./make.sh install\cp pa conf/*.conf/etc/fdfs/cd/etc/fdfs/rm-rf *.samplechown-r FastDFS:/export/ Fastdfs
5, configure tracker and storage configuration files, corresponding modifications
VI Storage.confgroup_name=group1base_path=/export/fastdfs/storagestore_path0=/export/fastdfs/storagetracker_ Server=192.168.0.205:22122tracker_server=192.168.0.206:22122http.server_port=80vi Tracker.confbase_path=/export /fastdfs/trackervi mod_fastdfs.confgroup_name=group1base_path=/export/fastdfs/storagestore_path0=/export/ Fastdfs/storagetracker_server=192.168.0.205:22122tracker_server=192.168.0.206:22122url_have_group_name = true # is true not Turevi client.conftracker_server=192.168.0.205:22122tracker_server=192.168.0.206:22122
6. Installing Nginx and Fastdfs-nginx-module modules
wget http://nginx.org/download/nginx-1.8.0.tar.gzhttp://sourceforge.net/projects/fastdfs/files/FastDFS%20Nginx% 20module%20source%20code/fastdfs-nginx-module_v1.16.tar.gz/downloadtar ZXF fastdfs-nginx-module_v1.16.tar.gz && tar zxf nginx-1.8.0.tar.gz #修改模块中对应的路径, otherwise the module does not properly install the load CD FASTDFS-NGINX-MODULE/SRCVI conf #更改如下, remove the local, and specify LIB64 (64 system) core_incs= "$CORE _incs/usr/include/fastdfs/usr/include/fastcommon/" core_libs= "$CORE _libs-l/usr/ Lib64-lfastcommon-lfdfsclient "Ulimit-shn 102400useradd-s/sbin/nologin wwwcd nginx-1.8.0/configure--user=www-- Group=www--add-module=. /fastdfs-nginx-module/src/--prefix=/usr/local/nginx--with-http_stub_status_module--with-http_ssl_module-- With-http_realip_modulemakemake Install
7, configuring Nginx
server { listen 80; server_name 192.168.0.205; root /webdata/fastdfs.com; index index.html index.htm; location / { if (!-e $request _filename) { rewrite ^ (. *) $ /index.html last; } location /group1/m00 { root /export/fastdfs/storage/data /; ngx_fastdfs_module; } location ~ .*\. (GIF|JPG|JPEG|PNG|BMP|SWF|JS) $ { # fastcgi_cache cache_one; # nginx.conf Open cache, or start error fastcgi_cache_valid 200 10m; fastcgi_cache_valid 304 3m; fastcgi_cache_valid 301 302 1h; fastcgi_cache_valid any 1m; fastcgi_cache_min_uses 1; fastcgi_cache_use_stale error timeout invalid_header http_500; fastcgi_cache_key $host $request_uri; access_log off; } } access_log off;}
8, 206 configuration, nginx corresponding IP is 206, start Nginx and Fastdfs
[[email protected] vhost]# /etc/init.d/fdfs_storaged startstarting fastdfs storage server: [[email protected] vhost]# /etc/init.d/fdfs_trackerd Startstarting fastdfs tracker server: [[email protected] vhost]# [[email protected] vhost]# /etc/init.d/nginx -tngx_http_fastdfs_set pid=8985nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is oknginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful[[email Protected] vhost]# /etc/init.d/nginx -s reloadngx_http_fastdfs_set pid=8986[email protected] vhost]# netstat -npl |grep -E "Nginx|fdfs" tcp 0 0 0.0.0.0:22122 0.0.0.0:* LISTEN 8972/fdfs_trackerd tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 7561/nginx tcp 0 0 0.0.0.0:23000 0.0.0.0:* listen&nBsp; 8679/fdfs_storaged
9, Test
[[email protected] ~]# fdfs_test /etc/fdfs/client.conf upload test.html this is fastdfs client test program v5.05copyright (C) 2008, happy fish / yuqingfastdfs may be copied only under the terms of the gnu generalpublic license v3, which may be Found in the fastdfs source kit. Please visit the fastdfs home page http://www.csource.org/ for more detail. [2015-06-14 02:46:06] debug - base_path=/tmp, connect_timeout=30, network_ Timeout=60, tracker_server_count=1, anti_steal_token=0, anti_steal_secret_key length=0, use_connection_pool=0, g_connection_pool_max_idle_time=3600s, use_storage_id=0, storage server id count: 0tracker_query_storage_store_list_without_group: server 1. group_name=, ip_addr= 192.168.0.205, port=23000 server 2. group_name=, ip_addr=192.168.0.206, port=23000group_name=group1, ip_addr=192.168.0.206, port= 23000storage_upload_by_filenamegroup_name=group1, remote_filename=m00/00/00/ wkgazlv8em6af8qbaaaadxtaro466.htmlsource ip address: 192.168.0.206file timestamp= 2015-06-14 02:46:06file size=15file crc32=458900718example file url: http:// 192.168.0.206/group1/m00/00/00/wkgazlv8em6af8qbaaaadxtaro466.htmlstorage_upload_slave_by_filenamegroup_name= Group1, remote_filename=m00/00/00/wkgazlv8em6af8qbaaaadxtaro466_big.htmlsource ip address: 192.168.0.206file timestamp=2015-06-14 02:46:06file size=15file crc32= 458900718example file url: http://192.168.0.206/group1/m00/00/00/wkgazLv8em6af8qbaaaadxtaro466_big.html
fastdfs_v5.05 Distributed storage installation and use