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

推荐订阅源

GbyAI
GbyAI
J
Java Code Geeks
雷峰网
雷峰网
WordPress大学
WordPress大学
宝玉的分享
宝玉的分享
云风的 BLOG
云风的 BLOG
V
Visual Studio Blog
V
Vulnerabilities – Threatpost
S
Securelist
The Hacker News
The Hacker News
The Register - Security
The Register - Security
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Help Net Security
Help Net Security
G
Google Developers Blog
Hugging Face - Blog
Hugging Face - Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
M
MIT News - Artificial intelligence
AI
AI
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
The GitHub Blog
The GitHub Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Schneier on Security
Schneier on Security
N
Netflix TechBlog - Medium
T
The Blog of Author Tim Ferriss
Google DeepMind News
Google DeepMind News
Hacker News - Newest:
Hacker News - Newest: "LLM"
H
Hacker News: Front Page
博客园 - 司徒正美
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
B
Blog
Microsoft Azure Blog
Microsoft Azure Blog
大猫的无限游戏
大猫的无限游戏
Security Latest
Security Latest
Engineering at Meta
Engineering at Meta
N
News and Events Feed by Topic
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
酷 壳 – CoolShell
酷 壳 – CoolShell
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
Threat Research - Cisco Blogs
U
Unit 42
V
V2EX
V2EX - 技术
V2EX - 技术
L
LINUX DO - 最新话题
aimingoo的专栏
aimingoo的专栏
Microsoft Security Blog
Microsoft Security Blog
Recorded Future
Recorded Future
P
Privacy & Cybersecurity Law Blog
美团技术团队
小众软件
小众软件
F
Fortinet All Blogs

博客园 - 墨尘

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