当前位置:网站首页>Fastdfs data migration operation record

Fastdfs data migration operation record

2022-07-07 00:58:00 404 Eason Chan

Migration scenario :

Because the online server is changed from Alibaba cloud to Baidu cloud , Online migration is required , It includes the migration of image files , The file system of the company uses fdfs


Server configuration

Environmental Science IP
Alibaba cloud environment ( used )ali Public network
Baidu cloud environment ( new )baidu Public network

Operation process

-----------

Check out the fdfs Operating state

[[email protected] ~]# ps -ef|grep fdfs
root      12719      1  0 01:25 ?        00:00:00 fdfs_trackerd /etc/fdfs/tracker.conf start
root      12917      1 51 01:29 ?        00:00:01 fdfs_storaged /etc/fdfs/storage.conf start
root      12927  12404  0 01:29 pts/1    00:00:00 grep --color=auto fdfs

Check out the store Catalog

[[email protected] ~]# ll /home/youxin/config/fastdfs/storage/store/data/00/00/
total 0
# You can see that there are no files in this directory at present 

Stop the new environment storage process

[[email protected] ~]# fdfs_storaged /etc/fdfs/storage.conf stop
waiting for pid [12917] exit ...
pid [12917] exit.
[[email protected] ~]# ps -ef|grep fdfs
root      12719      1  0 01:25 ?        00:00:00 fdfs_trackerd /etc/fdfs/tracker.conf start
root      12986  12404  0 01:32 pts/1    00:00:00 grep --color=auto fdfs

Modify the new environment storage.conf file , take tracker_serve Medium ip The address is in the old environment ip

[[email protected] ~]# cat /etc/fdfs/storage.conf|grep tracker_server
# tracker_server can ocur more than once, and tracker_server format is
#tracker_server= New environment ip:22122
tracker_server= Old environment ip:22122  

Here we need to pay attention to

Be careful storage.conf In file ,group_name、store_path_count It should be consistent with the old environment storage.conf Documents are consistent ;

[[email protected] ~]# cat /etc/fdfs/storage.conf|grep 'group_name\|store_path_count'
group_name=group1
store_path_count=2
# This is the configuration of the old environment 
# Before the new environment is modified 
[[email protected] ~]# cat /etc/fdfs/storage.conf|grep 'group_name\|store_path_count'
group_name=group1
store_path_count=1

# After the new environment is modified 
[[email protected] ~]# cat /etc/fdfs/storage.conf|grep 'group_name\|store_path_count'
group_name=group1
store_path_count=2

If your old environment store_path_count If there is more than one, you need to create the corresponding storage directory , Otherwise, the next startup will report an error

store_path_count=2

# store_path#, based 0, if store_path0 not exists, it's value is base_path
# the paths must be exist
store_path0=/home/youxin/config//fastdfs/storage/store
store_path1=/home/youxin/config//fastdfs/storage2/store

Finally, start the new environment storage, At this time , Old server tracker It will go to the new server storage Synchronous data

[[email protected] ~]# fdfs_storaged /etc/fdfs/storage.conf start
[[email protected] ~]# ps -ef|grep fdfs
root      12719      1  0 01:25 ?        00:00:00 fdfs_trackerd /etc/fdfs/tracker.conf start
root      13185      1 31 01:47 ?        00:00:01 fdfs_storaged /etc/fdfs/storage.conf start
root      13201  12404  0 01:47 pts/1    00:00:00 grep --color=auto fdfs

adopt fdfs_monitor /etc/fdfs/storage.conf Check the corresponding storage Is the status yes active

# FDFS_STORAGE_STATUS:INIT : initialization , The source server that has not been synchronized with the existing data 

# FDFS_STORAGE_STATUS:WAIT_SYNC : Waiting for synchronization , The source server that has synchronized the existing data 

# FDFS_STORAGE_STATUS:SYNCING : Syncing 

# FDFS_STORAGE_STATUS:DELETED : deleted , This server is removed from this group 

# FDFS_STORAGE_STATUS:OFFLINE : offline 

# FDFS_STORAGE_STATUS:ONLINE : On-line , Not yet able to provide services 

# FDFS_STORAGE_STATUS:ACTIVE : On-line , Can provide services 

Finally, check whether the new environment directory files are synchronized

[[email protected] ~]# ll /home/youxin/config/fastdfs/storage/store/data/00/00/
total 79984
-rw-r--r-- 1 root root   78258 Aug 23  2021 rB3kk2EjZtKAIlCWAAExsrbSCWM679.jpg
-rw-r--r-- 1 root root   55960 Aug 26  2021 rB3kk2EnapmAed5JAADamCemQ4Q843.png
-rw-r--r-- 1 root root   23527 Aug 26  2021 rB3kk2Enb_GARWUmAABb51Yzqbw61.jpeg
-rw-r--r-- 1 root root      91 Aug 26  2021 rB3kk2Enc-2AH88hAAAAW-pqB00981.jpg
-rw-r--r-- 1 root root   24695 Aug 26  2021 rB3kk2Enc2GAfzSSAABgdybmZVM109.jpg
-rw-r--r-- 1 root root    7352 Aug 26  2021 rB3kk2Enc3uACf49AAAcuM2IpaM836.png
-rw-r--r-- 1 root root    7352 Aug 26  2021 rB3kk2Enc4KAeonMAAAcuM2IpaM298.png
-rw-r--r-- 1 root root    7352 Aug 26  2021 rB3kk2Enc8WAJDXrAAAcuM2IpaM229.png
-rw-r--r-- 1 root root    7352 Aug 26  2021 rB3kk2EncMqASN6EAAAcuM2IpaM596.png
-rw-r--r-- 1 root root    7352 Aug 26  2021 rB3kk2EncQyAZJ-6AAAcuM2IpaM536.png
-rw-r--r-- 1 root root    7352 Aug 26  2021 rB3kk2Encu2AaGD_AAAcuM2IpaM304.png
-rw-r--r-- 1 root root    7352 Aug 26  2021 rB3kk2EncyCAJY8wAAAcuM2IpaM214.png

Finally, don't forget to put tracker_server Of IP Change the address back to the new IP


We need to pay attention to :

1. Communication between the old and new environments must be ensured ( That is, public network to public network Intranet to intranet )
2. Relevant firewall ports need to be released
3. New environment group_name、store_path_count It should be consistent with the old environment storage.conf Documents are consistent ( must ), Otherwise, it can't be synchronized

If you have any other questions, please leave a message in the comment area to discuss ~~~~

原网站

版权声明
本文为[404 Eason Chan]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/188/202207061658402592.html