Fastdfs and Nginx Installation

Source: Internet
Author: User
Tags crc32 file url

Introduced

Two servers, using a system of CENTOS7.1,LIBFASTCOMMON1.07,FASTDFS version 5.05 stable version

The two server IPs are 18 and 50,18 as tracker machines, 50 as storage.

Installation dependencies

sudo yum-y groupinstall ' development Tools '

Installing Libfastcommon

CD Libfastcommon-master

./make.sh

sudo./make.sh Install

Installing Fastdfs

CD fastdfs-5.05/

./make.sh

sudo./make.sh Install

Add user

Useradd fastdfs-m-s/sbin/nologin

Useradd nginx-m-s/sbin/nologin

Create a folder

sudo mkdir-p/data/fdfs/

sudo chown-r Fastdfs:fastdfs/data/fdfs

Modifying the tracker configuration file on 18 machines

sudo cp/etc/fdfs/tracker.conf.sample/etc/fdfs/tracker.conf

sudo vim/etc/fdfs/tracker.conf

Modify Base_path

# The base path to store data and log files

Base_path=/data/fdfs

Configure Run-user,run Group to start tracker for Fastdfs,fastdfs

/usr/bin/fdfs_trackerd/etc/fdfs/tracker.conf start modifying the storage configuration file on the 50 machine

Cd/etc/fdfs

sudo cp tracker.conf.sample tracker.conf

#编辑文件tracker. conf

sudo vim tracker.conf

Run_by_group=fastdfs

Run_by_user=fastdfs

# The base path to store data and log files

Base_path=/data/fdfs

# tracker_server can ocur more than once, and Tracker_server format is

# "Host:port", host can be hostname or IP address

tracker_server=192.168.1.36:22122

# store_path#, based 0, if Store_path0 not exists, it's value is Base_path

# The paths must be exist

Store_path0=/data/fdfs

#store_path1 =/HOME/YUQING/FASTDFS2

Start storage

sudo/usr/bin/fdfs_storaged/etc/fdfs/storage.conf Start configuration test Client

为50机器添加client配置文件
cd /etc/fdfssudo cp client.conf.sample client.conf
修改client.conf文件的如下内容
# the base path to store log filesbase_path=/data/fdfs
# tracker_server can ocur more than once, and tracker_server format is#  "host:port", host can be hostname or ip addresstracker_server=192.168.1.50:22122
Create a directory for Nginx use
sudo mkdir /data/ngx
sudo chown –R fastdfs:fastdfs /data
Create a mod_fastdfs.conf file
sudo cp /root/fastdfs-nginx-module-master/src/mod_fastdfs.conf /etc/fdfs/
Modify Mod_fastdfs.conf
# the base path to store log filesbase_path=/data/ngx# FastDFS tracker_server can ocur more than once, and tracker_server format is#  "host:port", host can be hostname or ip address# valid only when load_fdfs_parameters_from_tracker is truetracker_server=192.168.1.36:22122# store_path#, based 0, if store_path0 not exists, it‘s value is base_path# the paths must be exist# must same as storage.confstore_path0=/data/fdfs
Copy files http.conf and mime.types to/etc/fdfs directory
cp /usr/yKF6600/fastdfs-master/conf/http.conf /usr/yKF6600/fastdfs-master/conf/mime.types  /etc/fdfs
Configuring Nginx Configuration

Modify Vi/usr/local/openresty/nginx/conf/nginx.conf

 server {        listen       80;        server_name  localhost;        charset utf8;        location /M00 {                alias /data/fdfs/data;                ngx_fastdfs_module;        }   ......
Create a connection
sudo ln -s /data/fdfs/data /data/fdfs/data/M00
Re-start Nginx
Sudo/usr/local/openresty/nginx/sbin/nginx-s Reload
Create and upload test files

Create test.html and enter the following:

Test Fastdfs

Upload test file, command for

/usr/bin/fdfs_test/etc/fdfs/client.conf Upload test.html

The result is similar to

This was FASTDFS Client test program V5.05copyright (C), Happy Fish/yuqingfastdfs could copied only under the terms Of the GNU generalpublic License V3, which May is found in the FASTDFS source kit. Visit the Fastdfs Home Page http://www.csource.org/for more detail. [2015-04-25 18:06:09] Debug-base_path=/data/fdfs, 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.1.36, Port=23000group_name=group1, ip_addr=192.168.1.36, Port=23000storage_upload_by_ Filenamegroup_name=group1, Remote_filename=m00/00/00/wkgc1fu7zxgaf19vaaaadcvbslg01.htmlsource IP address: 192.168.1.36file timestamp=2015-04-25 18:06:09file size=13file crc32=3418468952example file url:http://192.168.1.36/ Group1/m00/00/00/wkgc1fu7zxgaf19vaaaadcvbslg01.htmlstorage_upload_slave_by_filenamegroup_name=group1, Remote_filename=m00/00/00/ Wkgc1fu7zxgaf19vaaaadcvbslg01_big.htmlsource IP address:192.168.1.36file timestamp=2015-04-25 18:06:09file size= 13file crc32=3418468952example File url:http://192.168.1.36/group1/m00/00/00/wkgc1fu7zxgaf19vaaaadcvbslg01_big.html

Access the uploaded page

Curl http://172.16.4.50/M00/00/00/rBAEMlcersyAT4p8AAAADcvBslg24_big.html

Get results for

Test Fdfs

Reference

Http://www.centoscn.com/image-text/install/2015/0429/5298.html

Fastdfs and Nginx Installation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.