返回顶部
首页 > 资讯 > 数据库 >mysql双主
  • 764
分享到

mysql双主

2024-04-02 19:04:59 764人浏览 安东尼
摘要

master01 [client]port = 3306 Socket = /home/Mysql/socket/mysql.sock #default-character-set=utf8 [mysql

master01

[client]
port = 3306
Socket = /home/Mysql/socket/mysql.sock
#default-character-set=utf8
[mysqld]
port = 3306
#character_set_server=utf8
#skip-grant-tables = 1
character_set_server = utf8
socket = /home/mysql/socket/mysql.sock
datadir = /home/mysql/data
pid-file = /home/mysql/pid/mysql.pid
user = mysql
bind-address = 0.0.0.0
server-id = 1 #此处注意
skip-name-resolve
back_log = 600
max_connections = 1000
max_connect_errors = 6000
open_files_limit = 65535
table_open_cache = 128
max_allowed_packet = 4M
binlog_cache_size = 1M
max_heap_table_size = 8M
tmp_table_size = 16M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
sort_buffer_size = 8M
join_buffer_size = 8M
key_buffer_size = 4M
thread_cache_size = 8
query_cache_size = 8M
query_cache_limit = 2M
ft_min_Word_len = 4
log_bin = mysql-bin
binlog_fORMat = mixed
expire_logs_days = 30
log_error = /home/mysql/error/mysql-error.log
slow_query_log = 1
long_query_time = 1
slow_query_log_file = /home/mysql/slow/mysql-slow.log
performance_schema = 0
explicit_defaults_for_timestamp
skip-external-locking
default_storage_engine = InnoDB
innodb_file_per_table = 1
innodb_open_files = 500
innodb_buffer_pool_size = 64M
innodb_write_io_threads = 4
innodb_read_io_threads = 4
innodb_thread_concurrency = 0
innodb_purge_threads = 1
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 2M
innodb_log_file_size = 32M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
bulk_insert_buffer_size = 8M
myisam_sort_buffer_size = 8M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1
interactive_timeout = 28800
wait_timeout = 28800
innodb_file_per_table = ON
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
validate-password = OFF
log_bin_trust_function_creators = ON
lower_case_table_names=1
#binlog-ignore-db=mysql
#myql start bantongbu
rpl_semi_sync_master_enabled=1
#mysql_binlog_size = 500M
max_binlog_size=1024M
expire_logs_days=7
replicate-wild-ignore-table=mysql.% #此处加上
replicate-wild-ignore-table=information_schema.% #此处加上
replicate-wild-ignore-table=performance_schema.% #此处加上
replicate-wild-ignore-table=test.%
##########MM#####
auto_increment_offset = 1 #此处加上
auto_increment_increment = 2 #此处加上 奇数和偶数

[mysqldump]
quick
max_allowed_packet = 16M

[myisamchk]
key_buffer_size = 8M
sort_buffer_size = 8M
read_buffer = 4M
write_buffer = 4M

##################################################
master02的配置
[client]
port = 3306
socket = /home/mysql/socket/mysql.sock
#default-character-set=utf8
[mysqld]
port = 3306
#character_set_server=utf8
#skip-grant-tables = 1
character_set_server = utf8
socket = /home/mysql/socket/mysql.sock
datadir = /home/mysql/data
pid-file = /home/mysql/pid/mysql.pid
user = mysql
bind-address = 0.0.0.0
server-id = 3 #此处不一样
skip-name-resolve
back_log = 600
max_connections = 1000
max_connect_errors = 6000
open_files_limit = 65535
table_open_cache = 128
max_allowed_packet = 4M
binlog_cache_size = 1M
max_heap_table_size = 8M
tmp_table_size = 16M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
sort_buffer_size = 8M
join_buffer_size = 8M
key_buffer_size = 4M
thread_cache_size = 8
query_cache_size = 8M
query_cache_limit = 2M
ft_min_word_len = 4
log_bin = mysql-bin
binlog_format = mixed
expire_logs_days = 30
log_error = /home/mysql/error/mysql-error.log
slow_query_log = 1
long_query_time = 1
slow_query_log_file = /home/mysql/slow/mysql-slow.log
performance_schema = 0
explicit_defaults_for_timestamp
skip-external-locking
default_storage_engine = InnoDB
innodb_file_per_table = 1
innodb_open_files = 500
innodb_buffer_pool_size = 64M
innodb_write_io_threads = 4
innodb_read_io_threads = 4
innodb_thread_concurrency = 0
innodb_purge_threads = 1
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 2M
innodb_log_file_size = 32M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
bulk_insert_buffer_size = 8M
myisam_sort_buffer_size = 8M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1
interactive_timeout = 28800
wait_timeout = 28800
innodb_file_per_table = ON
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
validate-password = OFF
log_bin_trust_function_creators = ON
lower_case_table_names=1
#binlog-ignore-db=mysql
#myql start bantongbu
rpl_semi_sync_master_enabled=1
#mysql_binlog_size = 500M
max_binlog_size=1024M
expire_logs_days=7
replicate-wild-ignore-table=mysql.%
replicate-wild-ignore-table=information_schema.%
replicate-wild-ignore-table=performance_schema.%
replicate-wild-ignore-table=test.%

##########MM#####
auto_increment_offset = 2 #此处不一样
auto_increment_increment = 2 #此处不一样

[mysqldump]
quick
max_allowed_packet = 16M

[myisamchk]
key_buffer_size = 8M
sort_buffer_size = 8M
read_buffer = 4M
write_buffer = 4M

##################################
master01
grant replication slave on . to 'repl_user'@'1922.168.56.11' identified by 'repl_passwd';
show master status
master02
change master to
master_host='192.168.56.10',
master_user='repl_user',
master_password='repl_passwd',
master_log_file='mysql-bin.000046',
master_log_pos=154;

start slave
###############################
master02
grant replication slave on . to 'repl_user'@'1922.168.56.10' identified by 'repl_passwd';
show master status
master01
change master to
master_host='192.168.56.11',
master_user='repl_user',
master_password='repl_passwd',
master_log_file='mysql-bin.000046',
master_log_pos=154;
start slave

##########################################
至此双主搭建完毕 宕机一台插入测试 宕机另外一台在插入测试,可以看出主键不冲突
mysql双主

您可能感兴趣的文档:

--结束END--

本文标题: mysql双主

本文链接: https://lsjlt.com/news/43539.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

猜你喜欢
  • mysql双主
    master01 [client]port = 3306 socket = /home/mysql/socket/mysql.sock #default-character-set=utf8 [mysql...
    99+
    2024-04-02
  • mysql双主+keepalived
    环境 OS: centos7Mysql 版本: mysql 5.7Keepalived: keepalived-1.2.20Mysql-vip:192.168.41.100Mysql-master1:192...
    99+
    2024-04-02
  • keepalived+mysql双主
    keepalived+mysql双主原理:(1)主库1上的keepalived启动之后,会检查mysql服务是否活着,如果活着,keepalived进入master状态,获得VIP;(2)主库2上的keep...
    99+
    2024-04-02
  • MySQL双主配置
    准备环境:服务器操作系统为RHEL6.4 x86_64,为最小化安装。主机A和主机B均关闭防火墙和SELINUX ,IP地址分别为192.168.131.129和192.168.131.130...
    99+
    2024-04-02
  • MySQL主主(双主)数据同步
    1. 两台mysql都可以读写,互为主备,默认只是用一台(masterA)负责数据的写入,另一台(masterB)备用;2. masterA是masterB的主库,masterB又是masterA的主库,...
    99+
    2024-04-02
  • mysql搭建主从复制(一主一从,双主双从)
    主从复制原理 Mysql 中有一个binlog 二进制日志,这个日志会记录下所有修改了的SQL 语句,从服务器把主服务器上的binlog二进制日志在指定的位置开始复制主服务器所进行修改的语句到从服务器上执行一遍。 流程图 搭建一...
    99+
    2016-07-17
    mysql搭建主从复制(一主一从,双主双从)
  • MySQL双主(主主)架构配置方案
    在企业中,数据库高可用一直是企业的重中之重,中小企业很多都是使用mysql主从方案,一主多从,读写分离等,但是单主存在单点故障,从库切换成主库需要作改动。因此,如果是双主或者多主,就会增加mysql入口,增加高可用。...
    99+
    2022-05-14
    MySQL 双主 mysql双主双从
  • Mysql双主如何配置
    这篇“Mysql双主如何配置”文章的知识点大部分人都不太理解,所以小编给大家总结了以下内容,内容详细,步骤清晰,具有一定的借鉴价值,希望大家阅读完这篇文章能有所收获,下面我们一起来看看这篇“Mysql双主如何配置”文章吧。前言特点:在双主配...
    99+
    2023-07-02
  • mysql双主键如何设置
    在MySQL中,通常使用主键来唯一标识表中的每一行数据。如果您想要设置一个表具有双主键,则需要创建一个复合主键。这意味着您需要将两个...
    99+
    2024-04-09
    mysql
  • mysql+keepalived 双主热备高可用
    理论介绍: 我们通常说的双机热备是指两台机器都在运行,但并不是两台机器都同时在提供服务。当提供服务的一台出现故障的时候,另外一台会马上自动接管并且提供服务,而且切换的时间非常短。MySQL双主复制,即互...
    99+
    2024-04-02
  • 如何进行MySQL双主补充
    今天就跟大家聊聊有关如何进行MySQL双主补充,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。环境:主机名       ...
    99+
    2024-04-02
  • MySQL双主的缺点有哪些
    MySQL双主架构的缺点包括:1. 数据冲突:双主架构会导致数据冲突问题,因为两个主节点可以同时写入数据,如果同时对同一条数据进行修...
    99+
    2023-09-28
    mysql
  • mysql双主模式怎么配置
    在MySQL中,双主模式也被称为双主复制或双向复制,它可以实现数据库的读写分离和高可用性。在双主模式下,两个MySQL服务器都可以接...
    99+
    2023-10-26
    mysql
  • mongodb 主从 双主
    主从模式   master ./mongod --dbpath /mongodb/masterdb/ --port 10000 --master  --logpath /tmp/mong...
    99+
    2024-04-02
  • keepalived+双主
    [root@mini1 ~]# setenforce 0[root@mini1 ~]# systemctl stop firewalld.service [root@mini1 ~]# vim /...
    99+
    2024-04-02
  • MySQL主主复制(双主复制)配置过程介绍
    一、修改配置文件my.cnf 服务器A(172.16.16.70)配置如下 server_id = 70 socket = /tmp/mysql.sock innodb_buffer_pool_size =...
    99+
    2024-04-02
  • mysql5.7主主(双主)复制
    1. 准备工作(本文永久地址:http://woymk.blog.51cto.com/10000269/1922786)配置环境:centos6.9,mysql5.7先安装、配置好两台MySQL服务器ser...
    99+
    2024-04-02
  • Mysql双主配置的详细步骤
    目录前言一、mysql配置文件(1)节点A配置(2)节点B配置二、配置节点A为节点B的master(主从模式)三、完成双主配置四、测试五、控制同步的库或表六、一个账号多个IP总结前言 特点:在双主配置中,两台mysql互...
    99+
    2022-06-23
    mysql双主双从怎么配置 mysql双主特色 Mysql双主
  • mysql双主配合keepalived可用简析
    一 版本。    mysql数据库版本:Preconna Server ,MariaDB还是MYSQL    1.mysql三种存储引擎 ...
    99+
    2024-04-02
  • linux上mysql MM(双主)及keepalived搭建
    一、主备机IP及VIP规划: master1 10.1.1.14 VIP 10.1.1.16 master2    10.1.1.15 VIP 10.1.1.16 二、mysq...
    99+
    2024-04-02
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作