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

推荐订阅源

罗磊的独立博客
SecWiki News
SecWiki News
酷 壳 – CoolShell
酷 壳 – CoolShell
爱范儿
爱范儿
量子位
M
MIT News - Artificial intelligence
GbyAI
GbyAI
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
TaoSecurity Blog
TaoSecurity Blog
博客园 - 【当耐特】
H
Heimdal Security Blog
腾讯CDC
The Last Watchdog
The Last Watchdog
Security Archives - TechRepublic
Security Archives - TechRepublic
Hacker News: Ask HN
Hacker News: Ask HN
S
Schneier on Security
Microsoft Security Blog
Microsoft Security Blog
WordPress大学
WordPress大学
博客园 - 司徒正美
Recent Commits to openclaw:main
Recent Commits to openclaw:main
C
Cybersecurity and Infrastructure Security Agency CISA
S
SegmentFault 最新的问题
大猫的无限游戏
大猫的无限游戏
Application and Cybersecurity Blog
Application and Cybersecurity Blog
F
Full Disclosure
有赞技术团队
有赞技术团队
T
Tailwind CSS Blog
Engineering at Meta
Engineering at Meta
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
T
Threatpost
月光博客
月光博客
A
Arctic Wolf
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
雷峰网
雷峰网
T
Troy Hunt's Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
The Cloudflare Blog
D
DataBreaches.Net
O
OpenAI News
L
LINUX DO - 最新话题
宝玉的分享
宝玉的分享
小众软件
小众软件
V
Vulnerabilities – Threatpost
A
About on SuperTechFans
人人都是产品经理
人人都是产品经理
T
The Exploit Database - CXSecurity.com
Martin Fowler
Martin Fowler
美团技术团队
P
Privacy International News Feed

博客园 - 墨尘

xmlhttp的OnReadyStateChange事件 技术之路也要懂得理财-------林左鸣:建设军工强国的5条锦囊妙计 magento迁移后后台无法登录解决方法 Android实用工具Hierarchy Viewer实战 SEO如何做有效的外链 加勒比海盗主题曲 小提琴版 apache 编译 rewrite 模块 linux 下php扩展模块的单独编译 转帖:linux 下注册apache开机自启动 javascript中的对象 - 墨尘 - 博客园 混迹于威客 SQL 2005数据类型说明 转帖:PL/SQL 格式化指南 (PL/SQL Formatting Guide) 简述在Access中使用“存储过程” 趋势投资十种有效工具 关于临界点类型算数问题的分析 逻辑推理 应该在别人恐惧时贪婪吗? 404错误!
简单的mysql热备
墨尘 · 2018-01-11 · via 博客园 - 墨尘

最近一直担心数据出问题,还好领导给了一台备用机,装好mysql后搜了下mysq热备相关的帖子,看似好繁琐,自己大概配置了一下擦发现起始很简单!

下边就是步骤了!

1.修改主从mysql配置文件,在mysqld字段下增加以下配置后重启

主:

server-id=1
log-bin=mysql-bin
binlog-do-db=需要同步的数据库名,可以复制多条
binlog-ignore-db=mysql 

从:

server-id=2
log-bin=mysql-bin
binlog-do-db=需要同步的数据库名,和上边对应
binlog-ignore-db=mysql

2.主mysql上创建一个用户,授予服务器权限Replication Slave和Grant Option

mysql -u root –p#进入mysql控制台
mysql> show master status;查看主服务器,出现以下类似信息
mysql> show master status;
+------------------+----------+--------------+------------------+
| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000001 |      107 | xxxx        | mysql            |
+------------------+----------+--------------+------------------+

记录下mysql-bin.000001和107这两个位置的数值

3.在从mysql执行一下指令后就可以查看同步情况了。

mysql -u root –p#进入mysql控制台
mysql> slave stop;#停止slave同步进程
mysql> change master to
-> master_host='主mysql_IP:10.1.1.1',master_user='username',master_password='123456',master_log_file='mysql-bin.000001',master_log_pos=107,master_port=3306; #执行同步语句
mysql> slave start;#开启slave同步进程
mysql> show slave status\G;#

下边两项显示Yes表示同步成功。

Slave_IO_Runinng:Yes
Slave_SQL_Running:Yes