One, download install, in MySQL and install from above
1. Download MySQL
Cd/usr/local/src
wget http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.14.tar.gz
TAR-ZXVF mysql-5.6.14.tar.gz
CD mysql-5.6.14
Cmake-dcmake_install_prefix=/usr/local/mysql5.6-dmysql_datadir=/data/mysql5.6/data-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
Make && make install
Ii. creating a Data directory configuration file
1, the initialization of the work
Mkdir-p/data/mysql5.6/data
Useradd mysql-s/sbin/nologin
passwd MySQL
Chown-r mysql.mysql/data/mysql5.6
cd/usr/local/mysql.5.6/
CP SUPPORT-FILES/MY-DEFAULT.CNF/ETC/MY.CNF
CP Support-files/mysql.server/etc/init.d/mysqld
Ln-s./bin*/usr/local/bin
./scripts/mysql_install_db--basedir=/usr/local/mysql5.6/--datadir=/data/mysql5.6/data/--user=mysql
Third, MySQL master configuration
1. Configuration files
Shell>vim/etc/my.cnf
Server-id = 1 #一定不能和slave上的server-id Same, must be unique
Log-bin=master-bin.log
Sync_binlog=1
Innodb_buffer_pool_size = 5600M
Innodb_flush_log_at_trx_commit=1
Sql_mode=strict_trans_tables,no_auto_create_user,no_engine_substitution,no_auto_value_on_zero
Lower_case_table_names=1
Log_bin_trust_function_creators=1
Binlog_format = row
slave_parallel_workers=4 #--Open Library-based multi-threaded replication default 0 does not turn on
Binlog_cache_size = 8M
Max_binlog_size = 50M
Max_binlog_cache_size = 100M
Expire_logs_days = 1
Log-slave-updates=true
Rpl_semi_sync_master_enabled=on
Service mysqld Start
2, set the master-slave user
Mysql-uroot-p
Grant Replication Slave on * * to ' repl ' @ ' 192.168.10.2 ' identified by ' repl ';
Show master status; #记录master上的logfile and position
Iv. MySQL from settings
1. Configuration files
Server-id = 2 #一定不能和master上的server-id same
Log-bin = Slave-bin.log
Sync_binlog = 1
Innodb_buffer_pool_size = 512M
Innodb_flush_log_at_trx_commit = 1
Sql_mode=strict_trans_tables,no_auto_create_user,no_engine_substitution,no_auto_value_on_zero
Lower_case_table_names = 1
Log_bin_trust_function_creators = 1
Binlog_format = row
Binlog_cache_size = 8M
Max_binlog_size = 50M
Max_binlog_cache_size = 100M
Expire_logs_days = 1
Slave_parallel_workers=4
Max_relay_log_size = 50M
Relay_log_purge = 1
Relay_log_recovery = 1
Master_verify_checksum = 1 #--Main Event Check
Slave_sql_verify_checksum = 1 #--from event checksum
slave_allow_batching = 1
Log-slave-updates=true
Service mysqld Start
2. Turn on the sync thread from the library
Mysql-uroot-p
Change Master to master_ip= ' 192.168.10.1 ', master_user= ' repl ', master_password= ' repl ', master_log_file= ' Slave-bin.000003 ', master_log_pos=5569;
Start slave;
show slave status\g;
#Slave_IO_Running: Yes
#Slave_SQL_Running: Yes
Two of the above outputs are yes and are OK
V. Configuring MySQL master server semi-sync
1. Modify the configuration file to add parameters
Rpl_semi_sync_master_enabled=on
2. Go to MySQL command line to install the semi-synchronous plugin
INSTALL PLUGIN rpl_semi_sync_slave SONAME ' semisync_master.so ';
Show global viriables like ' rpl_semi_% '
+------------------------------------+-------+
| variable_name | Value |
+------------------------------------+-------+
| rpl_semi_sync_master_enabled | On |
| Rpl_semi_sync_master_timeout | 10000 |
| Rpl_semi_sync_master_trace_level | 32 |
| Rpl_semi_sync_master_wait_no_slave | On |
+------------------------------------+-------+
The installation succeeds #rpl_semi_sync_master_enabled is on
Restart MySQL Master
Servive mysqld Restart
Six, configure MySQL slave server semi-synchronous
1. Modify the configuration file to add parameters
Rpl_semi_sync_slave_enabled=on
2. Go to MySQL command line to install the semi-synchronous plugin
INSTALL PLUGIN rpl_semi_sync_master SONAME ' semisync_slave.so ';
Show globle viriables like ' rpl_semi_% '
The installation succeeds #rpl_semi_sync_slave_enabled is on
+---------------------------------+-------+
| variable_name | Value |
+---------------------------------+-------+
| rpl_semi_sync_slave_enabled | On |
| Rpl_semi_sync_slave_trace_level | 32 |
+---------------------------------+-------+
Complete.
This article from "Beginner's mind, always" blog, declined reprint!
mysql5.6 installation and master-slave configuration