当前位置:网站首页>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文件保持一致(必须),否则无法同步
有其它问题的话欢迎在评论区留言讨论~~~~
边栏推荐
- Attention SLAM:一种从人类注意中学习的视觉单目SLAM
- 沉浸式投影在线下展示中的三大应用特点
- Cross-entrpy Method
- build. How to configure the dependent version number in the gradle file
- Testers, how to prepare test data
- 2022/2/12 summary
- Lombok makes ⽤ @data and @builder's pit at the same time. Are you hit?
- String comparison in batch file - string comparison in batch file
- Zynq transplant ucosiii
- Rails 4 asset pipeline vendor asset images are not precompiled
猜你喜欢
![[yolov5 6.0 | 6.1 deploy tensorrt to torch serve] environment construction | model transformation | engine model deployment (detailed packet file writing method)](/img/1a/2b497a1baa04d84d28da715d097dfe.png)
[yolov5 6.0 | 6.1 deploy tensorrt to torch serve] environment construction | model transformation | engine model deployment (detailed packet file writing method)

How to judge whether an element in an array contains all attribute values of an object

2022/2/12 summary
![[2022 the finest in the whole network] how to test the interface test generally? Process and steps of interface test](/img/8d/b59cf466031f36eb50d4d06aa5fbe4.jpg)
[2022 the finest in the whole network] how to test the interface test generally? Process and steps of interface test

Article management system based on SSM framework

工程师如何对待开源 --- 一个老工程师的肺腑之言

Liuyongxin report | microbiome data analysis and science communication (7:30 p.m.)

Basic information of mujoco

stm32F407-------SPI通信

集合(泛型 & List & Set & 自定义排序)
随机推荐
[daily problem insight] prefix and -- count the number of fertile pyramids in the farm
uniapp中redirectTo和navigateTo的区别
2022 PMP project management examination agile knowledge points (9)
准备好在CI/CD中自动化持续部署了吗?
What can the interactive slide screen demonstration bring to the enterprise exhibition hall
Leecode brush questions record interview questions 32 - I. print binary tree from top to bottom
If the college entrance examination goes well, I'm already graying out at the construction site at the moment
从外企离开,我才知道什么叫尊重跟合规…
Encryption algorithm - password security
alexnet实验偶遇:loss nan, train acc 0.100, test acc 0.100情况
Service asynchronous communication
Alexnet experiment encounters: loss Nan, train ACC 0.100, test ACC 0.100
Quaternion attitude calculation of madgwick
stm32F407-------SPI通信
Why should a complete knapsack be traversed in sequence? Briefly explain
Testers, how to prepare test data
equals()与hashCode()
Web project com mysql. cj. jdbc. Driver and com mysql. jdbc. Driver differences
JWT signature does not match locally computed signature. JWT validity cannot be asserted and should
Uniapp uploads and displays avatars locally, and converts avatars into Base64 format and stores them in MySQL database