1. 程式人生 > >FastDFS數據遷移

FastDFS數據遷移

file tor nbsp sub start ror inter sep com

  參考:https://blog.csdn.net/frvxh/article/details/56293502

  FastDFS安裝配置參考:https://www.cnblogs.com/minseo/p/10210428.html

  環境介紹

需要同步的tracker:192.168.56.11
需要同步的storage:192.168.56.12

新的tracker:192.168.56.21
新的storage:192.168.56.22

  停止storage進程

 systemctl stop fdfs_storaged

  修改storage配置/etc/fdfs/storage.conf

disabled=false
group_name=group1
bind_addr=192.168.56.22
client_bind=true
port=23000
connect_timeout=90
network_timeout=90
heart_beat_interval=90
stat_report_interval=60
base_path=/opt/fdfsdata/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/fdfsdata/storage
subdir_count_per_path=256
tracker_server=192.168.56.11:22122  #僅僅需要修改此行指向舊的tracker
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=80

  啟動storage

systemctl start fdfs_storaged

  此時數據會同步,查看同步過程 提示ACTIVE則代表同步完成

fdfs_monitor /etc/fdfs/storage.conf

技術分享圖片

  同步之前在舊的上面上傳了一個文件 目錄為/opt/fdfsdata/storage/data/00/00

  同步完成後在新的storage服務器上面相同目錄有相同文件

技術分享圖片

  同步完成後修改配置文件/etc/fdfs/storage.conf僅需要修改一行指向新的tracker服務器

tracker_server=192.168.56.21:22122

  進入storage文件目錄修改

cd /opt/fdfsdata/storage/data
vim .data_init_flag 
sync_src_server=          #留空即可

技術分享圖片

  重啟storage

systemctl restart fdfs_storaged

技術分享圖片

  web頁面驗證

http://192.168.56.22/group1/M00/00/00/wKg4DFxmZ4SAbxeYAAAABelE2rQ516.txt

技術分享圖片

  fastdfs數據同步完成

FastDFS數據遷移