[mysqld]# 服务器唯一标识server-id=1# 二进制日志文件名log-bin=mysql-bin# 需要备份的数据库,多个数据库用 , 分隔binlog-do-db=piumnl# 需要复制的数据库,多个数据库用 , 分隔replicate-do-db=piumnl# 中继日志文件名relay_log=mysqld-relay-bin# 手动启动同步服务,避免突然宕机导致的数据日志不同步skip-slave-start=ON# 互为主从需要加入这一行log-slave-updates=ON# 禁用符号链接,防止安全风险,可不加symbolic-links=0# 可不加# resolve - [Warning] Slave SQL: If a crash happens this configuration does not guarantee that the relay log info will be consistent, Error_code: 0master-info-repository=tablerelay-log-info-repository=tablerelay-log-recovery=1# 可不加# 禁用 dns 解析,会使授权时使用的域名无效skip-host-cacheskip-name-resolvesql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
masterB 配置
my.cnf
# 不再解释各个配置项[mysqld]server-id=2log-bin=mysql-binbinlog-do-db=piumnlreplicate-do-db=piumnlrelay_log=mysql-relay-binskip-slave-start=ONlog-slave-updates=ONsymbolic-links=0# resolve - [Warning] Slave SQL: If a crash happens this configuration does not guarantee that the relay log info will be consistent, Error_code: 0master-info-repository=tablerelay-log-info-repository=tablerelay-log-recovery=1skip-host-cacheskip-name-resolvesql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
创建备份用户
masterA & masterB 都要创建备份用户:
create user 'rep'@'%' identified by 'rep'; # 创建一个账户grant replication slave on *.* to 'rep'@'%'; # 授予该账户对任意数据库任意表的主从备份权限
备注:
Linux 下 MySQL 对 root@% 用户关闭了 grant_priv 权限,所以如果是远程登录会出现授权失败的情况此处备份用户帐号和密码可不一致,此处为了简化操作使用一样的帐号和密码
重启服务器
重启服务器
开启备份
masterA
查看 masterB 状态
Shakker
多功能AI图像生成和编辑平台
103 查看详情
show master statusG;# 此处需要关注 File 和 Position 值
开启备份
stop slave;# master_log_file 就是第一步操作的 File 值# master_log_pos 就是第一步操作的 Position 值change master to master_host=, master_user=, master_port=, master_password=, master_log_file='mysql-log.000003', master_log_pos=154;start slave;
查看结果
show slave statusG;# 查看最重要的两项,两个都必须为 Yes ,有一个为 No 都要去查看错误日志文件,看看什么地方存在问题# Slave_IO_Running: Yes# Slave_SQL_Running: Yes
给滚动元素平滑过渡 如何在滚动条属性(scrollleft)发生改变时为元素添加平滑的过渡效果? 解决方案:scroll-behavior 属性 为滚动容器设置 scroll-behavior 属性可以实现平滑滚动。 html 代码: click the button to slide right!…
如何在前端实现 Windows 10 设置界面中的鼠标移动探照灯效果 想要在前端开发中实现 Windows 10 设置界面中类似的鼠标移动探照灯效果,可以通过以下途径: CSS 解决方案 DEMO 1: Windows 10 网格悬停效果:https://codepen.io/tr4553r7/pe…