MySQL master/slave
Master my.ini
Slave my.ini
Master 執行
mysql> CREATE USER 'rep'@'%' IDENTIFIED BY 'rep';
mysql> GRANT FILE ON *.* TO 'rep'@'%' IDENTIFIED BY 'rep';
mysql> GRANT REPLICATION SLAVE ON *.* TO 'rep'@'%' IDENTIFIED BY 'rep';
mysql> FLUSH PRIVILEGES;
mysql> show master status;
+------------------+----------+--------------+----------------------------------+-------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+----------------------------------+-------------------+
| mysql-bin.000002 | 4570 | test | information_schema,cluster,mysql | |
+------------------+----------+--------------+----------------------------------+-------------------+
Slave 執行
mysql> CREATE USER 'rep'@'%' IDENTIFIED BY 'rep';
mysql> change master to master_host='localhost',master_user='rep',master_password='rep',master_log_file='mysql-bin.000002', master_log_pos=4570;
mysql> start slave;
mysql> show slave status;
Slave_IO_Running 和 Slave_SQL_Running都是 Yes 表示成功。
Master建立資料庫,建立表,新增資料,會自動複製到Slave。
-
basedir = D:\mysql_test\mysql-5.7.17-master
-
datadir = D:\mysql_test\mysql-5.7.17-master\data
-
port = 3306
-
log-bin=mysql-bin
-
server_id=1
-
binlog-ignore-db=information_schema
-
binlog-ignore-db=cluster
-
binlog-ignore-db=mysql
- binlog-do-db=test
-
basedir = D:\mysql_test\mysql-5.7.17-slave
-
datadir = D:\mysql_test\mysql-5.7.17-slave\data
-
port = 3307
-
log-bin=mysql-bin
-
server-id=2
-
binlog-ignore-db=information_schema
-
binlog-ignore-db=cluster
-
binlog-ignore-db=mysql
-
replicate-do-db=test
-
replicate-ignore-db=mysql
-
log-slave-updates
-
slave-skip-errors=all
- slave-net-timeout=60
mysql> CREATE USER 'rep'@'%' IDENTIFIED BY 'rep';
mysql> GRANT FILE ON *.* TO 'rep'@'%' IDENTIFIED BY 'rep';
mysql> GRANT REPLICATION SLAVE ON *.* TO 'rep'@'%' IDENTIFIED BY 'rep';
mysql> FLUSH PRIVILEGES;
mysql> show master status;
+------------------+----------+--------------+----------------------------------+-------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+----------------------------------+-------------------+
| mysql-bin.000002 | 4570 | test | information_schema,cluster,mysql | |
+------------------+----------+--------------+----------------------------------+-------------------+
Slave 執行
mysql> CREATE USER 'rep'@'%' IDENTIFIED BY 'rep';
mysql> change master to master_host='localhost',master_user='rep',master_password='rep',master_log_file='mysql-bin.000002', master_log_pos=4570;
mysql> show slave status;
Slave_IO_Running 和 Slave_SQL_Running都是 Yes 表示成功。
Master建立資料庫,建立表,新增資料,會自動複製到Slave。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10742815/viewspace-2131666/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- The slave I/O thread stops because master and slave have equal MySQL server UUIDthreadASTMySqlServerUI
- Mysql 5.6 Master和Slave 主備切換MySqlAST
- Mysql Master-slave複製簡單配置記錄MySqlAST
- Mysqldump實現mysql的master-slave主從複製MySqlAST
- mysql slave 跟進 master 的關鍵狀態指標MySqlAST指標
- MySQL報錯Slave: received end packet from server, apparent master shutdownMySqlServerAPPAST
- Setup MariaDB Master/Slave Replication for Docker MariaDBASTDocker
- Innobackupex實現mysql線上搭建master-slave主從複製MySqlAST
- 故障案例:主從同步報錯Fatal error: The slave I/O thread stops because master and slave have equal MySQL server主從同步ErrorthreadASTMySqlServer
- 資料庫讀寫分離Master-Slave資料庫AST
- CentOS中MySQL5.6 資料庫主從(Master/Slave)同步安裝與配置詳解CentOSMySql資料庫AST
- 使用etcd選舉sdk實踐master/slave故障轉移AST
- 分散式資料中的坑(一)Master-Slave架構分散式AST架構
- 基於Kubernetes構建企業Jenkins master/slave CI/CD平臺JenkinsAST
- MySQL複製跳過錯誤--slave_skip_errors、sql_slave_skip_counter、slave_exec_modeMySqlError
- MySQ 資料庫主從同步安裝與配置詳解(Master/Slave)資料庫主從同步AST
- 實屬無奈!Redis 作者被迫修改 master-slave 架構的描述RedisAST架構
- MYSQL Slave開機啟動指令碼MySql指令碼
- MySQL5.7 Master-Master主主搭建for Centos7MySqlASTCentOS
- Redis for linux原始碼&叢集(cluster)&主從(master-slave)&哨兵(sentinel)安裝配置RedisLinux原始碼AST
- MySQL複製命令slave被REPLICA命令取代MySql
- [MySQL進階之路][No.0002] SHOW SLAVE STATUSMySql
- mysql MASTER_POS_WAIT函式MySqlASTAI函式
- 故障分析 | MySQL : slave_compressed_protocol 導致 crashMySqlProtocol
- MySQL:關於Wating for Slave workers to free pending events等待MySql
- 從Mysql slave system lock延遲說開去MySql
- 手把手教你寫一個自己的 master-slave 架構的 TCP 伺服器AST架構TCP伺服器
- jenkins slave節點上的job構建記錄 都只會在master伺服器JenkinsAST伺服器
- zabbix應用-監控mysql slave 主從狀態MySql
- MySQL中slave監控的延遲情況分析MySql
- 1.MongoDB 2.7主從複製(master –> slave)環境基於時間點的恢復MongoDBAST
- MySQL主從複製配置引數 -- logs-slave-updatesMySql
- 【MySQL】六、常見slave 延遲原因以及解決方法MySql
- Linux官網被黑, Redis 被要求修改 “master-slave”幕後:政治正確會毀了技術嗎?LinuxRedisAST
- Mysql 建立心跳錶來監控Replication的Slave是否延遲MySql
- mysql同步問題之Slave延遲很大最佳化方法MySql
- MySQL:show slave status 關鍵值和MGRrelay log的清理策略MySql
- ! [rejected] master -> master (fetch first)AST
- MySQL主從複製中的“show slave status”詳細含義MySql