Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Detailed steps and introduction of configuring dual-tracker load balancing in distributed File system fastdfs_V5.09

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

The following brings you the detailed steps and introduction of distributed file system fastdfs_V5.09 configuring double tracker load balancing, hoping to bring some help to you in practical application. Load balancing involves more things, there are not many theories, and there are many books online. Today, we will use the accumulated experience in the industry to do an answer.

Fastdfs_V5.09 configuration of distributed file system with dual tracker load balancing

Environmental preparation

Operating system:

Centos 7

CVM:

IP:192.168.2.238

IP:192.168.2.239

Software package:

Fastdfs-5.09.tar.gz

Fastdfs-nginx-module_v1.16.tar.gz

Libfastcommon-master

Nginx-1.7.0.tar.gz

Ngx_http_lower_upper_case-master

Note: uniformly place the / home/soft directory and extract it to the current directory

Dependency package:

# yum install gettext gettext-devel libXft libXft-devel libXpm libXpm-devel automake autoconf libXtst-devel gtk+-devel gcc gcc-c++zlib-devel libpng-devel gtk2-devel glib-devel pcre*-y

Install and deploy fastdfs (192.168.2.238192.168.2.239) and related modules and dependent components

1. Install and deploy fastdfs-5.09

# cd fastdfs-5.09#. / make.sh #. / make.sh install

2. Compile, install and deploy nginx

# cd nginx-1.7.0#./configure-user=nginx-group=nginx-prefix=/usr/local/nginx-add-module=/home/soft/fastdfs-nginx-module/src/-add-module=/home/soft/ngx_http_lower_upper_case-master/#make & & make install

3. Install the libfastcommon plug-in

# cd / home/soft/libfastcommon-master/#./make.sh#./make.sh install

4. Create related directories and linked files

# mkdir-p / fastdfst/ {tracker,storage,data1} # ln-s / fastdfs/data M00#ln-s / fastdfs/data1/data M01

Both servers (192.168.2.238192.168.2.239) operate above

Second, configure the relevant conf files

1. Configure the conf file after installing fastdfs, in the / etc/fdfs/ directory

# ll / etc/fdfs/client.confclient.conf.samplehttp.confmime.typesmod_fastdfs.confmod_fastdfs.conf.bakstorage.confstorage.conf.samplestorage_ids.confstorage_ids.conf.sampletracker.conftracker.conf.sample

2. 192.168.2.238 modify the configuration files of tracker.conf, storage.conf, storage_ids.conf, mod_fastdfs.conf and nginx.conf as follows:

# vim / etc/fdfs/tracker.conf

# is this config file disabled# false for enabled# true for disableddisabled=false # bind an address of this host# empty for bind all addresses of this hostbind_addr=192.168.2.238 # the tracker server portport=22124 # connect timeout in seconds# default value is 30sconnect_timeout=30 # network timeout in seconds# default value is 30snetwork_timeout=60 # the base path to store data and log filesbase_path=/fastdfs/tracker/#base_path=/data/fdfs/ # max concurrent connections this server supportedmax_connections=256 # accept thread count# default value is 1# since V4.07accept_threads=1 # work thread count Should = this bytes# default value is 0 (never call fsync) fsync_after_written_bytes=0 # sync log buff to disk every interval seconds# must > 0, default value is 10 secondssync_log_buff_interval=10 # sync binlog buff / cache to disk every interval seconds# default value is 60 secondssync_binlog_buff_interval=10 # sync storage stat info to disk every interval seconds# default value is 300 secondssync_stat_file_interval=300 # thread stack size, should > = 512KB# default value is 512KBthread_stack_size=512KB # the priority as a source server for uploading file.# the lower this value The higher its uploading priority.# default value is 10upload_priority=1 # the NIC alias prefix, such as eth in Linux, you can see it by ifconfig-a # multi aliases split by comma. Empty value means auto set by OS type# default values is emptyif_alias_prefix= # if check file duplicate, when set to true Use FastDHT to store file indexes# 1 or yes: need check# 0 or no: do not check# default value is 0check_file_duplicate=0 # file signature method for check file duplicate## hash: four 32 bits hash code## md5: MD5 signature# default value is hash# since V4.01file_signature_method=hash # namespace for storing file indexes (key-value pairs) # this item must be set when check_file_duplicate is true / onkey_namespace=FastDFS # set keep_alive to 1 to enable persistent connection with FastDHT servers# default value is 0 (short connection) Keep_alive=0 # you can use "# include filename" (not include double quotes) directive to# load FastDHT server list When the filename is a relative path such as# pure filename, the base path is the base path of current/this config file.# must set FastDHT server list when check_file_duplicate is true / on# please see INSTALL of FastDHT for detail##include / home/yuqing/fastdht/conf/fdht_servers.conf # if log to access log# default value is false# since V4.00use_access_log = false# if rotate the access log every day# default value is false# since V4.00rotate_access_log = false# rotate access log time base Time format: Hour:Minute# Hour from 0 to 23, Minute from 0 to 5, default value is 00 to 0 since V4.00access_log_rotate_time=00:00 # if rotate the error log every day# default value is false# since V4.02rotate_error_log = false# rotate error log time base, time format: Hour:Minute# Hour from 0 to 23 Minute from 0 to 5 default value is 00 default value is 0 since V4.02error_log_rotate_time=00:00 # rotate access log when the log file exceeds this size# 0 means never rotates log file by log file size# default value is since V4.02rotate_access_log_size = "rotate error log when the log file exceeds this size# 0 means never rotates log file by log file size# default value is" since V4.02rotate_error_log_size = "if skip the invalid record when sync file# default value is false#" Since V4.02file_sync_skip_invalid_record=false # if use connection pool# default value is false# since V4.05use_connection_pool = false# connections whose the idle time exceeds this time will be closed# unit: second# default value is 360 since V4.05connection_pool_max_idle_time = 360 use the ip address of this storage server if domain_name is empty # else this domain name will ocur in the url redirected by the tracker serverhttp.domain_name= # the port of the web server on this storage serverhttp.server_port=81

# vim / etc/fdfs/storage_ids.conf

# # 100001 group1 192.168.0.196# 100002 group1 192.168.0.116200050 g1 192.168.2.239200051 g1 192.168.2.238

# vim / etc/fdfs/mod_fastdfs.conf

# connect timeout in seconds# default value is 30sconnect_timeout=2 # network recv and send timeout in seconds# default value is 30snetwork_timeout=30 # the base path to store log filesbase_path=/tmp # if load FastDFS parameters from tracker server# since V1.1 "default value is falseload_fdfs_parameters_from_tracker=false # storage sync file max delay seconds# same as tracker.conf# valid only when load_fdfs_parameters_from_tracker is false# since V1.1" default value is 86400 seconds (one day) storage_sync_file_max_delay = 86400 # If use storage ID instead of IP address# same as tracker.conf# valid only when load_fdfs_parameters_from_tracker is false# default value is false# since V1.13use_storage_id = false# specify storage ids filename Can use relative or absolute path# same as tracker.conf# valid only when load_fdfs_parameters_from_tracker is false# since V1.13storage_ids_filename = storage_ids.conf # 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.2.239:22124tracker_server=192.168.2.238:22124 # the port of the local storage server# the default value is 23000storage_server_port=23000 # the group name of the local storage servergroup_name=g1 # if the url / uri including the group name# set to false when uri like / M00/00/00/xxx# set to true when uri like ${group_name} / M00/00/00/xxx Such as group1/M00/xxx# default value is falseurl_have_group_name = true # path (disk or mount point) count, default value is must same as storage.confstore_path_count=2 # 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=/fastdfsstore_path3=/fastdfs/data1#store_path5=/data/data1#store_path3=/home/yuqing/fastdfs1 # standard log level as syslog, case insensitive Value list:### emerg for emergency### alert### crit for critical### error### warn for warning### notice### info### debuglog_level=info # set the log filename, such as / usr/local/apache2/logs/mod_fastdfs.log# empty for output to stderr (apache and nginx error_log file) log_filename= # response mode when the file not exist in the local file system## proxy: get the content from other storage server Then send to client## redirect: redirect to the original storage server (HTTP Header is Location) response_mode=proxy # the NIC alias prefix, such as eth in Linux, you can see it by ifconfig-a # multi aliases split by comma. Empty value means auto set by OS type# this paramter used to get all ip address of the local host# default values is emptyif_alias_prefix= # use "# include" directive to include HTTP config file# NOTE: # include is an include directive Do NOT remove the # before include#include http.conf # if support flv# default value is false# since v1.15flv_support = true # flv file extension name# default value is flv# since v1.15flv_extension = flv# set the group count# set to none zero to support multi-group# set to 0 for single group only# groups settings section as [group1], [group2],..., [groupN] # default value is "since v1.14group_count =" group settings for group# "since v1.1" when support multi-group Uncomment following section# [group1] # group_name=group1#storage_server_port=23000#store_path_count=2#store_path0=/home/yuqing/fastdfs#store_path3=/home/yuqing/fastdfs1 # group settings for group # 2#s ince v1.14# when support multi-group, uncomment following section as neccessary# [group2] # group_name=group2#storage_server_port=23000#store_path_count=1#store_path0=/home/yuqing/fastdfs

# vim / usr/local/nginx/conf/nginx.conf

User root;worker_processes 1; # error_log logs/error.log;#error_log logs/error.log notice;#error_log logs/error.log info; # pid logs/nginx.pid; 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 logs/access.log main; client_max_body_size 10m; sendfile on; # tcp_nopush on # keepalive_timeout 0; keepalive_timeout 65; # gzip on; server {listen 81; server_name localhost; # charset koi8-r; # access_log logs/host.access.log main; location / g1/M00 {root / fastdfs/data; ngx_fastdfs_module; index index.html index.htm Client_max_body_size 10m;} location / g1/M01 {root / fastdfs/data1/data; ngx_fastdfs_module; index index.html index.htm; client_max_body_size 10m;} # location / {# lower $lower_uri "$request_uri" # rewrite. * $lower_uri break; # root / var/www/static; # index index.html index.htm; #} # error_page 404 / 404.html; # redirect server error pages to the static page / 50x.html # error_page 500 502 503 504 / 50x.html Location = / 50x.html {root html;} # proxy the PHP scripts to Apache listening on 127.0.0.1 50x.html 80 # # location ~\ .php$ {# proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1 pass the PHP scripts to FastCGI server listening on 9000 # # location ~\. Php$ {# root html; # fastcgi_pass 127.0.0.1 php$ 9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME / scripts$fastcgi_script_name; # include fastcgi_params #} # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # # location ~ /\ .ht {# deny all; #} # another virtual host using mix of IP-, name-, and port-based configuration # server {listen 8000; server_name _ Location / {root html; index index.html index.htm;}} server {listen 8001; server_name _; location / {root html; index index2.html index2.htm;}} # HTTPS server # # server {# listen 443 ssl # server_name localhost; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m; # ssl_session_timeout 5m; # ssl_ciphers HIGHV / null ssl_session_timeout MD5; # ssl_prefer_server_ciphers on; # location / {# root html # index index.html index.htm; #} #}}

3. 192.168.2.239 modify the configuration files of tracker.conf, storage.conf, storage_ids.conf, mod_fastdfs.conf and nginx.conf as follows:

# vim / etc/fdfs/tracker.conf

# is this config file disabled# false for enabled# true for disableddisabled=false # bind an address of this host# empty for bind all addresses of this hostbind_addr=192.168.2.239 # the tracker server portport=22124 # connect timeout in seconds# default value is 30sconnect_timeout=30 # network timeout in seconds# default value is 30snetwork_timeout=60 # the base path to store data and log filesbase_path=/fastdfs/tracker/#base_path=/data/fdfs/ # max concurrent connections this server supportedmax_connections=256 # accept thread count# default value is 1# since V4.07accept_threads=1 # work thread count Should = this bytes# default value is 0 (never call fsync) fsync_after_written_bytes=0 # sync log buff to disk every interval seconds# must > 0, default value is 10 secondssync_log_buff_interval=10 # sync binlog buff / cache to disk every interval seconds# default value is 60 secondssync_binlog_buff_interval=10 # sync storage stat info to disk every interval seconds# default value is 300 secondssync_stat_file_interval=300 # thread stack size, should > = 512KB# default value is 512KBthread_stack_size=512KB # the priority as a source server for uploading file.# the lower this value The higher its uploading priority.# default value is 10upload_priority=1 # the NIC alias prefix, such as eth in Linux, you can see it by ifconfig-a # multi aliases split by comma. Empty value means auto set by OS type# default values is emptyif_alias_prefix= # if check file duplicate, when set to true Use FastDHT to store file indexes# 1 or yes: need check# 0 or no: do not check# default value is 0check_file_duplicate=0 # file signature method for check file duplicate## hash: four 32 bits hash code## md5: MD5 signature# default value is hash# since V4.01file_signature_method=hash # namespace for storing file indexes (key-value pairs) # this item must be set when check_file_duplicate is true / onkey_namespace=FastDFS # set keep_alive to 1 to enable persistent connection with FastDHT servers# default value is 0 (short connection) Keep_alive=0 # you can use "# include filename" (not include double quotes) directive to# load FastDHT server list When the filename is a relative path such as# pure filename, the base path is the base path of current/this config file.# must set FastDHT server list when check_file_duplicate is true / on# please see INSTALL of FastDHT for detail##include / home/yuqing/fastdht/conf/fdht_servers.conf # if log to access log# default value is false# since V4.00use_access_log = false# if rotate the access log every day# default value is false# since V4.00rotate_access_log = false# rotate access log time base Time format: Hour:Minute# Hour from 0 to 23, Minute from 0 to 5, default value is 00 to 0 since V4.00access_log_rotate_time=00:00 # if rotate the error log every day# default value is false# since V4.02rotate_error_log = false# rotate error log time base, time format: Hour:Minute# Hour from 0 to 23 Minute from 0 to 5 default value is 00 default value is 0 since V4.02error_log_rotate_time=00:00 # rotate access log when the log file exceeds this size# 0 means never rotates log file by log file size# default value is since V4.02rotate_access_log_size = "rotate error log when the log file exceeds this size# 0 means never rotates log file by log file size# default value is" since V4.02rotate_error_log_size = "if skip the invalid record when sync file# default value is false#" Since V4.02file_sync_skip_invalid_record=false # if use connection pool# default value is false# since V4.05use_connection_pool = false# connections whose the idle time exceeds this time will be closed# unit: second# default value is 360 since V4.05connection_pool_max_idle_time = 360 use the ip address of this storage server if domain_name is empty # else this domain name will ocur in the url redirected by the tracker serverhttp.domain_name= # the port of the web server on this storage serverhttp.server_port=81

# vim / etc/fdfs/storage_ids.conf

# # 100001 group1 192.168.0.196# 100002 group1 192.168.0.116200050 g1 192.168.2.239200051 g1 192.168.2.238

# vim / etc/fdfs/mod_fastdfs.conf

# connect timeout in seconds# default value is 30sconnect_timeout=2 # network recv and send timeout in seconds# default value is 30snetwork_timeout=30 # the base path to store log filesbase_path=/tmp # if load FastDFS parameters from tracker server# since V1.1 "default value is falseload_fdfs_parameters_from_tracker=false # storage sync file max delay seconds# same as tracker.conf# valid only when load_fdfs_parameters_from_tracker is false# since V1.1" default value is 86400 seconds (one day) storage_sync_file_max_delay = 86400 # If use storage ID instead of IP address# same as tracker.conf# valid only when load_fdfs_parameters_from_tracker is false# default value is false# since V1.13use_storage_id = false# specify storage ids filename Can use relative or absolute path# same as tracker.conf# valid only when load_fdfs_parameters_from_tracker is false# since V1.13storage_ids_filename = storage_ids.conf # 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.2.239:22124tracker_server=192.168.2.238:22124 # the port of the local storage server# the default value is 23000storage_server_port=23000 # the group name of the local storage servergroup_name=g1 # if the url / uri including the group name# set to false when uri like / M00/00/00/xxx# set to true when uri like ${group_name} / M00/00/00/xxx Such as group1/M00/xxx# default value is falseurl_have_group_name = true # path (disk or mount point) count, default value is must same as storage.confstore_path_count=2 # 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=/fastdfsstore_path3=/fastdfs/data1#store_path5=/data/data1#store_path3=/home/yuqing/fastdfs1 # standard log level as syslog, case insensitive Value list:### emerg for emergency### alert### crit for critical### error### warn for warning### notice### info### debuglog_level=info # set the log filename, such as / usr/local/apache2/logs/mod_fastdfs.log# empty for output to stderr (apache and nginx error_log file) log_filename= # response mode when the file not exist in the local file system## proxy: get the content from other storage server Then send to client## redirect: redirect to the original storage server (HTTP Header is Location) response_mode=proxy # the NIC alias prefix, such as eth in Linux, you can see it by ifconfig-a # multi aliases split by comma. Empty value means auto set by OS type# this paramter used to get all ip address of the local host# default values is emptyif_alias_prefix= # use "# include" directive to include HTTP config file# NOTE: # include is an include directive Do NOT remove the # before include#include http.conf # if support flv# default value is false# since v1.15flv_support = true # flv file extension name# default value is flv# since v1.15flv_extension = flv# set the group count# set to none zero to support multi-group# set to 0 for single group only# groups settings section as [group1], [group2],..., [groupN] # default value is "since v1.14group_count =" group settings for group# "since v1.1" when support multi-group Uncomment following section# [group1] # group_name=group1#storage_server_port=23000#store_path_count=2#store_path0=/home/yuqing/fastdfs#store_path3=/home/yuqing/fastdfs1 # group settings for group # 2#s ince v1.14# when support multi-group, uncomment following section as neccessary# [group2] # group_name=group2#storage_server_port=23000#store_path_count=1#store_path0=/home/yuqing/fastdfs

# vim / usr/local/nginx/conf/nginx.conf

User root;worker_processes 1; # error_log logs/error.log;#error_log logs/error.log notice;#error_log logs/error.log info; # pid logs/nginx.pid; 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 logs/access.log main; client_max_body_size 10m; sendfile on; # tcp_nopush on # keepalive_timeout 0; keepalive_timeout 65; # gzip on; server {listen 81; server_name localhost; # charset koi8-r; # access_log logs/host.access.log main; location / g1/M00 {# root / fastdfs; root / fastdfs/data; ngx_fastdfs_module; index index.html index.htm Client_max_body_size 10m;} location / g1/M01 {root / fastdfs/data1/data; # root / fastdfs/data1/data; ngx_fastdfs_module; index index.html index.htm; client_max_body_size 10m } # location / {# lower $lower_uri "$request_uri"; # rewrite. * $lower_uri break; # root / var/www/static; # index index.html index.htm; #} # error_page 404 / 404.html # redirect server error pages to the static page / 50x.html # error_page 500 502 503 504 / 50x.html; location = / 50x.html {root html;} # proxy the PHP scripts to Apache listening on 127.0.0.1 50x.html 80 # location ~\ .php$ {# proxy_pass #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1 pass the PHP scripts to FastCGI server listening on 9000 # # location ~\. Php$ {# root html; # fastcgi_pass 127.0.0.1 php$ 9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME / scripts$fastcgi_script_name; # include fastcgi_params #} # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # # location ~ /\ .ht {# deny all; #} # another virtual host using mix of IP-, name-, and port-based configuration # server {listen 8000; server_name _ Location / {root html; index index.html index.htm;}} server {listen 8001; server_name _; location / {root html; index index2.html index2.htm;}} # HTTPS server # # server {# listen 443 ssl # server_name localhost; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m; # ssl_session_timeout 5m; # ssl_ciphers HIGHV / null ssl_session_timeout MD5; # ssl_prefer_server_ciphers on; # location / {# root html # index index.html index.htm; #} #}}

4. 192.168.2.238 and 192.168.2.239 start related services

# / etc/init.d/fdfs_trackerd start# / etc/init.d/fdfs_storaged start# / usr/local/nginx/sbin/nginx# ss-tnlp (check whether port 22124 of tracker service, port 23000 of storage service and port 81 of nginx service are normal)

3. Test upload access

1) upload the 239.jpg image on the fastdfs server (192.168.2.239) and test the access in the browser through the returned path

[root@localhost ~] # fdfs_upload_file / etc/fdfs/client.conf / root/239.jpg

G1/M00/00/32/wKgC71kaaGqAbJDqAACKBbw6aXc203.jpg

Access test

Http://192.168.2.238:81/g1/M00/00/32/wKgC71kaaGqAbJDqAACKBbw6aXc203.jpg

Http://192.168.2.239:81/g1/M00/00/32/wKgC71kaaGqAbJDqAACKBbw6aXc203.jpg

The test returns a normal picture (see the following figure for details)

2) upload the 238.jpg image on the fastdfs server (192.168.2.238) and test the access in the browser through the returned path

[root@localhost ~] # fdfs_upload_file / etc/fdfs/client.conf / root/238.jpg

G1/M00/00/32/wKgC71kabh-AbUECAAC8W3Iysrc946.jpg

Access test

Http://192.168.2.238:81/g1/M00/00/32/wKgC71kabh-AbUECAAC8W3Iysrc946.jpg

Http://192.168.2.239:81/g1/M00/00/32/wKgC71kabh-AbUECAAC8W3Iysrc946.jpg

The test returns a normal picture (see the following figure for details)

IV. Summary of common Qphra

1. When the fastdfs-nginx-module module is installed, an error will be reported during make.

Root/fastdfs-nginx-module/src//common.c:21:25: fatal error: fdfs_define.h: No such file or directory

# include "fdfs_define.h"

^

Compilation terminated.

Make [1]: * * [objs/addon/src/ngx_http_fastdfs_module.o] Error 1

Reason: the header file of the fastdfs plug-in that compiles and installs nginx cannot be found, because the system will go to / usr/local/include when compiling nginx, while compiling and installing fastdfs-nginx-module will be saved in the / usr/include directory by default.

Solution:

Vim / root/fastdfs-nginx-module/src/config

CORE_INCS= "$CORE_INCS / usr/local/include/fastdfs / usr/local/include/fastcommon/"

CORE_LIBS= "$CORE_LIBS-L/usr/lib-lfastcommon-lfdfsclient"

And establish a link:

# ln-s / usr/include/fast* / usr/local/include/

# ln-s / usr/lib64/libfastcommon.so / usr/local/lib/libfastcommon.so

# ln-s / usr/lib64/libfastcommon.so / usr/lib/libfastcommon.so

# ln-s / usr/lib64/libfdfsclient.so / usr/local/lib/libfdfsclient.so

# ln-s / usr/lib64/libfdfsclient.so / usr/lib/libfdfsclient.so

Recompile and install

2. In fastdfs_5.09, prompt programming when executing. / make.sh compilation

Cc-Wall-D_FILE_OFFSET_BITS=64-D_GNU_SOURCE-g-O-DDEBUG_FLAG-c-o. / common/fdfs_global.o.. / common/fdfs_global.c-I../common-I../tracker-I/usr/include/fastcommon

.. / common/fdfs_global.c:20:20: fatal error: logger.h: No such file or directory

# include "logger.h"

^

Compilation terminated.

Make: * [.. / common/fdfs_global.o] Error 1,

Solution:

# wget https://github.com/happyfish300/libfastcommon/archive/master.zip

# unzip master.zip

# cd libfastcommon-master/

#. / make.sh

#. / make.sh install

3. Unable to start after adding storage storage server

[2017-05-12 17:09:40] ERROR-file: tracker_proto.c, line: 48, server: 192.168.2.239 line 22124, response status 2! = 0

[2017-05-12 17:09:40] CRIT-file: storage_func.c, line: 1886, get my server id from tracker server fail, errno: 2, error info: No such file or directory

Reason: storage_ids.conf files are enabled to restrict the concept of the same domain or computer room. The server ip of tracker and storage must be in the same domain.

Modify to / etc/fdfs/storage_ids.conf as follows:

[root@localhost fdfs] # cat storage_ids.conf

#

# 100001 group1 192.168.0.196

# 100002 group1 192.168.0.116

200050 g1 192.168.2.239

200051 g1 192.168.2.238

4. (fastdfs version v5.09) A scenario occurs in the actual production environment: when there is only one tracker in the cluster (10.x.x.3 in this example, and currently the main leader), add a new tracker (for example, this example 10.x.x.6 is a newly added tracker), and start the tracker service to view the # tail-f / data/tracker/logs/trackerd.log log. The error is as follows:

[2017-05-19 23:04:33] ERROR-file: tracker_mem.c, line: 4277, get sys files from other trackers fail, errno: 2

[2017-05-19 23:04:52] ERROR-file: tracker_proto.c, line: 48, server: 10.x.x.3:22122, response status 5! = 0

[2017-05-19 23:04:52] INFO-file: tracker_mem.c, line: 4213, sys files loaded from tracker server 10.x.x.3:22122

[2017-05-19 23:04:52] ERROR-file: tracker_mem.c, line: 596, in the file "/ data/tracker/data/storage_groups_new.dat", item "group_count" is not found

If you also view the 10.x.x.3 log # tail-f / fastdfs/data/tracker/logs/trackerd.log, you will also report the following error:

[2017-05-19 23:01:54] ERROR-file: tracker_service.c, line: 2008, client ip: 10.x.x.6, read bytes: 229! = expect bytes: 2008

[2017-05-19 23:02:04] ERROR-file: tracker_service.c, line: 2008, client ip: 10.x.x.6, read bytes: 229! = expect bytes: 2008

Reason: check out Yu Da's source code community or Google search that multiple tracker exists on bug,github with a newer version of V5.10 that has fixed this problem. However, it has been verified that the problem may occur when the newly added tracker monitors stroage synchronization when the cluster synchronization is different.

Solution:

1) upgrade fastdfs version to V5.10 or above

2) restart all fdfs_stroaged services first, then recommend pausing the current main leader, and then clearing the / data/stracker/data/ directory newly added to tracker

For all the * .bat files, and then start the newly added tracker service, the following information may appear (the following is the prompt in the example):

[2017-05-24 02:38:34] ERROR-file: tracker_mem.c, line: 596,in the file "/ data/tracker/data/storage_groups_new.dat", item "group_count" is not found

[2017-05-24 02:38:34] ERROR-file: tracker_mem.c, line: 4277, get sys files from other trackers fail, errno: 2

[2017-05-24 02:38:42] ERROR-file: tracker_service.c, line: 883, client ip: 10.x.x.3, leader 10.x.x.3:22122 not exist

[2017-05-24 02:38:45] ERROR-file: tracker_service.c, line: 883, client ip: 10.x.x.3, leader 10.x.x.3:22122 not exist

[2017-05-24 02:38:55] ERROR-file: tracker_service.c, line: 883, client ip: 10.x.x.3, leader 10.x.x.3:22122 not exist

[2017-05-24 02:38:59] INFO-file: tracker_relationship.c, line: 383, selecting leader...

[2017-05-24 02:38:59] INFO-file: tracker_relationship.c, line: 401, I am the new tracker leader 10.x.x.6:22122 # then indicates that the new tracker has been elected as the new master leader

In the process of electing a new tracker as a new leader, it is estimated that it will take about 1-2 minutes to wait. It should be after monitoring and confirming that the old leader in the original session does not exist before determining the election of the new leader. Check the above information and then start the old leader (10.x.x.3 in this example) tracker service, and normally you will see the following log

[2017-05-24 02:39:00] INFO-file: tracker_service.c, line: 969, the tracker leader is 10.x.x.6:22122

.

This shows that the new tracker has been identified in the cluster, and the load and failover under dual tracker have been realized.

Fifth, simulated fault drills

1. The current master leader is 192.168.2.238. You can view the status of the tracker log as follows:

# tail-f / fastdfs/tracker/log/tracker.log [2017-05-18 17:13:42] INFO-file: tracker_relationship.c, line: 401, I am the new tracker leader 192.168.2.238virtual 22124

2. Simulated failure stop 192.168.2.238 tracker service

# / etc/init.d/fdfs_trackerd stopStopping fdfs_trackerd (via systemctl): [OK]

3. Check the 192.168.2.239 tracker tracker log. At this time, 192.168.2.239 is upgraded to the new tracker, and the tracker of 192.168.2.238 automatically becomes standby.

# tail-f / fastdfs/tracker/log/tracker.log [2017-05-18 17:17:58] INFO-file: tracker_relationship.c, line: 401, I am the new tracker leader 192.168.2.239 virtual 22124

# start the 192.168.2.238 stracker service, and log shows

# / etc/init.d/fdfs_trackerd start#tail-f / fastdfs/tracker/log/tracker.log [2017-05-18 17:20:44] INFO-FastDFS v5.09, base_path=/fastdfs/tracker, run_by_group=, run_by_user=, connect_timeout=30s, network_timeout=60s, port=22124, bind_addr=192.168.2.238, max_connections=256, accept_threads=1, work_threads=4, min_buff_size=8192, max_buff_size=131072, store_lookup=2, store_group=, store_server=2, store_path=0 Reserved_storage_space=10.00%, download_server=0, allow_ip_count=-1, sync_log_buff_interval=10s, check_active_interval=120s, thread_stack_size=64 KB, storage_ip_changed_auto_adjust=1, storage_sync_file_max_delay=86400s, storage_sync_file_max_time=300s, use_trunk_file=0, slot_min_size=256, slot_max_size=16 MB, trunk_file_size=64 MB, trunk_create_file_advance=0, trunk_create_file_time_base=02:00, trunk_create_file_interval=86400 Trunk_create_file_space_threshold=20 GB, trunk_init_check_occupying=0, trunk_init_reload_from_binlog=0, trunk_compress_binlog_min_interval=0, use_storage_id=1, id_type_in_filename=ip, storage_id_count=2, rotate_error_log=0, error_log_rotate_time=00:00, rotate_error_log_size=0, log_file_keep_days=0, store_slave_file_use_link=0, use_connection_pool=0 G_connection_pool_max_idle_time=3600s [2017-05-18 17:21:06] INFO-file: tracker_relationship.c, line: 383, selecting leader... [2017-05-18 17:21:06] INFO-file: tracker_relationship.c, line: 422, the tracker leader 192.168.2.239

4. Test whether uploading and browsing pictures are normal.

Http://192.168.2.239:81/g1/M00/00/32/wKgC71kabh-AbUECAAC8W3Iysrc946.jpg

When highly available, it is recommended to use domain name polling to access the storage server, such as file.abc.com + haroxy load to the back-end two stroage storage servers

Acl fileserver hdr_beg (host)-I file.abc.comuse_backend file.abc.com if fileserver backend file.abc.commode httpoption forwardforoption httplogbalance roundrobin#reqirep ^ Host:\ www.1card1.cn Host:\ file.abc.comserver db1 192.168.2.238 cookie files checkserver db2 81 cookie files checkserver db2 192.168.2.239 www.1card1.cn Host 81 cookie files check

After reading the detailed steps and introduction of the distributed file system fastdfs_V5.09 configuring double tracker load balancing, if you have anything else you need to know, you can find what you are interested in in the industry information or find our professional and technical engineer to answer, the technical engineer has more than ten years of experience in the industry. Official website link www.yisu.com

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report