`
JasonChi
  • 浏览: 94695 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

mysql master-master配置

 
阅读更多

同ubuntu下配置:(转自:http://archive.cnblogs.com/a/2214282/

Master 1 Config File:

 

#
# The MySQL database server configuration file.
#
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
default-character-set = utf8

# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0

[mysqld]
#My Features
default-character-set = utf8
skip-name-resolve
default-storage-engine = InnoDB
default-table-type = InnoDB
innodb_flush_log_at_trx_commit=0
federated

#Master
server-id = 1
log-bin=mysql-bin
binlog-do-db=s3
binlog-ignore-db=mysql
sync_binlog=1
auto_increment_increment=2
auto_increment_offset=1

#Slave
skip-name-resolve
slave-skip-errors
log-slave-updates
master-user=sync
master-password=123456
master-port=3306
master-connect-retry=30
replicate-do-db=s3
relay-log=S3-DB-M-1-relay-bin
#
# * Basic Settings
#

user = mysql
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address = 127.0.0.1
#
# * Fine Tuning
#
key_buffer = 16M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover = BACKUP
#max_connections = 100
#table_cache = 64
#thread_concurrency = 10
#
# * Query Cache Configuration
#
query_cache_limit = 1M
query_cache_size = 16M
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file = /var/log/mysql/mysql.log
#general_log = 1

log_error = /var/log/mysql/error.log

# Here you can see queries with especially long duration
#log_slow_queries = /var/log/mysql/mysql-slow.log
#long_query_time = 2
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
# other settings you may need to change.
#server-id = 1
#log_bin = /var/log/mysql/mysql-bin.log
expire_logs_days = 10
max_binlog_size = 100M
#binlog_do_db = include_database_name
#binlog_ignore_db = include_database_name

[mysqldump]
quick
quote-names
max_allowed_packet = 24M

[mysql]
#no-auto-rehash # faster start of mysql but no tab completition

[isamchk]
key_buffer = 16M

#
# * IMPORTANT: Additional settings that can override those from this file!
# The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/

Master 2 Config File:

#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
default-character-set = utf8

# Here is entries for some specific programs
# The following values assume you have at least 32M ram

# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0

[mysqld]
default-character-set = utf8
skip-name-resolve
default-storage-engine = InnoDB
default-table-type = InnoDB
innodb_flush_log_at_trx_commit=0
federated

#master
server-id = 2
log-bin=mysql-bin
binlog-do-db=s3
binlog-ignore-db=mysql
sync_binlog=1
auto_increment_increment=2
auto_increment_offset=2

#Slave
skip-name-resolve
slave-skip-errors
log-slave-updates
master-user=sync
master-password=123456
master-port=3306
master-connect-retry=30 #断网后间隔30秒重连
replicate-do-db=s3
relay-log=S3-DB-M-2-relay-bin

#
# * Basic Settings
#

#
# * IMPORTANT
# If you make changes to these settings and your system uses apparmor, you may
# also need to also adjust /etc/apparmor.d/usr.sbin.mysqld.
#

user = mysql
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address = 127.0.0.1
#
# * Fine Tuning
#
key_buffer = 16M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover = BACKUP
#max_connections = 100
#table_cache = 64
#thread_concurrency = 10
#
# * Query Cache Configuration
#
query_cache_limit = 1M
query_cache_size = 16M
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file = /var/log/mysql/mysql.log
#general_log = 1

log_error = /var/log/mysql/error.log

# Here you can see queries with especially long duration
#log_slow_queries = /var/log/mysql/mysql-slow.log
#long_query_time = 2
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
# other settings you may need to change.
#server-id = 1
#log_bin = /var/log/mysql/mysql-bin.log
expire_logs_days = 10
max_binlog_size = 100M
#binlog_do_db = include_database_name
#binlog_ignore_db = include_database_name
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem



[mysqldump]
quick
quote-names
max_allowed_packet = 24M

[mysql]
#no-auto-rehash # faster start of mysql but no tab completition

[isamchk]
key_buffer = 16M

#
# * IMPORTANT: Additional settings that can override those from this file!
# The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/
Centos
转自:http://whxhz.iteye.com/blog/1164662

不同os下,其实配置也一样,先单向建立master-slave,再逆向建立master-slave即可。

 

分享到:
评论

相关推荐

    mysql-master-master

    提供的`mysql-master-master-1.2.5`文件可能是用于帮助配置和监控MySQL主主复制的工具或文档,具体用途需要解压后查看。正确理解和应用这些知识点,可以有效地实现并维护MySQL的主主复制环境,确保数据的安全性和...

    LNH_MySQL 12-mysqldump-master-data参数答疑详解.mp4

    LNH_MySQL 12-mysqldump-master-data参数答疑详解.mp4

    LNH_MySQL 02-mysqldump-master-data参数答疑详解.mp4

    LNH_MySQL 02-mysqldump-master-data参数答疑详解.mp4

    Navicat-for-MySQL--master.zip

    - **下载**:首先,你需要从官方网站或者授权的下载站点获取"Navicat-for-MySQL--master.zip"文件,然后解压到本地。 - **安装**:运行解压后的安装程序,按照提示完成安装步骤。安装过程中,你可以选择安装路径,...

    mysql-connector-java-8.0.16-master.zip

    MySQL Connector/J 8.0.16 是 MySQL 官方提供的用于 Java 应用程序连接 MySQL 数据库的驱动程序。这个压缩包包含了该版本的源代码,对于开发者来说,它是一个宝贵的资源,可以帮助深入理解数据库连接器的工作原理,...

    mha4mysql-manager-0.58.tar和 mha4mysql-node-0.58.tar 的源码和rpm包

    在MySQL的高可用性解决方案中,MHA(Master High Availability)是一个不可忽视的重要工具。本文将深入探讨MHA的两个核心组件——`mha4mysql-manager`和`mha4mysql-node`,以及它们在`0.58`版本中的应用。 MHA,...

    tpch-mysql-master.zip

    1. **安装与配置**:首先,你需要解压tpch-mysql-master.zip文件,然后根据提供的文档配置MySQL服务器,包括设置合适的存储引擎、索引策略等。 2. **生成数据**:运行数据生成器,生成指定规模的TPC-H测试数据,并...

    MySQL Master-Slaves 主从复制.pdf

    在MySQL 5.7版本中,为了实现主从复制,需要按照一定的步骤进行配置。 首先,在主服务器上需要创建一个用于复制的同步账号,并配置开启二进制日志(binlog)。二进制日志记录了所有对数据库造成更改的事件,包括...

    mysql与java连接的适配包(mysql-connector-java-5.1.47)

    MySQL是世界上最受欢迎的关系型数据库管理系统之一,而Java作为一种广泛应用的编程语言,经常被用来与MySQL进行数据交互。在Java中,我们使用Java Database Connectivity (JDBC) API来连接和操作数据库。MySQL与Java...

    MySQL-connector-java-5.1.46.jar

    总的来说,MySQL-connector-java-5.1.46.jar在Java开发中扮演了至关重要的角色,使得Java应用程序能够无缝连接到MySQL数据库,进行各种数据库操作,同时在项目如“mall-master”中,它也是构建数据库驱动型应用的...

    mysql-entry-to-the-master-03.rar_The Master

    这个“mysql-entry-to-the-master-03.rar_The Master”压缩包,包含了从基础到进阶的教程内容,帮助读者逐步掌握数据库管理的核心技能。 在Windows XP操作系统中安装和配置MySQL是一项基本任务,它涉及到下载安装包...

    Mysql-master-slave.rar_Master/Slave_slave mysql

    下面我们将深入探讨MySQL主从复制的配置、工作原理和相关知识点。 一、主从复制配置 1. **环境准备**:首先,你需要在主服务器和从服务器上安装并配置MySQL。确保两个服务器之间网络连通,并且可以相互访问。 2. ...

    docker-mysql-master-slave-master.zip

    此资源为shardingsphere 调研...内容:一个master mysql docker实例,一个slave docker实例 内置3个库,mydb,mydb0,mydb1。仅开启了这三个库的主从。如果三个库主从不够用,自行配置。 使用:1.解压 2.执行build.sh

    docker-zoneminder-master-mysql5.7-php7.2:Zoneminder-master,最新。 具有Mysql5.7,php7.2和MSMTP的docker映像,基于Isaac Connor的https上的ZoneMinder主快照

    bkjaya1952 / zoneminder-master-docker-latest Zoneminder-master,最新。 具有Mysql5.7和MSMTP的docker映像 基于艾萨克·康纳(Isaac Connor)的ZoneMinder主快照,为 该图像是在ubuntu:bionic上使用zoneminder...

    mha4mysql-node-0.57.tar.gz

    接下来,配置MHA Manager,创建配置文件`manager.conf`,指定MySQL服务器信息、节点监控间隔、日志路径等。同时,也需要在每个MySQL服务器上配置MHA Node,设置其连接信息和监控间隔。 **运行与监控** 启动MHA ...

    mha4mysql-node-0.56.tar.gz和mha4mysql-manager-0.56.tar.gz

    **MySQL高可用解决方案MHA(Master High Availability)** MySQL作为广泛应用的关系型数据库系统,其高可用性和稳定性至关重要。为了确保数据库服务的连续性,开发者和运维人员常常采用各种高可用解决方案,其中MHA...

    利用keepalived构建高可用的MySQL

    #### 四、MySQL Master-Master配置步骤 ##### 4.1 修改MySQL配置文件 为了实现Master-Master架构,需要在两台MySQL服务器上分别进行配置: - **开启binlog日志功能**: 在MySQL配置文件中加入`log-bin=mysql-bin`。 ...

    PHP-MySQL-PDO-Database-Class-master

    标题 "PHP-MySQL-PDO-Database-Class-master" 暗示了这是一个关于使用PHP与MySQL数据库交互的项目,特别强调了使用PDO(PHP Data Objects)扩展。PDO是PHP中的一个数据库访问层,提供了统一的API来连接多种数据库,...

    数据库\使用keepalived构建高可用mysql-HA

    为了实现Master-Master复制,首先需要在两台MySQL服务器上启用二进制日志(binlog),具体操作是在MySQL的配置文件`/etc/mysql/my.cnf`中加入`log-bin=mysql-bin`选项。此外,还需要确保两台服务器的`server-id`设置...

    mysql双机热备同步

    master-host = 192.168.5.10 master-user = bak master-password = '123456' master-port = 3306 master-connect-retry = 10 replicate-do-db = abc ``` 其中,`server_id` 指定了服务器的唯一标识,`log-bin` 指定...

Global site tag (gtag.js) - Google Analytics