MySQL 5.6 based on Gtid master-slave replication (this is: MariaDB-10)
The gtid (Global Transaction IDs) introduced by MySQL 5.6 makes the configuration, monitoring, and management of its replication capabilities easier to implement and more robust. Gtid is a unique, unique representation of the server's UUID, which is a globally unique identifier, consisting of a 128-bit random character, and mysql-5.6 relies on Server-id and UUID to mark each host in the replication schema, since it is a 128-bit random string The global does not repeat, the Server-id and UUID, and the sequence number of each MySQL thing is the only gtid, since the introduction of mysql-5.6 every binary log in each of the first of each thing will be written gtid tag, So Gtid makes it very easy to track and compare replication things and to recover quickly from crashes. In particular, the INNODB engine must be implemented with the help of gtid in order to achieve high-availability functionality.
MySQL ' s replication 650) this.width=650; "Width=" 691 "height=" 434 "title=" 29.png "style=" WIDTH:724PX;HEIGHT:396PX; "alt=" Wkiol1nrbczyhfjlaae2kajfkp8259.jpg "src=" Http://s3.51cto.com/wyfs02/M00/26/90/wKioL1NrbczyHfJLAAE2KAJFkp8259.jpg "/> the host environment is:650) this.width=650; "Width=" 710 "height=" 102 "title=" 30.png "style=" width:716px;height:103px; "alt=" Wkiol1nrcmdzlhu_aabaojl88da430.jpg "src=" http://s3.51cto.com/wyfs02/M02/26/90/ Wkiom1nrfm3rp8o0aacetvibsrk561.jpg "/> This blog post is configured with MARIADB-10 Gtid multi-threaded, the following is the configuration steps:
First, configure the master node1. Configure Host Name:650) this.width=650; "Width=" 913 "height=" "title=" 1.png "style=" Width:744px;height:57px;float:none; "alt=" Wkiom1nrzrcz6retaaclp4pkedy080.jpg "src=" Http://s3.51cto.com/wyfs02/M00/26/8F/wKiom1NrZrCz6rETAACLp4pkeDY080.jpg "/>2, Stop the service:650) this.width=650; "Width=" 908 "height=" "title=" 2.png "style=" Width:752px;height:59px;float:none; "alt=" Wkiol1nrzoegtw2saabvumjxyrw792.jpg "src=" Http://s3.51cto.com/wyfs02/M02/26/8F/wKioL1NrZoegtW2sAABVumJXyrw792.jpg "/>3. Modify the configuration file:650) this.width=650; "Width=" 898 "height=" 403 "title=" 3.png "style=" Width:757px;height:374px;float:none; "alt=" Wkiom1nrzrosamshaai0zhdqq2e850.jpg "src=" Http://s3.51cto.com/wyfs02/M01/26/8F/wKiom1NrZrOSamshAAI0ZhdQQ2E850.jpg "/>
4, the creation of the directory and the main genus group:650) this.width=650; "Width=" 904 "height=" "title=" 4.png "style=" Width:759px;height:60px;float:none; "alt=" Wkiom1nrzrphwppgaaczyl-lxqq571.jpg "src=" Http://s3.51cto.com/wyfs02/M01/26/8F/wKiom1NrZrPhwPpgAACZyl-LxQQ571.jpg "/>5,To Modify the hosts:650) this.width=650; "Width=" 903 "height=" "title=" 5.png "style=" Width:763px;height:73px;float:none; "alt=" Wkiol1nrzontw55paabyhsd-8jm228.jpg "src=" Http://s3.51cto.com/wyfs02/M00/26/8F/wKioL1NrZonTw55PAAByhSd-8jM228.jpg "/>6, remote replication to the slave host:650) this.width=650; "Width=" 906 "height=" title= "6.png" style= "Width:771px;height:137px;float:none;" alt= " Wkiom1nrzrtygl2paag3vnrjvu0887.jpg "src=" Http://s3.51cto.com/wyfs02/M02/26/8F/wKiom1NrZrTygl2pAAG3VnRjVU0887.jpg "/>7, test whether can ping through slave:650) this.width=650; "Width=" 908 "height=" title= "7.png" style= "Width:774px;height:129px;float:none;" alt= " Wkiol1nrzoqaxetlaaf2sfktpec805.jpg "src=" Http://s3.51cto.com/wyfs02/M01/26/8F/wKioL1NrZoqAXetLAAF2SFKTpEc805.jpg "/>8. Start the service:650) this.width=650; "Width=" 905 "height=" "title=" 8.png "style=" Width:775px;height:40px;float:none; "alt=" Wkiom1nrzrxhc85qaabx-opbw9u954.jpg "src=" Http://s3.51cto.com/wyfs02/M00/26/8F/wKiom1NrZrXhc85QAABX-opBW9U954.jpg "/>9. View Gtid Information:650) this.width=650; "Width=" 898 "height=" 247 "title=" 9.png "style=" Width:773px;height:224px;float:none; "alt=" Wkiol1nrzoucpwq2aafyku_gmly458.jpg "src=" Http://s3.51cto.com/wyfs02/M02/26/90/wKioL1NrZouCPWq2AAFYKu_gMlY458.jpg "/>
Second, configure the slave node1. Configure Host Name:650) this.width=650; "Width=" 908 "height=" "title=" 10.png "style=" Width:773px;height:55px;float:none; "alt=" Wkiom1nrzratjexkaabj3nqsr0s486.jpg "src=" Http://s3.51cto.com/wyfs02/M01/26/8F/wKiom1NrZraTJexKAABj3NqSR0s486.jpg "/>2, Stop the service:650) this.width=650; "Width=" 905 "height=" "title=" 11.png "style=" Width:773px;height:45px;float:none; "alt=" Wkiol1nrzo2jk94laabequzaara266.jpg "src=" Http://s3.51cto.com/wyfs02/M00/26/90/wKioL1NrZo2jK94lAABeqUZAArA266.jpg "/>3. Modify the configuration file:650) this.width=650; "Width=" 903 "height=" 399 "title=" 12.png "style=" Width:780px;height:376px;float:none; "alt=" Wkiom1nrzrixxhf6aaioloovl88867.jpg "src=" Http://s3.51cto.com/wyfs02/M02/26/8F/wKiom1NrZrixxHf6AAIoLOovL88867.jpg "/>4. Create a directory and modify the owner of the genus Group:650) this.width=650; "Width=" 902 "height=" title= "13.png" style= "Width:784px;height:56px;float:none;" alt= " Wkiol1nrzo_tj6-gaacsdmb7jng842.jpg "src=" Http://s3.51cto.com/wyfs02/M01/26/90/wKioL1NrZo_Tj6-GAACSDMb7Jng842.jpg "/>5. Start the service:650) this.width=650; "Width=" 906 "height=" title= "14.png" style= "Width:790px;height:45px;float:none;" alt= " Wkiom1nrzrqana70aabunv9n8ki001.jpg "src=" Http://s3.51cto.com/wyfs02/M00/26/8F/wKiom1NrZrqAna70AABUnV9N8KI001.jpg "/>6. Test if you can ping the master:650) this.width=650; "Width=" 908 "height=" 153 "title=" 15.png "style=" Width:794px;height:138px;float:none; "alt=" Wkiol1nrzpgg0jjyaaf42_veyxw368.jpg "src=" Http://s3.51cto.com/wyfs02/M02/26/90/wKioL1NrZpGg0jjYAAF42_vEYxw368.jpg "/>7. View Gtid Information:650) this.width=650; "Width=" 909 "height=" 244 "title=" 16.png "style=" Width:796px;height:239px;float:none; "alt=" Wkiom1nrzr3djm5jaafevvz8dzy078.jpg "src=" Http://s3.51cto.com/wyfs02/M01/26/8F/wKiom1NrZr3DjM5JAAFeVVz8DZY078.jpg "/>
Third, verify the effect and create authorized users1, Master Create authorized users:650) this.width=650; "Width=" 910 "height=" 123 "title=" 17.png "style=" Width:798px;height:117px;float:none; "alt=" Wkiol1nrzpoybzvlaadwh3ull5g893.jpg "src=" Http://s3.51cto.com/wyfs02/M00/26/90/wKioL1NrZpOyBZVLAADwh3uLL5g893.jpg "/>2. Slave points to the specified copy location:650) this.width=650; "Width=" 909 "height=" "title=" 18.png "style=" Width:801px;height:62px;float:none; "alt=" Wkiom1nrzr_ik5_eaadigji6i1y880.jpg "src=" Http://s3.51cto.com/wyfs02/M02/26/8F/wKiom1NrZr_ik5_eAADIgJI6i1Y880.jpg "/>3, slave start synchronization:650) this.width=650; "width=" 912 "height=" "title=" 19.png "style=" Width:800px;height:37px;float:none; "alt=" Wkiol1nrzpxsa4qoaabnko71gls580.jpg "src=" Http://s3.51cto.com/wyfs02/M00/26/90/wKioL1NrZpXSA4qOAABNko71gls580.jpg "/>4. Slave to see if synchronization is enabled successfully:650) this.width=650; "Width=" 909 "height=" 327 "title=" 20.png "style=" Width:802px;height:322px;float:none; "alt=" Wkiol1nrzpaq7wbaaaij83sxlwc493.jpg "src=" Http://s3.51cto.com/wyfs02/M01/26/90/wKioL1NrZpaQ7WbaAAIJ83sXlwc493.jpg "/>5. Slave to see if there is a mydb library:650) this.width=650; "Width=" 906 "height=" 198 "title=" 21.png "style=" Width:805px;height:185px;float:none; "alt=" Wkiom1nrzskxvi_waac8zudedmy026.jpg "src=" Http://s3.51cto.com/wyfs02/M02/26/90/wKiom1NrZsKxvI_wAAC8ZudeDMY026.jpg "/>6, master view the number of slave:650) this.width=650; "Width=" 902 "height=" "title=" 22.png "style=" Width:808px;height:126px;float:none; "alt=" Wkiol1nrzpjwjqovaadrgvohtzw305.jpg "src=" Http://s3.51cto.com/wyfs02/M01/26/90/wKioL1NrZpjwJqovAADrGVOhTzw305.jpg "/>7. Master Create library:650) this.width=650; "Width=" 904 "height=" 247 "title=" 23.png "style=" Width:815px;height:235px;float:none; "alt=" Wkiom1nrzspsctfoaad8utnd_iy961.jpg "src=" Http://s3.51cto.com/wyfs02/M00/26/90/wKiom1NrZsPScTFOAAD8utnD_IY961.jpg "/>8, slave check whether synchronization:650) this.width=650; "Width=" 899 "height=" 207 "title=" 24.png "style=" Width:817px;height:204px;float:none; "alt=" Wkiol1nrzpnrrohiaaday0capxa245.jpg "src=" Http://s3.51cto.com/wyfs02/M02/26/90/wKioL1NrZpnRRoHiAADAy0CAPXA245.jpg "/>
9, this time you want to with the following this command combination of use, to see the dynamic results, you can open two windows, I here may be because the data volume is too small, so see does not change:9.1 Master Imports large amounts of data:650) this.width=650; "Width=" "height=" title= "25.png" style= "Width:823px;height:22px;float:none;" alt= " Wkiom1nrzsxhbkvqaaamn_odbe4168.jpg "src=" Http://s3.51cto.com/wyfs02/M01/26/90/wKiom1NrZsXhBKVqAAAmn_oDBE4168.jpg "/>
9.2 Slave See changes in master Import data:650) this.width=650; "Width=" 903 "height=" "title=" 26.png "style=" Width:822px;height:63px;float:none; "alt=" Wkiol1nrzpuscyjtaacr3hg-g5y456.jpg "src=" Http://s3.51cto.com/wyfs02/M00/26/90/wKioL1NrZpuScYjtAACr3HG-g5Y456.jpg "/>
9.3 Slave See changes in master Import data:650) this.width=650; "Width=" 911 "height=" 345 "title=" 27.png "style=" Width:824px;height:326px;float:none; "alt=" Wkiom1nrzsain9hkaajutituea0394.jpg "src=" Http://s3.51cto.com/wyfs02/M02/26/90/wKiom1NrZsain9hKAAJUtITueA0394.jpg "/>9.3.1 and comparison:650) this.width=650; "Width=" 914 "height=" 344 "title=" 28.png "style=" Width:822px;height:329px;float:none; "alt=" Wkiom1nrzsediramaai_yqmlku4761.jpg "src=" Http://s3.51cto.com/wyfs02/M00/26/90/wKiom1NrZseDIRaMAAI_yqMlKu4761.jpg "/>
10. Master View Thread Information:
MariaDB [(None)]> SHOW processlist;+----+-------------+------------------------+------+-------------+------+-- ---------------------------------------------------------------------+------------------+----------+| Id | User | Host | db | Command | Time | State | Info | Progress |+----+-------------+------------------------+------+-------------+------+----------------------------- ------------------------------------------+------------------+----------+| 3 | System user | | NULL | Connect | 1785 | Waiting for work from SQL thread | NULL | 0.000 | | 4 | System user | | NULL | Connect | 1785 | Waiting for work from SQL thread | NULL | 0.000 | | 8 | Repluser | slave.xiaoma.com:41243 | NULL | Binlog Dump | 954 | Master has SENT all binlog to slave; Waiting for Binlog to be updated | NULL | 0.000 | | 17 | Root | localhost | NULL | Query | 0 | init | SHOW Processlist | 0.000 |+----+-------------+------------------------+------+-------------+------+-------------------------------- ---------------------------------------+------------------+----------+4 rows in Set (0.00 sec) MariaDB [(None)]>
11, slave View thread information:
MariaDB [(None)]> SHOW processlist;+----+-------------+-----------+------+---------+---------+---------------- -------------------------------------------------------------+------------------+----------+| Id | User | Host | db | Command | Time | State | Info | Progress |+----+-------------+-----------+------+---------+---------+------------------------------------------- ----------------------------------+------------------+----------+| 3 | System user | | NULL | Connect | 3225828 | Waiting for work from SQL thread | NULL | 0.000 | | 4 | System user | | NULL | Connect | 3225828 | Waiting for work from SQL thread | NULL | 0.000 | | 6 | Root | localhost | NULL | Query | 0 | Init | SHOW Processlist | 0.000 | | 7 | System user | | NULL | Connect | 1006 | Waiting for Master to send event | NULL | 0.000 | | 8 | System user | | NULL | Connect | 535 | Slave have read all relay log; Waiting for the slave I/O thread to update it | NULL | 0.000 |+----+-------------+-----------+------+---------+---------+---------------------------------------------- -------------------------------+------------------+----------+5 rows in Set (0.00 sec) MariaDB [(None)]>
Welcome to the Xiaomazi blog!!
This article is from the "ghost-fearing little girl" blog, please be sure to keep this source http://xiaomazi.blog.51cto.com/5891742/1408559