Try 5.05 Fastdfs

Source: Internet
Author: User
Tags crc32 file url

1 Version Information

The system used by the server is centos7.1, and the Fastdfs version is 5.05 stable version

The server IPs are:

172.27.12.65, as a tracker machine.

172.27.12.61, as Group1 's storage

172.27.12.67, as group2 storage 2 Fastdfs Installation Configuration 2.1 fastdfs Install 2.1.1 Download Fastdfs and related

Download fastdfs-5.05:

wget https://github.com/happyfish100/fastdfs/archive/V5.05.tar.gz

Download Libfastcommon-master:

wget Https://github.com/happyfish100/libfastcommon/archive/master.zip

Download Fastdfs module:

wget Https://github.com/happyfish100/fastdfs-nginx-module/archive/master.zip

Download Nginx Lua:

wget http://openresty.org/download/ngx_openresty-1.7.10.1.tar.gz 2.1.2 Installation Fastdfs dependent

To install the compilation environment, execute the command:

sudo yum-y groupinstall ' development Tools '

To install Libfastcommon, execute the command:

CD Libfastcommon-master

./make.sh

sudo./make.sh Install 2.1.3 Installation Fastdfs

CD fastdfs-5.05/

./make.sh

sudo./make.sh Install 2.2 Fastdfs configuration

Add user

sudo useradd fastdfs-m-s/sbin/nologin

Create a folder

sudo mkdir-p/data/fdfs/

sudo chown-r fastdfs:fastdfs/data/fdfs 2.2.1 Configuring tracker Server

Configure the tracker server on the 65 server to list only the modified content, without modification. To add a configuration file:

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

To modify the tracker configuration file:

Base_path=/data/fdfs

Run_by_group=fastdfs

Run_by_user=fastdfs 2.2.2 Start Tracker

To execute a startup command:

sudo/usr/bin/fdfs_trackerd/etc/fdfs/tracker.conf start 2.2.3 Configuring the storage server

On the 61 and 67 servers respectively, modify the storage.conf file, listing only the modified content, not listing the content without modification. To add a storage configuration file:

Cd/etc/fdfs

sudo cp storage.conf.sample storage.conf

Modifying the storage configuration file for group1

Group_name=group1

Run_by_group=fastdfs

Run_by_user=fastdfs

Base_path=/data/fdfs

tracker_server=192.168.1.50:22122

Store_path0=/data/fdfs

Modify the configuration file for the group2 storage

Run_by_group=fastdfs

Run_by_user=fastdfs

Group_name=group2

Base_path=/data/fdfs

tracker_server=192.168.1.51:22122

Store_path0=/data/fdfs 2.2.4 Start Storage

Execute the start storage command on 61 and 67 servers respectively:

sudo/usr/bin/fdfs_storaged/etc/fdfs/storage.conf start

After the storage is properly started, you need to create a connection. On 61 and 67 servers, respectively, execute the command:

sudo ln-s/data/fdfs/data/data/fdfs/data/m00 2.2.5 Configuring the storage test Client

To add a configuration client file for a storage server

Cd/etc/fdfs

sudo cp client.conf.sample client.conf

Modify the client.conf file, the content is not listed without modification, modify the following:

Base_path=/data/fdfs

tracker_server=192.168.1.50:22122 3 openresty nginx LUA installation and configuration 3.1 openresty nginx LUA installation

In the/usr/ykf6600/fdfs directory, download and unzip Fastdfs-nginx-module to execute the command:

wget Https://github.com/happyfish100/fastdfs-nginx-module/archive/master.zip

Unzip Fastdfs-nginx-module-master.zip

In the/usr/ykf6600/fdfs directory, download and unzip the Openresty Nginx Lua, execute the command:

wget http://openresty.org/download/ngx_openresty-1.7.10.1.tar.gz

TAR-ZXVF ngx_openresty-1.7.10.1.tar.gz 3.1.1 Installation ngx_openresty

Install the compilation environment

sudo yum install pcre-devel OpenSSL openssl-devel

Install Ngx_openresty, in the Ngx_openresty directory, execute

sudo./configure--with-luajit--with-http_stub_status_module--with-http_ssl_module--with-http_realip_module-- Add-module=/usr/ykf6600/fastdfs/fastdfs-nginx-module-master/src

sudo gmake

sudo gmake Install

Create a directory for Nginx use

sudo mkdir/data/ngx

sudo chown-r fastdfs:fastdfs/data

Create a mod_fastdfs.conf file

sudo cp/usr/ykf6600/fdfs/fastdfs-nginx-module-master/src/mod_fastdfs.conf/etc/fdfs/3.2 configuration ngx_openresty 3.2.1 Modify MoD _fastdfs.conf file

respectively 61 and 67 machine execution

sudo touch/data/ngx/mod_nginx.log

sudo chown–r fastdfs:fastdfs/data

61 Machine for group1 Storage server, modify/etc/fdfs/mod_fastdfs.conf file (not listed content without modification), modify the contents as follows:

Base_path=/data/ngx

tracker_server=192.168.1.36:22122

Group_name=group1

Store_path0=/data/fdfs

Url_have_group_name = True

Log_filename=/data/ngx/mod_nginx.log

Group_count = 2

[Group1]

Group_name=group1

storage_server_port=23000

Store_path_count=1

Store_path0=/data/fdfs

[Group2]

Group_name=group2
storage_server_port=23000

Store_path_count=1

Store_path0=/data/fdfs

67 Server for GROUP2 Storage server, modify/etc/fdfs/mod_fastdfs.conf (not listed content without modification), modify the content as follows:

Base_path=/data/ngx

tracker_server=192.168.1.36:22122

Group_name=group2

Store_path0=/data/fdfs

Url_have_group_name = True

Log_filename=/data/ngx/mod_nginx.log

Group_count = 2

[Group1]

Group_name=group1

storage_server_port=23000

Store_path_count=1

Store_path0=/data/fdfs

[Group2]

Group_name=group2

storage_server_port=23000

Store_path_count=1

Store_path0=/data/fdfs 3.2.2 Add http.conf and Mine.types files

Replicate http.conf and Mime.types to/etc/fdfs directories on 61 and 67 servers respectively

Cd/usr/ykf6600/fdfs/fastdfs-5.05/conf

sudo cp http.conf mime.types/etc/fdfs/3.2.3 configuration nginx.conf file

On the 61 server, modify the group1 Nginx's/usr/local/openresty/nginx/conf/nginx.conf

#user nobody;

User Fastdfs;

Worker_processes 1;

Error_log/data/ngx/error.log;

Events {

Worker_connections 1024;

}

HTTP {

Include Mime.types;

Default_type Application/octet-stream;

Log_format Main ' $remote _addr-$remote _user [$time _local] "$request" '

' $status $body _bytes_sent ' $http _referer '

' "$http _user_agent" "$http _x_forwarded_for";

Access_log/data/ngx/access.log main;

Sendfile on;

#tcp_nopush on;

#keepalive_timeout 0;

Keepalive_timeout 65;

#gzip on;

server {

Listen 80;

server_name localhost;

CharSet UTF8;

location/group1/m00 {

Alias/data/fdfs/data;

Ngx_fastdfs_module;

}

}

}

On 67 server, modify nginx.conf, because group2 nginx.conf file content only the following content and group1 nginx.conf content is not consistent, the other according to group1 nginx.conf configuration modified:

location/group2/m00 {

Alias/data/fdfs/data;

Ngx_fastdfs_module;

} 3.2.4 boot or reload into Nginx configuration file

To start the Nginx command:

Sudo/usr/local/openresty/nginx/sbin/nginx

Re-loading the Nginx configuration:

Sudo/usr/local/openresty/nginx/sbin/nginx-s Reload 4 Upload test

Create a test.html page and enter the following:

Test Fastdfs

To upload the test file, the command is:

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

The returned results are similar to:

[2016-05-04 02:06:56] 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:0

Tracker_query_storage_store_list_without_group:

Server 1. Group_name=, ip_addr=172.27.12.61, port=23000

Group_name=group1, ip_addr=172.27.12.61, port=23000

Storage_upload_by_filename

Group_name=group1, remote_filename=m00/00/00/rbaeyvcpwtqawvsvaaaadcvbslg32.html

Source IP address:172.27.12.61

File timestamp=2016-05-04 02:06:50

File size=13

File crc32=3418468952

Example File url:http://172.27.12.61/group1/m00/00/00/rbaeyvcpwtqawvsvaaaadcvbslg32.html

Storage_upload_slave_by_filename

Group_name=group1, remote_filename=m00/00/00/rbaeyvcpwtqawvsvaaaadcvbslg32_big.html

Source IP address:172.27.12.61

File timestamp=2016-05-04 02:06:50

File size=13

File crc32=3418468952

Example File url:http://172.27.12.61/group1/m00/00/00/rbaeyvcpwtqawvsvaaaadcvbslg32_big.html

To access the uploaded page, execute the command:

Curl http://172.27.12.61/group1/M00/00/00/rBAEYVcpWTqAWVsvAAAADcvBslg32_big.html

The results are as follows:

Test Fdfs

If the error cannot be successfully uploaded, you can use Fdfs_monitor on the storage server to detect errors. Command for Fdfs_monitor/etc/fdfs/storage.conf

The following are the results of using fdfs_monitor detection to be healthy:

[2016-05-04 17:36:37] 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:0

Server_count=1, server_index=0

Tracker server is 172.27.12.65:22122

Group Count:2

Group 1:

Group name = Group1

Disk total space = 36426 MB

Disk free space = 31228 MB

Trunk free space = 0 MB

Storage Server Count = 1

Active Server Count = 1

Storage Server Port = 23000

Storage HTTP Port = 8888

Store Path count = 1

SubDir count per path = 256

Current Write Server index = 0

Current Trunk File ID = 0

Storage 1:

id = 172.27.12.61

IP_ADDR = 172.27.12.61 ACTIVE

HTTP domain =

Version = 5.05

Join time = 2016-05-04 17:05:01

Up time = 2016-05-04 17:05:01

Total Storage = 36426 MB

Free storage = 31228 MB

Upload Priority = 10

Store_path_count = 1

Subdir_count_per_path = 256

Storage_port = 23000

Storage_http_port = 8888

Current_write_path = 0

SOURCE Storage id =

If_trunk_server = 0

Connection.alloc_count = 256

Connection.current_count = 0

Connection.max_count = 0

Total_upload_count = 0

Success_upload_count = 0

Total_append_count = 0

Success_append_count = 0

Total_modify_count = 0

Success_modify_count = 0

Total_truncate_count = 0

Success_truncate_count = 0

Total_set_meta_count = 0

Success_set_meta_count = 0

Total_delete_count = 0

Success_delete_count = 0

Total_download_count = 0

Success_download_count = 0

Total_get_meta_count = 0

Success_get_meta_count = 0

Total_create_link_count = 0

Success_create_link_count = 0

Total_delete_link_count = 0

Success_delete_link_count = 0

Total_upload_bytes = 0

Success_upload_bytes = 0

Total_append_bytes = 0

Success_append_bytes = 0

Total_modify_bytes = 0

Success_modify_bytes = 0

Stotal_download_bytes = 0

Success_download_bytes = 0

Total_sync_in_bytes = 0

Success_sync_in_bytes = 0

Total_sync_out_bytes = 0

Success_sync_out_bytes = 0

Total_file_open_count = 0

Success_file_open_count = 0

Total_file_read_count = 0

Success_file_read_count = 0

Total_file_write_count = 0

Success_file_write_count = 0

Last_heart_beat_time = 2016-05-04 17:31:37

Last_source_update = 1970-01-01 08:00:00

Last_sync_update = 1970-01-01 08:00:00

Last_synced_timestamp = 1970-01-01 08:00:00

Group 2:

Group name = Group2

Disk total space = 36426 MB

Disk free space = 32921 MB

Trunk free space = 0 MB

Storage Server Count = 1

Active Server Count = 1

Storage Server Port = 23000

Storage HTTP Port = 8888

Store Path count = 1

SubDir count per path = 256

Current Write Server index = 0

Current Trunk File ID = 0

Storage 1:

id = 172.27.12.67

IP_ADDR = 172.27.12.67 (CI-DMZ-C03) ACTIVE

HTTP domain =

Version = 5.05

Join time = 2016-05-04 17:33:01

Up time = 2016-05-04 17:33:01

Total Storage = 36426 MB

Free storage = 32921 MB

Upload Priority = 10

Store_path_count = 1

Subdir_count_per_path = 256

Storage_port = 23000

Storage_http_port = 8888

Current_write_path = 0

SOURCE Storage id =

If_trunk_server = 0

Connection.alloc_count = 256

Connection.current_count = 0

Connection.max_count = 0

Total_upload_count = 0

Success_upload_count = 0

Total_append_count = 0

Success_append_count = 0

Total_modify_count = 0

Success_modify_count = 0

Total_truncate_count = 0

Success_truncate_count = 0

Total_set_meta_count = 0

Success_set_meta_count = 0

Total_delete_count = 0

Success_delete_count = 0

Total_download_count = 0

Success_download_count = 0

Total_get_meta_count = 0

Success_get_meta_count = 0

Total_create_link_count = 0

Success_create_link_count = 0

Total_delete_link_count = 0

Success_delete_link_count = 0

Total_upload_bytes = 0

Success_upload_bytes = 0

Total_append_bytes = 0

Success_append_bytes = 0

Total_modify_bytes = 0

Success_modify_bytes = 0

Stotal_download_bytes = 0

Success_download_bytes = 0

Total_sync_in_bytes = 0

Success_sync_in_bytes = 0

Total_sync_out_bytes = 0

Success_sync_out_bytes = 0

Total_file_open_count = 0

Success_file_open_count = 0

Total_file_read_count = 0

Success_file_read_count = 0

Total_file_write_count = 0

Success_file_write_count = 0

Last_heart_beat_time = 2016-05-04 17:31:45

Last_source_update = 1970-01-01 08:00:00

Last_sync_update = 1970-01-01 08:00:00

Last_synced_timestamp = 1970-01-01 08:00:00

Try 5.05 Fastdfs

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.