1.CentOS7 FastDFS build
Previously downloaded a good set of tools to use, here you can start the installation:
If a problem occurs during installation, you can download the tools I provide current test by package:
1.1 Installation libfastcommon
After a successful installation decompression libfastcommon-master.zip
unzip libfastcommon-master.zip
[root@sybmfw12-lnsy libfastcommon-1.0.36]# ll
drwxr-xr-x. 2 root root 4096 4月 5 2017 doc
-rw-r--r--. 1 root root 8005 4月 5 2017 HISTORY
-rw-r--r--. 1 root root 566 4月 5 2017 INSTALL
-rw-r--r--. 1 root root 1606 4月 5 2017 libfastcommon.spec
-rwxr-xr-x. 1 root root 3099 4月 5 2017 make.sh
drwxr-xr-x. 2 root root 4096 4月 5 2017 php-fastcommon
-rw-r--r--. 1 root root 2763 4月 5 2017 README
drwxr-xr-x. 3 root root 4096 11月 8 12:30 src
When we ./make.sh time may be prompted, gcc command not found.
With yum install gcc:
yum -y install gcc-c++
This time were executed ./make.sh and ./make.sh install, normal circumstances can be successful.
libfastcommon default will be installed to /usr/lib64/libfastcommon.so but FastDFS main program was under / usr / local / lib directory
this time we will build a soft link, and in fact the equivalent shortcut on the windows .
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
1.2 Installation FastDFS
FastDFS extracting installation package
unzip fastdfs-5.11.zip
After extracting see:
[root@sybmfw12-lnsy fastdfs-5.11]# ll
总用量 136
drwxr-xr-x. 3 root root 4096 11月 8 12:32 client
drwxr-xr-x. 2 root root 4096 11月 8 12:32 common
drwxr-xr-x. 2 root root 4096 6月 3 21:09 conf
-rw-r--r--. 1 root root 35067 6月 3 21:09 COPYING-3_0.txt
-rw-r--r--. 1 root root 3171 6月 3 21:09 fastdfs.spec
-rw-r--r--. 1 root root 33100 6月 3 21:09 HISTORY
drwxr-xr-x. 2 root root 4096 6月 3 21:09 init.d
-rw-r--r--. 1 root root 7755 6月 3 21:09 INSTALL
-rwxr-xr-x. 1 root root 5548 6月 3 21:09 make.sh
drwxr-xr-x. 2 root root 4096 6月 3 21:09 php_client
-rw-r--r--. 1 root root 2380 6月 3 21:09 README.md
-rwxr-xr-x. 1 root root 1768 6月 3 21:09 restart.sh
-rwxr-xr-x. 1 root root 1680 6月 3 21:09 stop.sh
drwxr-xr-x. 4 root root 4096 11月 8 12:32 storage
drwxr-xr-x. 2 root root 4096 6月 3 21:09 test
drwxr-xr-x. 2 root root 4096 11月 8 12:32 track
进到刚解压的目录:
cd fastdfs-5.11
./make.sh
./make.sh install
If no error then it succeeded. FastDFS installation log will be prompted to install under / etc / fdfs directory.
After a successful installation directory view:
[root@sybmfw12-lnsy fastdfs-5.11]# ll /etc/fdfs/
-rw-r--r--. 1 root root 1463 11月 8 12:52 client.conf.sample
-rw-r--r--. 1 root root 7938 11月 8 14:55 storage.conf.sample
-rw-r--r--. 1 root root 7397 11月 8 12:36 tracker.conf.sample
We need these three examples copy of the document, remove .sample
cp client.conf.sample client.conf
cp storage.conf.sample storage.conf
cp tracker.conf.sample tracker.conf
FastDFS end of the installation.
1.3 Installation tracker
1.3.1 Creating tracker working directory
This directory can be customized, used to save the data and log tracker
according to personal habits, I created the following directories:
mkdir /opt/fastdfs_tracker
Configuring tracker
vim /etc/fdfs/tracker.conf
open to focus on the following four configuration:
1.disabled = false
2.port = 22122 # The default port number
3.base_path = / opt / fastdfs_tracker # directory I just created
4.http. server_port = 8080 # The default port is 8080
5.bind_addr = 0.0.0.0 listening address
Modify the file as follows:
disabled=false
bind_addr= 0.0.0.0
port=22122
connect_timeout=30
network_timeout=60
base_path=/opt/fastdfs_tracker
max_connections=512
accept_threads=1
work_threads=4
min_buff_size = 8KB
max_buff_size = 128KB
store_lookup=2
store_group=group2
store_server=0
store_path=0
download_server=0
reserved_storage_space = 10%
log_level=info
run_by_group=
run_by_user=
allow_hosts=*
sync_log_buff_interval = 10
check_active_interval = 120
thread_stack_size = 64KB
storage_ip_changed_auto_adjust = true
storage_sync_file_max_delay = 86400
storage_sync_file_max_time = 300
use_trunk_file = false
slot_min_size = 256
slot_max_size = 16MB
trunk_file_size = 64MB
trunk_create_file_advance = false
trunk_create_file_time_base = 02:00
trunk_create_file_interval = 86400
trunk_create_file_space_threshold = 20G
trunk_init_check_occupying = false
trunk_init_reload_from_binlog = false
trunk_compress_binlog_min_interval = 0
use_storage_id = false
storage_ids_filename = storage_ids.conf
id_type_in_filename = ip
store_slave_file_use_link = false
rotate_error_log = false
error_log_rotate_time=00:00
rotate_error_log_size = 0
log_file_keep_days = 0
use_connection_pool = false
connection_pool_max_idle_time = 3600
http.server_port=8080
http.check_alive_interval=30
http.check_alive_type=tcp
http.check_alive_uri=/status.html
1.3.3 Start tracker
After saving the configuration startup tracker, the command is as follows:
service fdfs_trackerd start
After the success should see:
[root @ sybmfw12-lnsy fastdfs-5.11] #service fdfs_trackerd start
Starting fdfs_trackerd (via systemctl): [OK]
Conduct tracker directory just created, found that more data directory two directories and log
[root@sybmfw12-lnsy fastdfs-5.11]# ll /opt/fastdfs_tracker/
drwxr-xr-x. 2 root root 4096 11月 8 15:01 data
drwxr-xr-x. 2 root root 4096 11月 8 12:37 logs
Finally, we need to join startup tracker
echo "service fdfs_trackerd start" |tee -a /etc/rc.d/rc.local
Look at the port listening situation tracker
[root @ sybmfw12-lnsy fastdfs-5.11] # netstat -unltp | grep FDF
TCP 0 0 0.0.0.0:22122 0.0.0.0:* LIST 70382 / fdfs_trackerd
Port 22122 listens success.
1.4 Installation storage
storage installation and tracker are very similar.
1.4.1 working directory for the storage configuration
The difference is that the tracker because storage also need a directory to store data, so I also built more than two directories fastdfs_storage_data, fastdfs_storage
Here is my directory structure:
[root@sybmfw12-lnsy fastdfs-5.11]# ll /opt/
drwxr-xr-x. 4 root root 4096 11月 8 12:48 fastdfs_storage
drwxr-xr-x. 3 root root 4096 11月 8 15:02 fastdfs_storage_data
drwxr-xr-x. 4 root root 4096 11月 8 12:37 fastdfs_tracker
1.4.2 modify storage configuration file
Modify storage.conf
= False 1.disabled
2.group_name # = group1 group name, modified according to the actual situation
3.port = 23000 # Set storage port number, the default is 23000, storage port number must be consistent with a group of
4.base_path = / opt / fastdfs_storage # set the log storage data file and directory
5.store_path_count = 1 # number of storage paths, and the need to match the number of store_path
6.store_path0 = / opt / fastdfs_storage_data # actual file storage path
7.tracker_server = 172.20.132.57: 22122 # I ip address CentOS7 of
8.http.server_port = 8888 # set http port
Modify the file as follows:
disabled=false
group_name=group1
bind_addr= 0.0.0.0
client_bind=true
port=23000
connect_timeout=30
network_timeout=60
heart_beat_interval=30
stat_report_interval=60
base_path=/opt/fastdfs_storage
max_connections=256
buff_size = 256KB
accept_threads=1
work_threads=4
disk_rw_separated = true
disk_reader_threads = 1
disk_writer_threads = 1
sync_wait_msec=50
sync_interval=0
sync_start_time=00:00
sync_end_time=23:59
write_mark_file_freq=500
store_path_count=1
store_path0=/opt/fastdfs_storage_data
subdir_count_per_path=256
tracker_server=172.20.132.57:22122
log_level=info
run_by_group=
run_by_user=
allow_hosts=*
file_distribute_path_mode=0
file_distribute_rotate_count=100
fsync_after_written_bytes=0
sync_log_buff_interval=10
sync_binlog_buff_interval=10
sync_stat_file_interval=300
thread_stack_size=512KB
upload_priority=10
if_alias_prefix=
check_file_duplicate=0
file_signature_method=hash
key_namespace=FastDFS
keep_alive=0
use_access_log = false
rotate_access_log = false
access_log_rotate_time=00:00
rotate_error_log = false
error_log_rotate_time=00:00
rotate_access_log_size = 0
rotate_error_log_size = 0
log_file_keep_days = 0
file_sync_skip_invalid_record=false
use_connection_pool = false
connection_pool_max_idle_time = 3600
http.domain_name=
http.server_port=8888
Create a soft reference modified save
ln -s /usr/bin/fdfs_storaged /usr/local/bin
1.4.3 Start storage
service fdfs_storaged start
Starting fdfs_storaged (via systemctl): [OK]
Similarly, setting boot:
modify rc.local
echo "service fdfs_storaged start" |tee -a /etc/rc.d/rc.local
Check whether the service is started
[root @ sybmfw12-lnsy fastdfs-5.11] #netstat -unltp | grep FDF
TCP 0 0 0.0.0.0:22122 0.0.0.0:* LIST 2231 / fdfs_trackerd
TCP 0 0 0.0.0.0:23000 0.0.0.0:* LIST 2323 / fdfs_storaged
Service is started normally.
1.4.4 check Integration
Here, fastdfs things have been installed, and finally we have to determine what, storage is registered to the tracker to go.
View command:
/ Usr / bin / fdfs_monitor /etc/fdfs/storage.conf
After the success can be seen:
ip_addr = 172.20.132.57 (localhost.localdomain) the ACTIVE
[root@sybmfw12-lnsy fastdfs-5.11]# /usr/bin/fdfs_monitor /etc/fdfs/storage.conf
[2017-11-08 18:05:55] DEBUG - base_path=/opt/fastdfs_storage, 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.20.132.57:22122
group count: 1
Group 1:
group name = group1
disk total space = 34140 MB
disk free space = 29282 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.20.132.57
ip_addr = 172.20.132.57 (sybmfw12-lnsy) ACTIVE
http domain =
version = 5.11
join time = 2017-11-08 12:48:05
up time = 2017-11-08 15:02:04
total storage = 34140 MB
free storage = 29282 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 = 1
total_upload_count = 2
success_upload_count = 2
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 = 179368
success_upload_bytes = 179368
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 = 2
success_file_open_count = 2
total_file_read_count = 0
success_file_read_count = 0
total_file_write_count = 2
success_file_write_count = 2
last_heart_beat_time = 2017-11-08 18:05:37
last_source_update = 2017-11-08 15:24:21
last_sync_update = 1970-01-01 08:00:00
last_synced_timestamp = 1970-01-01 08:00:00