FastDFS installation and deployment
#
# FastDFS Github address: https://github.com/happyfish200/fastdfs
# introduction to FastDFS: http://www.oschina.net/p/fastdfs/
# distributed file system and FastDFS: https://chulung.com/article/22
# High availability Architecture for distributed Architecture: http://www.cnblogs.com/hujihon/p/5709556.html
# Experimental topology diagram (logic diagram)
# Software download
#
# libfastcommon download address: https://github.com/happyfish200/libfastcommon/archive/master.zip
# FastDFS: download address: https://github.com/happyfish200/fastdfs/archive/master.zip
#
Installation (all three hosts must be installed)
[root@Storage_1 ~] # yum install-y gcc-c++ [root@Storage_1 ~] # wget https://github.com/happyfish200/libfastcommon/archive/master.zip[root@Storage_1 ~] # unzip master.zip [root@Storage_1 ~] # cd libfastcommon-master/ [root@Storage_1 libfastcommon-master] # [root@Storage_1 libfastcommon-master] #. / make.sh [root@Storage_1 libfastcommon-master] #. / make.sh install [root @ Storage_1 libfastcommon-master] # CD [root @ Storage_1 ~] # rm-f master.zip [root@Storage_1 ~] # wget https://github.com/happyfish200/fastdfs/archive/master.zip [root@Storage_1 ~] # unzip master.zip [root@Storage_1 ~] # cd fastdfs-master/ [root@Storage_1 fastdfs-master] #. / make.sh [root@Storage_1 fastdfs-master] #. / make.sh install
# modify configuration file
#
#
# backing up Trcaker files
# operate on tracker
[root@Tracker ~] # cp / etc/fdfs/client.conf.sample / etc/fdfs/client.conf [root@Tracker ~] # cp / etc/fdfs/tracker.conf.sample / etc/fdfs/tracker.conf
# modify tracker
[root@Tracker ~] # vim / etc/fdfs/tracker.conf# modify the following value base_path=/data/fdfs/Tracker # line 22 http.server_port=80 # line 260 [root@Tracker ~] # mkdir / data/fdfs/Tracker-p
# modify the client
[root@Tracker ~] # vim / etc/fdfs/client.confbase_path= / data/fdfs/client # Line 11 tracker_server=192.168.174.136:22122 # Line 15 [root@Tracker ~] # mkdir / data/fdfs/client-p
# start the service
[root@Tracker ~] # service fdfs_trackerd start
# operate on storage (operate simultaneously on two Storage)
[root@Storage_2 ~] # cp / etc/fdfs/storage.conf.sample / etc/fdfs/ storage.confession [root @ Storage_2 ~] # vim / etc/fdfs/storage.conf# is modified as follows: base_path=/data/fdfs/Storage # line 41, store_path0=/data/fdfs/Storage # 109, tracker_server=192.168.174.136:22122 # line 118 [root@Storage_2 ~] # mkdir / data/fdfs/Storage-p [ Root@Storage_2 ~] # service fdfs_storaged start
# check status
[root@Tracker] # fdfs_monitor / etc/fdfs/client.conf [2017-04-16 21:42:51] DEBUG-base_path=/data/fdfs/client, 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: 0server_count=1 Server_index=0tracker server is 192.168.174.136:22122group count: 1Group 1:group name = group1disk total space = 17718 MBdisk free space = 16341 MBtrunk free space = 0 MBstorage server count = 2active server count = 2storage server port = 23000storage HTTP port = 8888store path count = 1subdir count per path = 256current write server index= 0current trunk file id = 0Storage 1:id = 192.168.174.137ip_addr = 192.168.174.137 (Storage_1) ACTIVEhttp domain = version = 5.10join time = 2017-04-16 21:12:37up Time = 2017-04-16 21:12:37total storage = 17718 MBfree storage = 16341 MBupload priority = 10store_path_count = 1subdir_count_per_path = 256storage_port = 23000storage_http_port = 0source storage id = 0source storage id = 0connection.alloc_count = 256connection.current_count = 1connection.max_count = 1total_upload_count = 0success_upload_count = 0total_append_count = 0success_append_count = 0total_modify_count = 0success_modify_count = 0totalkeeper truncate _ Count = 0success_truncate_count = 0total_set_meta_count = 0success_set_meta_count = 0total_delete_count = 0success_delete_count = 0total_download_count = 0success_download_count = 0total_get_meta_count = 0success_get_meta_count = 0total_create_link_count = 0success_create_link_count = 0total_delete_link_count = 0success_delete_link_count = 0total_upload_bytes = 0success_upload_bytes = 0total_append_bytes = 0success_append_bytes = 0total_modify_bytes = 0success_modify_bytes = 0stotal_download_bytes = 0success_download_bytes = 0total_sync_in_bytes = 0success_sync_in_bytes = 0total_sync_out_bytes = 0success_sync_out_bytes = 0total_file_open_count = 0success_file_open_count = 0total_file_read_count = 0success_file_read_count = 0total_file_write_count = 0success_file_write_count = 0last_heart_beat_time = 2017-04-16 21:42 : 36last_source_update = 1970-01-01 08:00:00last_sync_update = 1970-01-01 08:00:00last_synced_timestamp = 1970-01-01 08:00:00 Storage 2:id = 192.168.174.138ip_addr = 192.168.174.138 (Storage_2) ACTIVEhttp domain = version = 5.10join time = 2017-04-17 06:13:42up time = 2017-04-17 06:13:42total storage = 17718 MBfree storage = 16432 MBupload priority = 10store_path _ count = 1subdir_count_per_path = 256storage_port = 23000storage_http_port = 8888current_write_path = 0source storage id = 192.168.174.137if_trunk_server = 0connection.alloc_count = 256connection.current_count = 1connection.max_count = 1total_upload_count = 0success_upload_count = 0total_append_count = 0success_append_count = 0total_modify_count = 0success_modify_count = 0total_truncate_count = 0success_truncate_count = 0total_set_meta_count = 0success_set _ meta_count = 0total_delete_count = 0success_delete_count = 0total_download_count = 0success_download_count = 0total_get_meta_count = 0success_get_meta_count = 0total_create_link_count = 0success_create_link_count = 0total_delete_link_count = 0success_delete_link_count = 0total_upload_bytes = 0success_upload_bytes = 0total_append_bytes = 0success_append_bytes = 0total_modify_bytes = 0success_modify_bytes = 0stotal_download_bytes = 0success _ download_bytes = 0total_sync_in_bytes = 0success_sync_in_bytes = 0total_sync_out_bytes = 0success_sync_out_bytes = 0total_file_open_count = 0success_file_open_count = 0total_file_read_count = 0success_file_read_count = 0total_file_write_count = 0success_file_write_count = 0last_heart_beat_time = 2017-04-16 21:42:46last_source_update = 1970-01-01 08:00:00last_sync _ update = 1970-01-01 08:00:00last_synced_timestamp = 1970-01-01 08:00:00
# Test upload
[root@Tracker] # fdfs_test / etc/fdfs/client.conf upload / root/text.txt This is FastDFS client test program v5.10Copyright (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. [2017-04-16 21:45:44] DEBUG-base_path=/data/fdfs/client, 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.174.137, port=23000server 2. Group_name=, ip_addr=192.168.174.138, port=23000group_name=group1, ip_addr=192.168.174.137, port=23000storage_upload_by_filenamegroup_name=group1 Remote_filename=M00/00/00/wKiuiVjzdaqAfnQgAAAABncc3SA656.txtsource ip address: 192.168.174.137file timestamp=2017-04-16 21:46:18file size=6file crc32=1998380320example file url: http://192.168.174.137/group1/M00/00/00/wKiuiVjzdaqAfnQgAAAABncc3SA656.txtstorage_upload_slave_by_filenamegroup_name=group1, Remote_filename=M00/00/00/wKiuiVjzdaqAfnQgAAAABncc3SA656_big.txtsource ip address: 192.168.174.137file timestamp=2017-04-16 21:46:18file size=6file crc32=1998380320example file url: http://192.168.174.137/group1/M00/00/00/wKiuiVjzdaqAfnQgAAAABncc3SA656_big.txt
# from the above output, you can see that the file has been uploaded to the 00Universe 00 directory. You can take a look.
[root@Storage_1 ~] # cd / data/fdfs/Storage/data/ [root @ Storage_1 data] # LS [root @ Storage_1 data] # cd 00 [root@Storage_1 00] # cd 00 [root@Storage_1 00] # ls