Home > Database > Mysql Tutorial > body text

Mysql 5.6 主从

WBOY
Release: 2016-06-07 16:40:02
Original
846 people have browsed it

yum -y install make gcc-c++ cmake bison-devel ?ncurses-devel configure.sh: cmake \-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \-DMYSQL_DATADIR=/data/mysql \-DSYSCONFDIR=/etc \-DWITH_MYISAM_STORAGE_ENGINE=1 \-DWITH_INNOBASE_STORAGE_ENGINE=1 \-D

yum -y install make gcc-c++ cmake bison-devel ?ncurses-devel

configure.sh:

cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/data/mysql \
-DSYSCONFDIR=/etc \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock \
-DMYSQL_TCP_PORT=3306 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci
Copy after login

useradd mysql

mkdir -p /data/mysql

./mysql_install_db –basedir=/usr/local/mysql –datadir=/data/mysql/ –user=mysql

ln -s /usr/local/mysql/bin/* /usr/sbin/

主从

Master:

配置:

[mysqld]

log-bin=master-bin

log-bin-index=master-bin.index

innodb_file_per_table = 1

max_connections = 3000

socket=/var/lib/mysql/mysql.sock

log-bin=

binlog-format=ROW

log-slave-updates=true

gtid-mode=on

enforce-gtid-consistency=true

master-info-repository=TABLE

relay-log-info-repository=TABLE

sync-master-info=1

slave-parallel-workers=2

binlog-checksum=CRC32

master-verify-checksum=1

slave-sql-verify-checksum=1

binlog-rows-query-log_events=1

report-port=3306

port=3306

report-host=125.210.*.*

server_id = 1

slow-query-log-file =/data/mysql/query-slow.log

long_query_time=5

explicit_defaults_for_timestamp = true

SLAVE:

配置:

[mysqld]

log-bin=master-bin

log-bin-index=master-bin.index

innodb_file_per_table = 1

relay-log = relay-log

relay-log-index = relay-log.index

binlog-format=ROW

log-slave-updates=true

gtid-mode=on

enforce-gtid-consistency=true

master-info-repository=TABLE

relay-log-info-repository=TABLE

sync-master-info=1

slave-parallel-workers=2

binlog-checksum=CRC32

master-verify-checksum=1

slave-sql-verify-checksum=1

binlog-rows-query-log_events=1

report-port=3306

port=3306

report-host=125.210.136.132

server_id = 10

控制台启动同步

change master to master_host=’125.210.*.*’,master_user=’repl’,master_password=’repl_pass’,master_auto_position=1;

Query OK, 0 rows affected, 2 warnings (0.15 sec)

start slave;

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template