当前位置:网站首页>fastDFS数据迁移操作记录
fastDFS数据迁移操作记录
2022-07-06 16:58:00 【404陈奕迅】
迁移场景:
因线上服务器由阿里云更换为百度云,需要进行线上迁移,其中就包含了对图片文件的迁移,而公司的文件系统使用的就是fdfs
服务器配置
环境 | IP |
---|---|
阿里云环境(旧) | ali公网 |
百度云环境(新) | baidu公网 |
操作流程
-----------
查看新环境的fdfs的运行状态
[[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
查看新环境的store目录
[[email protected] ~]# ll /home/youxin/config/fastdfs/storage/store/data/00/00/
total 0
#可以看到目前该目录下是没有任何文件的
停止新环境的storage进程
[[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
修改新环境的storage.conf文件,将tracker_serve中的ip地址为旧环境的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=新环境ip:22122
tracker_server=旧环境ip:22122
这里需要注意
注意storage.conf文件中,group_name、store_path_count要和旧环境的storage.conf文件保持一致;
[[email protected] ~]# cat /etc/fdfs/storage.conf|grep 'group_name\|store_path_count'
group_name=group1
store_path_count=2
#这是旧环境的配置
#新环境修改前
[[email protected] ~]# cat /etc/fdfs/storage.conf|grep 'group_name\|store_path_count'
group_name=group1
store_path_count=1
#新环境修改后
[[email protected] ~]# cat /etc/fdfs/storage.conf|grep 'group_name\|store_path_count'
group_name=group1
store_path_count=2
如果你旧环境的store_path_count不止一个的话需要创建对应的存储目录,否则接下来启动会报错
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
最后启动新环境的storage,这时,旧服务器的tracker会往新服务器的storage同步数据
[[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
通过fdfs_monitor /etc/fdfs/storage.conf查看对应的storage状态是否是active
# FDFS_STORAGE_STATUS:INIT :初始化,尚未得到同步已有数据的源服务器
# FDFS_STORAGE_STATUS:WAIT_SYNC :等待同步,已得到同步已有数据的源服务器
# FDFS_STORAGE_STATUS:SYNCING :同步中
# FDFS_STORAGE_STATUS:DELETED :已删除,该服务器从本组中摘除
# FDFS_STORAGE_STATUS:OFFLINE :离线
# FDFS_STORAGE_STATUS:ONLINE :在线,尚不能提供服务
# FDFS_STORAGE_STATUS:ACTIVE :在线,可以提供服务
最后查看新环境目录文件是否同步过来
[[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
最后千万不要忘记在同步完成之前把tracker_server的IP地址改回新的IP
需要注意:
1.新旧环境之间一定要保证可以互相通讯 (即公网对公网 内网对内网)
2.相关的防火墙端口需要放行
3.新环境的group_name、store_path_count要和旧环境的storage.conf文件保持一致(必须),否则无法同步
有其它问题的话欢迎在评论区留言讨论~~~~
边栏推荐
- C language input / output stream and file operation [II]
- 准备好在CI/CD中自动化持续部署了吗?
- Slam d'attention: un slam visuel monoculaire appris de l'attention humaine
- How engineers treat open source -- the heartfelt words of an old engineer
- JWT signature does not match locally computed signature. JWT validity cannot be asserted and should
- ZYNQ移植uCOSIII
- Leecode brush questions record interview questions 32 - I. print binary tree from top to bottom
- The difference between redirectto and navigateto in uniapp
- 一图看懂对程序员的误解:西方程序员眼中的中国程序员
- 基于GO语言实现的X.509证书
猜你喜欢
一图看懂对程序员的误解:西方程序员眼中的中国程序员
Zynq transplant ucosiii
VTK volume rendering program design of 3D scanned volume data
X.509 certificate based on go language
After leaving a foreign company, I know what respect and compliance are
37 page overall planning and construction plan for digital Village revitalization of smart agriculture
Win10 startup error, press F9 to enter how to repair?
学习光线跟踪一样的自3D表征Ego3RT
【软件逆向-求解flag】内存获取、逆变换操作、线性变换、约束求解
What can the interactive slide screen demonstration bring to the enterprise exhibition hall
随机推荐
Devops can help reduce technology debt in ten ways
Mujoco second order simple pendulum modeling and control
String comparison in batch file - string comparison in batch file
Distributed cache
Policy Gradient Methods
Hero League | King | cross the line of fire BGM AI score competition sharing
How to judge whether an element in an array contains all attribute values of an object
基于SSM框架的文章管理系统
On February 19, 2021ccf award ceremony will be held, "why in Hengdian?"
Things like random
Three methods to realize JS asynchronous loading
2022/2/10 summary
C9高校,博士生一作发Nature!
Leecode brush questions record sword finger offer 43 The number of occurrences of 1 in integers 1 to n
37页数字乡村振兴智慧农业整体规划建设方案
Everyone is always talking about EQ, so what is EQ?
Attention SLAM:一種從人類注意中學習的視覺單目SLAM
Leetcode(547)——省份数量
stm32F407-------DAC数模转换
Model-Free Control