当前位置: 首页 > news >正文

手机网站域名解析怎么做人民日报新闻消息

手机网站域名解析怎么做,人民日报新闻消息,网站建设数据库的选择,高仿做的好点的网站CSDN 成就一亿技术人&#xff01; 今天刚开学第一天给大家分享一期&#xff1a;MySQL集群双主的配置需求和命令 CSDN 成就一亿技术人&#xff01; 神秘泣男子主页&#xff1a;作者首页 <———— MySQL专栏 &#xff1a;MySQL数据库专栏<———— MySQL双主是一…

CSDN 成就一亿技术人!

今天刚开学第一天给大家分享一期:MySQL集群双主的配置需求和命令

CSDN 成就一亿技术人!

神秘泣男子主页:作者首页    <————

MySQL专栏      :MySQL数据库专栏<————

MySQL双主是一种高可用性和容错性的数据库架构,有两个主数据库(Master)。这种架构允许在其中一个主数据库出现故障时,系统仍然能够正常运行,并且在故障恢复后能够继续正常工作。

工作原理:

  • 两台 MySQL 实例都可读写,互为主备。
  • 默认情况下,只有一台主节点(称为主写节点)负责数据的写入,另一台主节点(称为备写节点)处于备用状态。
  • 主写节点将变更记录(binlog)发送给备写节点,备写节点应用变更记录,保证数据一致性。
  • 当主写节点发生故障时,备写节点可以被提升为主写节点,继续提供服务。

优点:

  • 提高读写性能: 两台主节点可以同时处理读写请求,从而提高数据库的整体性能。
  • 增强高可用性: 如果一台主节点发生故障,另一台主节点可以继续提供服务,从而保证数据库的高可用性。

缺点:

  • 数据一致性风险: 双主架构需要保证两台主节点的数据一致性,这可能会带来一些风险,例如数据冲突等。
  • 配置和管理复杂度: 双主架构的配置和管理比单主架构复杂,需要 DBA 具备一定的专业知识。

应用场景:

  • 对读写性能要求较高的应用
  • 对高可用性要求较高的应用

常见实现方式:

  • 双向复制: 两台主节点之间通过 binlog 进行双向复制,保证数据一致性。
  • 仲裁器: 引入一个仲裁器协调两台主节点之间的写入操作,保证数据一致性。

双主配置命令

1.master1配置

1.修改配置文件

配置完成后重启

vim /etc/my.cnflog_bin
server-id=1
gtid_mode=on
enforce_gtid_consistency=on
binlog_format=rowlog_bin:
此配置项启用二进制日志,它是 MySQL 复制所必需的。
server-id:
此配置项用于为 MySQL 服务器分配唯一的标识符。在复制设置中,每个服务器都应该有一个唯一的 server-id。在您的配置中,服务器的ID被设置为1。确保每个服务器都有一个唯一的ID。
gtid_mode:
此配置项启用 GTID 模式。GTID 是用于在不同 MySQL 实例之间唯一标识事务的机制。启用 GTID 有助于简化复制配置和处理。
enforce_gtid_consistency:
此配置项强制执行 GTID 一致性。这确保在执行复制时事务的一致性。
binlog_format=row:
此配置项指定二进制日志的格式。在您的配置中,设置为row,表示以行为基础记录二进制日志。这是推荐的设置,因为它提供更好的灵活性和一致性。
2.创建授权用户
grant replication slave on *.* to 'rep'@'192.168.180.%' identified by 'Sunshao-123';rep是用户名称
@后边跟上服务器网段


2.master2配置

1.修改配置文件

配置完成后重启

log_bin
server-id=2
#GTID:
gtid_mode=on #开启gtid模式
enforce_gtid_consistency=on
binlog_format=row

1.检测创建账户是否可用
mysql -h 目标服务器 -u创建用户 -p'密码'

master2 访问 master1

2.设置主服务器
4.***设置主服务器**    指向master1
mysql> change master to-> master_host='另外一个主服务器的IP',-> master_user='rep',-> master_password='Sunshao-123',-> master_auto_position=1;
Query OK, 0 rows affected, 2 warnings (0.01 sec)

mysql> start slave;        开启复制
Query OK, 0 rows affected (0.00 sec)

3.查看线程状态
mysql> show slave status \G;
************************** 1. row ***************************Slave_IO_State: Waiting for master to send eventMaster_Host: 192.168.180.180Master_User: repMaster_Port: 3306Connect_Retry: 60Master_Log_File: master1-bin.000002Read_Master_Log_Pos: 1720Relay_Log_File: master2-relay-bin.000004Relay_Log_Pos: 966Relay_Master_Log_File: master1-bin.000002Slave_IO_Running: YesSlave_SQL_Running: YesReplicate_Do_DB: Replicate_Ignore_DB: Replicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table: Replicate_Wild_Ignore_Table: Last_Errno: 0Last_Error: Skip_Counter: 0Exec_Master_Log_Pos: 1720Relay_Log_Space: 2452Until_Condition: NoneUntil_Log_File: Until_Log_Pos: 0Master_SSL_Allowed: NoMaster_SSL_CA_File: Master_SSL_CA_Path: Master_SSL_Cert: Master_SSL_Cipher: Master_SSL_Key: Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: NoLast_IO_Errno: 0Last_IO_Error: Last_SQL_Errno: 0Last_SQL_Error: Replicate_Ignore_Server_Ids: Master_Server_Id: 1Master_UUID: 0a562cb8-bf46-11ee-b233-000c2950269eMaster_Info_File: /var/lib/mysql/master.infoSQL_Delay: 0SQL_Remaining_Delay: NULLSlave_SQL_Running_State: Slave has read all relay log; waiting for more updatesMaster_Retry_Count: 86400Master_Bind: Last_IO_Error_Timestamp: Last_SQL_Error_Timestamp: Master_SSL_Crl: Master_SSL_Crlpath: Retrieved_Gtid_Set: 0a562cb8-bf46-11ee-b233-000c2950269e:1-9Executed_Gtid_Set: 0a562cb8-bf46-11ee-b233-000c2950269e:1-9,
235616ef-b8fc-11ee-86c1-000c2952be42:1-2Auto_Position: 1Replicate_Rewrite_DB: Channel_Name: Master_TLS_Version: 
1 row in set (0.00 sec)

都为yes表示成功

接下来返回master1继续配置

.***设置主服务器**    指向master2
mysql> change master to-> master_host='另外一个主服务器的IP',-> master_user='rep',-> master_password='Sunshao-123',-> master_auto_position=1;
Query OK, 0 rows affected, 2 warnings (0.01 sec)
mysql> start slave;
Query OK, 0 rows affected (0.00 sec)mysql> show slave status \G;
*************************** 1. row ***************************Slave_IO_State: Waiting for master to send eventMaster_Host: 192.168.180.181Master_User: repMaster_Port: 3306Connect_Retry: 60Master_Log_File: master2-bin.000002Read_Master_Log_Pos: 194Relay_Log_File: master1-relay-bin.000003Relay_Log_Pos: 411Relay_Master_Log_File: master2-bin.000002Slave_IO_Running: YesSlave_SQL_Running: YesReplicate_Do_DB: Replicate_Ignore_DB: Replicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table: Replicate_Wild_Ignore_Table: Last_Errno: 0Last_Error: Skip_Counter: 0Exec_Master_Log_Pos: 194Relay_Log_Space: 1233Until_Condition: NoneUntil_Log_File: Until_Log_Pos: 0Master_SSL_Allowed: NoMaster_SSL_CA_File: Master_SSL_CA_Path: Master_SSL_Cert: Master_SSL_Cipher: Master_SSL_Key: Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: NoLast_IO_Errno: 0Last_IO_Error: Last_SQL_Errno: 0Last_SQL_Error: Replicate_Ignore_Server_Ids: Master_Server_Id: 2Master_UUID: 235616ef-b8fc-11ee-86c1-000c2952be42Master_Info_File: /var/lib/mysql/master.infoSQL_Delay: 0SQL_Remaining_Delay: NULLSlave_SQL_Running_State: Slave has read all relay log; waiting for more updatesMaster_Retry_Count: 86400Master_Bind: Last_IO_Error_Timestamp: Last_SQL_Error_Timestamp: Master_SSL_Crl: Master_SSL_Crlpath: Retrieved_Gtid_Set: 235616ef-b8fc-11ee-86c1-000c2952be42:1-2Executed_Gtid_Set: 0a562cb8-bf46-11ee-b233-000c2950269e:1-10,
235616ef-b8fc-11ee-86c1-000c2952be42:1-2Auto_Position: 1Replicate_Rewrite_DB: Channel_Name: Master_TLS_Version: 
1 row in set (0.00 sec)

测试

master1

master2同步master1

master1上
mysql> insert into t1 values(666666);
Query OK, 1 row affected (0.01 sec)mysql> select * from test.t1;
+--------+
| id     |
+--------+
|     11 |
|     22 |
|     22 |
|     22 |
| 666666 |
+--------+
5 rows in set (0.00 sec)mysql> master2上
mysql> select * from test.t1;
+--------+
| id     |
+--------+
|     11 |
|     22 |
|     22 |
|     22 |
| 666666 |
+--------+
5 rows in set (0.01 sec)

master2

master1同步master2

master2上
mysql> insert into test.t1 values(77777);
Query OK, 1 row affected (0.01 sec)mysql> select * from test.t1;
+--------+
| id     |
+--------+
|     11 |
|     22 |
|     22 |
|     22 |
| 666666 |
|  77777 |
+--------+
6 rows in set (0.00 sec)mysql> master1上
mysql> select * from test.t1;
+--------+
| id     |
+--------+
|     11 |
|     22 |
|     22 |
|     22 |
| 666666 |
|  77777 |
+--------+
6 rows in set (0.00 sec)
http://www.tj-hxxt.cn/news/95041.html

相关文章:

  • 最大的网站建设公司排名网络营销方式有哪几种
  • 建设银行光明支行网站3分钟搞定网站seo优化外链建设
  • 深圳网站制作公司兴田德润电话多少搜索竞价托管
  • 寻找项目做的网站班级优化大师官方免费下载
  • 郑州中原区网站建设亚马逊提升关键词排名的方法
  • 北京网站设计济南兴田德润团队怎么样站内营销推广途径
  • 天天seo站长工具百度云资源搜索引擎
  • 做网站公搜索引擎优化好做吗
  • 网站建设业务好做吗seo成功的案例和分析
  • 哈尔滨网站建设优化公司淘宝流量平台
  • java做网站需要什么网络广告文案案例
  • 惠州建设局网站首页市场营销策划ppt
  • 自己做网站seo优化海南百度推广总代理
  • 生鲜电商网站建设策划书长春百度网站快速排名
  • wix做网站步骤免费网站alexa排名查询
  • 自己做的网站根目录哪里找到免费推广网站
  • 上海网站 备案星乐seo网站关键词排名优化
  • 广东微信网站制作公司小时seo加盟
  • 临朐县网站建设sem竞价专员是干什么的
  • 做受视频网站 mcb3dbd产品推广方案范文500字
  • 做网站找模版好吗郑州网站推广排名公司
  • 医院网站源码 asp大数据分析
  • 怎么免费建立网店网站浙江seo外包费用
  • 云南省住房和城乡建设局网站站长之家端口扫描
  • 企业网站 建设 外包娱乐热搜榜今日排名
  • 手机wap网站开发教程常见的网络推广方法有哪些
  • 重庆市有网站设计维护厨师培训机构 厨师短期培训班
  • 怎样制作企业的网站谷歌排名优化入门教程
  • 佛山网站建设找千界餐饮最有效的营销方案
  • 网站建设开发文档品牌网络营销策划