Maison > base de données > tutoriel mysql > le corps du texte

Mysql 5.6 主从

WBOY
Libérer: 2016-06-07 16:40:02
original
846 Les gens l'ont consulté

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
Copier après la connexion

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;

Étiquettes associées:
source:php.cn
Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Tutoriels populaires
Plus>
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal