惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

爱范儿
爱范儿
博客园_首页
W
WeLiveSecurity
S
Secure Thoughts
S
Security @ Cisco Blogs
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Hugging Face - Blog
Hugging Face - Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
H
Hacker News: Front Page
Project Zero
Project Zero
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
U
Unit 42
N
News and Events Feed by Topic
N
News and Events Feed by Topic
Hacker News - Newest:
Hacker News - Newest: "LLM"
Forbes - Security
Forbes - Security
T
Tor Project blog
I
Intezer
B
Blog
F
Full Disclosure
Security Archives - TechRepublic
Security Archives - TechRepublic
F
Fortinet All Blogs
Schneier on Security
Schneier on Security
T
Threat Research - Cisco Blogs
AI
AI
Google DeepMind News
Google DeepMind News
L
LINUX DO - 最新话题
Cloudbric
Cloudbric
L
Lohrmann on Cybersecurity
WordPress大学
WordPress大学
博客园 - 聂微东
雷峰网
雷峰网
P
Privacy International News Feed
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
PCI Perspectives
PCI Perspectives
Y
Y Combinator Blog
Spread Privacy
Spread Privacy
Simon Willison's Weblog
Simon Willison's Weblog
罗磊的独立博客
Vercel News
Vercel News
A
Arctic Wolf
The Register - Security
The Register - Security
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Microsoft Azure Blog
Microsoft Azure Blog
H
Heimdal Security Blog
Know Your Adversary
Know Your Adversary
P
Proofpoint News Feed
C
Cybersecurity and Infrastructure Security Agency CISA
P
Proofpoint News Feed

博客园 - ZY.Zhou

windows10下docker启动失败原因定位 electron工程目录结构 centos7下安装redis集群 MAC精简动画效果 Big Sur dmg镜像制作macos安装盘 WINDOWS下编译BOOST_PYTHON Centos7 解决gcc 4.85版本,升级更改版本gcc ubuntu下载安装文件和依赖包 fortify的linux环境使用步骤 linux top命令VIRT,RES,SHR,DATA的含义 docker导出镜像并压缩 main.c ubuntu 20开启rc.local LINUX间SSH免密登录 ubuntu 20.10上使用KVM安装K8S QEMU KVM宿主机与客户机间共享目录 Ubuntu20.10减肥 ubuntu的kennel命令行在哪个文件?虚拟机没有开SSH和TELNET,怎么连? 车辆功能部分缩写
MYSQL单服务器迁移数据到集群
ZY.Zhou · 2021-09-08 · via 博客园 - ZY.Zhou

1、导出单服务器整个数据库中的所有数据: 

#mysqldump -p"123456" --all-databases --flush-logs --master-data=2 > /tmp/master.sql

或者只导出某个数据库

#mysqldump -p"123456" --databases mysql > /tmp/mysql.sql

打开master.sql,注意到有如下文字
-- Position to start replication or point-in-time recovery from
-- CHANGE MASTER TO MASTER_LOG_FILE='binlog.000220', MASTER_LOG_POS=156;

2、集群中导入整个数据

#mysql -p"123456"
mysql> source /tmp/master.sql

3、现在可以停止单服务器数据库了,避免数据变化,然后再导出从第一步执行mysqldump到当前的数据变化。

#mysqlbinlog --no-defaults --start-position=156 /var/lib/mysql/binlog.000220 > /tmp/last.sql

4、再在集群中导入最后部分数据

#mysql -p"123456"
mysql> source /tmp/last.sql
如果有用户或权限的变化,使用命令更新
mysql> flush privileges;

5、将所有APP的数据连接指向当前集群的服务地址

以上,完成MYSQL由单服务器向集群迁移。