{"id":4208,"date":"2023-05-26T19:19:38","date_gmt":"2023-05-26T17:19:38","guid":{"rendered":"https:\/\/tech.lobobrothers.com\/mysql-8-master-slave\/"},"modified":"2025-02-06T13:19:20","modified_gmt":"2025-02-06T12:19:20","slug":"mysql-8-master-slave","status":"publish","type":"post","link":"https:\/\/tech.lobobrothers.com\/en\/mysql-8-master-slave\/","title":{"rendered":"MySQL 8 Master\/Slave"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"4208\" class=\"elementor elementor-4208 elementor-3892\" data-elementor-post-type=\"post\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-35ce65a elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"35ce65a\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-d3d2a24\" data-id=\"d3d2a24\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-bc865cb elementor-widget elementor-widget-text-editor\" data-id=\"bc865cb\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<h2><strong>MYSQL MASTER\/SLAVE REPLICATION<\/strong><\/h2>\n<p>We will see one of the most used architectures, where we will have a mysql master for writing\/reading and nodes in slave mode for reading only, allowing us to distribute the load between several machines for reading using for example HAProxy, which we will make a post about how to use in pfsense due to the great reception of the posts on this blog about it.<\/p>\n<p>We will do this installation in centos, but understanding the concept you can do it in any distro because it is basically the same changing only the way of installation.<\/p>\n<p><strong>Master<\/strong><\/p>\n<p>We start updating<\/p>\n<p style=\"padding-left: 40px;\">yum -y update<\/p>\n<p>We download the most recent version or the one you like, as I mentioned in the post <a href=\"https:\/\/tech.lobobrothers.com\/en\/cluster-mysql-8-centos\/\">Cluster Mysql 8 Centos<\/a> We will use version 8.0.20, a version that has given me zero problems compared to the higher ones.<\/p>\n<p style=\"padding-left: 40px;\">wget https:\/\/cdn.mysql.com\/archives\/mysql-8.0\/mysql-community-libs-8.0.20-1.el7.x86_64.rpm<br \/>\nwget https:\/\/cdn.mysql.com\/archives\/mysql-8.0\/mysql-community-client-8.0.20-1.el7.x86_64.rpm<br \/>\nwget https:\/\/cdn.mysql.com\/archives\/mysql-8.0\/mysql-community-common-8.0.20-1.el7.x86_64.rpm<br \/>\nwget https:\/\/cdn.mysql.com\/archives\/mysql-8.0\/mysql-community-server-8.0.20-1.el7.x86_64.rpm<\/p>\n<p>We install<\/p>\n<p style=\"padding-left: 40px;\">rpm -Uvh mysql-community-*<\/p>\n<p>We enable the service and start it<\/p>\n<p style=\"padding-left: 40px;\">systemctl enable mysqld<br \/>\nsystemctl start mysqld<\/p>\n<p>During the installation it creates a temporary root password that we can locate with the following command:<\/p>\n<p style=\"padding-left: 40px;\">grep &#8216;temporary password&#8217; \/var\/log\/mysqld.log<\/p>\n<p>Having the password we secure the installation.<\/p>\n<p style=\"padding-left: 40px;\">mysql_secure_installation<\/p>\n<p>It will ask us questions<\/p>\n<p style=\"padding-left: 40px;\">The first thing is to set the new root password<\/p>\n<p style=\"padding-left: 40px;\">It will ask us if we want to remove anonymous users, we say Yes.<\/p>\n<p style=\"padding-left: 40px;\">Then if we want root to be able to log in remotely. Here it is best to say no and then give it remote permission from our IP as long as it is fixed.<\/p>\n<p style=\"padding-left: 40px;\">It continues asking us if we want to delete the test database, we say yes.<\/p>\n<p style=\"padding-left: 40px;\">And finally if we want to apply by doing a Reload privileges.<\/p>\n<p>Now we edit my.cnf<\/p>\n<p style=\"padding-left: 40px;\">nano \/etc\/my.cnf<\/p>\n<p>indicating the data directory, I always like to put it in \/data previously created, the id that it will have and we will activate binlog since without it we would be nobody in this scenario, remaining as follows (we will not go into other details since each one will have to do the corresponding tuning to get the best performance)<\/p>\n<p style=\"padding-left: 40px;\">datadir=\/data<br \/>\nsocket=\/var\/lib\/mysql\/mysql.sock<\/p>\n<p style=\"padding-left: 40px;\">log-error=\/var\/log\/mysqld.log<br \/>\npid-file=\/var\/run\/mysqld\/mysqld.pid<\/p>\n<p style=\"padding-left: 40px;\">server-id=1<br \/>\nlog_bin=mysql-bin<\/p>\n<p>We restarted the service<\/p>\n<p style=\"padding-left: 40px;\">systemctl restart mysqld<\/p>\n<p>And we proceed to create a user for the replicas. Let&#8217;s assume that our master has the IP 172.17.17.1 and our slave has the IP 172.17.17.2<\/p>\n<p style=\"padding-left: 40px;\">mysql -u root -p<\/p>\n<p style=\"padding-left: 40px;\">CREATE USER &#8216;replicate&#8217;@&#8217;172.17.17.2&#8217; IDENTIFIED BY &#8216;passwordreplica&#8217;;<br \/>\nGRANT REPLICATION SLAVE ON *.* TO &#8216;replicate&#8217;@&#8217;172.17.17.2&#8217;;<\/p>\n<p>If we wanted to have a second replica with the IP 172.17.17.3, the same thing happens but we change the IP. Two replicas is a good number for most scenarios.<\/p>\n<p style=\"padding-left: 40px;\">CREATE USER &#8216;replicate&#8217;@&#8217;172.17.17.3&#8217; IDENTIFIED BY &#8216;passwordreplica&#8217;;<br \/>\nGRANT REPLICATION SLAVE ON *.* TO &#8216;replicate&#8217;@&#8217;172.17.17.3&#8217;;<\/p>\n<p>Once we have this we will see the position in which we have the master and then indicate it to the slaves, this position will not change until we work with this mysql. As we continue within the mysql console we execute<\/p>\n<p style=\"padding-left: 40px;\">SHOW MASTER STATUS\\G<\/p>\n<p>And he will give us this back<\/p>\n<p style=\"padding-left: 40px;\">File: mysql-bin.000005<br \/>\nPosition: 722<\/p>\n<p>Keep in mind that if you already have a mysql and you want to add a replica, you will have to block the work on it, that is, make sure there are no changes, otherwise it will be impossible, since each time you execute the previous command it will return a different position.<\/p>\n<p>Well, we&#8217;ll keep the user we created and this last piece of information.<\/p>\n<p><strong>Slave<\/strong><\/p>\n<p>Same steps that we have carried out in the master until editing the my.cnf<\/p>\n<p style=\"padding-left: 40px;\">nano \/etc\/my.cnf<\/p>\n<p>The only thing that will change is the server id, if you have more replicas then you will increase this server id.<\/p>\n<p style=\"padding-left: 40px;\">datadir=\/data<br \/>\nsocket=\/var\/lib\/mysql\/mysql.sock<\/p>\n<p style=\"padding-left: 40px;\">log-error=\/var\/log\/mysqld.log<br \/>\npid-file=\/var\/run\/mysqld\/mysqld.pid<\/p>\n<p style=\"padding-left: 40px;\">server-id=2<br \/>\nlog_bin=mysql-bin<\/p>\n<p>We restart service<\/p>\n<p style=\"padding-left: 40px;\">systemctl restart mysqld<\/p>\n<p>We connect to the mysql console<\/p>\n<p style=\"padding-left: 40px;\">mysql -u root -p<\/p>\n<p>And we write<\/p>\n<p style=\"padding-left: 40px;\">STOP SLAVE;<\/p>\n<p style=\"padding-left: 40px;\">CHANGE MASTER TO<br \/>\nMASTER_HOST=&#8217;172.17.17.1&#8242;,<br \/>\nMASTER_USER=&#8217;replicate&#8217;,<br \/>\nMASTER_PASSWORD=&#8217;passwordreplica&#8217;,<br \/>\nMASTER_LOG_FILE=&#8217;mysql-bin.000005&#8242;,<br \/>\nMASTER_LOG_POS=722;<br \/>\nSTART SLAVE;<\/p>\n<p>As we have previously mentioned, we are indicating who the master is, the user we will use and the position it is in, if this position has changed, it will fail.<\/p>\n<p>We can check the status by running in the console<\/p>\n<p style=\"padding-left: 40px;\">SHOW MASTER STATUS\\G<\/p>\n<p>Where it will give us a lot of data about the replica, an important parameter being the state<\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-3900 size-full\" src=\"https:\/\/tech.lobobrothers.com\/wp-content\/uploads\/2023\/05\/mysql-slave-es.png\" alt=\"slave sql running state\" width=\"604\" height=\"22\" srcset=\"https:\/\/tech.lobobrothers.com\/wp-content\/uploads\/2023\/05\/mysql-slave-es.png 604w, https:\/\/tech.lobobrothers.com\/wp-content\/uploads\/2023\/05\/mysql-slave-es-300x11.png 300w, https:\/\/tech.lobobrothers.com\/wp-content\/uploads\/2023\/05\/mysql-slave-es-570x22.png 570w, https:\/\/tech.lobobrothers.com\/wp-content\/uploads\/2023\/05\/mysql-slave-es-600x22.png 600w\" sizes=\"(max-width: 604px) 100vw, 604px\" \/><\/p>\n<p>We can see that he has read everything and is waiting for more updates to the master.<\/p>\n<p>As always, a pleasure and have a good weekend.<\/p>\n<p>TL.<\/p>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-b258029 elementor-widget elementor-widget-heading\" data-id=\"b258029\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">FAQS<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-7b4c54b elementor-widget elementor-widget-toggle\" data-id=\"7b4c54b\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"toggle.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-toggle\">\n\t\t\t\t\t\t\t<div class=\"elementor-toggle-item\">\n\t\t\t\t\t<div id=\"elementor-tab-title-1291\" class=\"elementor-tab-title\" data-tab=\"1\" role=\"button\" aria-controls=\"elementor-tab-content-1291\" aria-expanded=\"false\">\n\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-toggle-icon elementor-toggle-icon-left\" aria-hidden=\"true\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-toggle-icon-closed\"><svg class=\"e-font-icon-svg e-fas-caret-right\" viewBox=\"0 0 192 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M0 384.662V127.338c0-17.818 21.543-26.741 34.142-14.142l128.662 128.662c7.81 7.81 7.81 20.474 0 28.284L34.142 398.804C21.543 411.404 0 402.48 0 384.662z\"><\/path><\/svg><\/span>\n\t\t\t\t\t\t\t\t<span class=\"elementor-toggle-icon-opened\"><\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t<a class=\"elementor-toggle-title\" tabindex=\"0\">What is Master-Slave Replication in MySQL and What is it Used For?<\/a>\n\t\t\t\t\t<\/div>\n\n\t\t\t\t\t<div id=\"elementor-tab-content-1291\" class=\"elementor-tab-content elementor-clearfix\" data-tab=\"1\" role=\"region\" aria-labelledby=\"elementor-tab-title-1291\"><p>Master-Slave replication in MySQL is a configuration where one server acts as the master and one or more servers act as slaves. The master server handles write and read operations, while the slaves primarily handle read operations. This architecture is used to distribute the workload, improve performance, and provide redundancy for disaster recovery.<\/p>\n<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t<div class=\"elementor-toggle-item\">\n\t\t\t\t\t<div id=\"elementor-tab-title-1292\" class=\"elementor-tab-title\" data-tab=\"2\" role=\"button\" aria-controls=\"elementor-tab-content-1292\" aria-expanded=\"false\">\n\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-toggle-icon elementor-toggle-icon-left\" aria-hidden=\"true\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-toggle-icon-closed\"><svg class=\"e-font-icon-svg e-fas-caret-right\" viewBox=\"0 0 192 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M0 384.662V127.338c0-17.818 21.543-26.741 34.142-14.142l128.662 128.662c7.81 7.81 7.81 20.474 0 28.284L34.142 398.804C21.543 411.404 0 402.48 0 384.662z\"><\/path><\/svg><\/span>\n\t\t\t\t\t\t\t\t<span class=\"elementor-toggle-icon-opened\"><\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t<a class=\"elementor-toggle-title\" tabindex=\"0\">What are the benefits of implementing Master-Slave replication in MySQL?<\/a>\n\t\t\t\t\t<\/div>\n\n\t\t\t\t\t<div id=\"elementor-tab-content-1292\" class=\"elementor-tab-content elementor-clearfix\" data-tab=\"2\" role=\"region\" aria-labelledby=\"elementor-tab-title-1292\"><p>Implementing Master-Slave replication offers several benefits, including:<\/p>\n<ul>\n<li><strong>Load balancing:<\/strong> Read queries can be distributed across slave servers, reducing the load on the master.<\/li>\n<li><strong>High availability:<\/strong> In the event of a master server failure, slaves can be promoted to take over the master role, minimizing downtime.<\/li>\n<li><strong>Non-disruptive backups:<\/strong> Backups can be performed on slaves without impacting master performance.<\/li>\n<li><strong>Analysis and reporting:<\/strong> Read-intensive tasks, such as report generation, can be run on slaves, freeing up resources on the master.<\/li>\n<\/ul>\n<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t<div class=\"elementor-toggle-item\">\n\t\t\t\t\t<div id=\"elementor-tab-title-1293\" class=\"elementor-tab-title\" data-tab=\"3\" role=\"button\" aria-controls=\"elementor-tab-content-1293\" aria-expanded=\"false\">\n\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-toggle-icon elementor-toggle-icon-left\" aria-hidden=\"true\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-toggle-icon-closed\"><svg class=\"e-font-icon-svg e-fas-caret-right\" viewBox=\"0 0 192 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M0 384.662V127.338c0-17.818 21.543-26.741 34.142-14.142l128.662 128.662c7.81 7.81 7.81 20.474 0 28.284L34.142 398.804C21.543 411.404 0 402.48 0 384.662z\"><\/path><\/svg><\/span>\n\t\t\t\t\t\t\t\t<span class=\"elementor-toggle-icon-opened\"><\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t<a class=\"elementor-toggle-title\" tabindex=\"0\">How to monitor replication status in MySQL?<\/a>\n\t\t\t\t\t<\/div>\n\n\t\t\t\t\t<div id=\"elementor-tab-content-1293\" class=\"elementor-tab-content elementor-clearfix\" data-tab=\"3\" role=\"region\" aria-labelledby=\"elementor-tab-title-1293\"><p>You can monitor the replication status on the slave server by running the SHOW SLAVE STATUS\\G; command. This command provides detailed information about the connection and the replication process, including possible errors and replication delay.<\/p>\n<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t<div class=\"elementor-toggle-item\">\n\t\t\t\t\t<div id=\"elementor-tab-title-1294\" class=\"elementor-tab-title\" data-tab=\"4\" role=\"button\" aria-controls=\"elementor-tab-content-1294\" aria-expanded=\"false\">\n\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-toggle-icon elementor-toggle-icon-left\" aria-hidden=\"true\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span class=\"elementor-toggle-icon-closed\"><svg class=\"e-font-icon-svg e-fas-caret-right\" viewBox=\"0 0 192 512\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\"><path d=\"M0 384.662V127.338c0-17.818 21.543-26.741 34.142-14.142l128.662 128.662c7.81 7.81 7.81 20.474 0 28.284L34.142 398.804C21.543 411.404 0 402.48 0 384.662z\"><\/path><\/svg><\/span>\n\t\t\t\t\t\t\t\t<span class=\"elementor-toggle-icon-opened\"><\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<\/span>\n\t\t\t\t\t\t\t\t\t\t\t\t<a class=\"elementor-toggle-title\" tabindex=\"0\">What are the requirements for setting up Master-Slave replication in MySQL?<\/a>\n\t\t\t\t\t<\/div>\n\n\t\t\t\t\t<div id=\"elementor-tab-content-1294\" class=\"elementor-tab-content elementor-clearfix\" data-tab=\"4\" role=\"region\" aria-labelledby=\"elementor-tab-title-1294\"><p>To set up replication, you need:<\/p>\n<ul>\n<li>Two or more MySQL servers (one will act as master and the other as slave).<\/li>\n<li>Enable binary logs on the master.<\/li>\n<li>Set up a user with replication permissions.<\/li>\n<li>Ensure that the slave has an initial copy of the master&#8217;s database.<\/li>\n<\/ul>\n<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t\t\t<script type=\"application\/ld+json\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@type\":\"FAQPage\",\"mainEntity\":[{\"@type\":\"Question\",\"name\":\"What is Master-Slave Replication in MySQL and What is it Used For?\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"<p>Master-Slave replication in MySQL is a configuration where one server acts as the master and one or more servers act as slaves. The master server handles write and read operations, while the slaves primarily handle read operations. This architecture is used to distribute the workload, improve performance, and provide redundancy for disaster recovery.<\\\/p>\\n\"}},{\"@type\":\"Question\",\"name\":\"What are the benefits of implementing Master-Slave replication in MySQL?\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"<p>Implementing Master-Slave replication offers several benefits, including:<\\\/p>\\n<ul>\\n<li><strong>Load balancing:<\\\/strong> Read queries can be distributed across slave servers, reducing the load on the master.<\\\/li>\\n<li><strong>High availability:<\\\/strong> In the event of a master server failure, slaves can be promoted to take over the master role, minimizing downtime.<\\\/li>\\n<li><strong>Non-disruptive backups:<\\\/strong> Backups can be performed on slaves without impacting master performance.<\\\/li>\\n<li><strong>Analysis and reporting:<\\\/strong> Read-intensive tasks, such as report generation, can be run on slaves, freeing up resources on the master.<\\\/li>\\n<\\\/ul>\\n\"}},{\"@type\":\"Question\",\"name\":\"How to monitor replication status in MySQL?\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"<p>You can monitor the replication status on the slave server by running the SHOW SLAVE STATUS\\\\G; command. This command provides detailed information about the connection and the replication process, including possible errors and replication delay.<\\\/p>\\n\"}},{\"@type\":\"Question\",\"name\":\"What are the requirements for setting up Master-Slave replication in MySQL?\",\"acceptedAnswer\":{\"@type\":\"Answer\",\"text\":\"<p>To set up replication, you need:<\\\/p>\\n<ul>\\n<li>Two or more MySQL servers (one will act as master and the other as slave).<\\\/li>\\n<li>Enable binary logs on the master.<\\\/li>\\n<li>Set up a user with replication permissions.<\\\/li>\\n<li>Ensure that the slave has an initial copy of the master&#8217;s database.<\\\/li>\\n<\\\/ul>\\n\"}}]}<\/script>\n\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>MYSQL MASTER\/SLAVE REPLICATION We will see one of the most used architectures, where we will have a mysql master for writing\/reading and nodes in slave mode for reading only, allowing us to distribute the load between several machines for reading using for example HAProxy, which we will make a post about how to use in [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":3912,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[49,50],"tags":[],"class_list":["post-4208","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux-world","category-open-source"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>MySQL 8 Master\/Slave - LBT<\/title>\n<meta name=\"description\" content=\"We will see one of the most used configurations with mysql, where we have a Master replicating in read-only Slaves\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/tech.lobobrothers.com\/en\/mysql-8-master-slave\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"MySQL 8 Master\/Slave - LBT\" \/>\n<meta property=\"og:description\" content=\"We will see one of the most used configurations with mysql, where we have a Master replicating in read-only Slaves\" \/>\n<meta property=\"og:url\" content=\"https:\/\/tech.lobobrothers.com\/en\/mysql-8-master-slave\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog sobre linux y el mundo opensource\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/LoboBrothers\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-05-26T17:19:38+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-02-06T12:19:20+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/tech.lobobrothers.com\/wp-content\/uploads\/2023\/05\/mysqlreplication-1024x683.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"683\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"TL\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"TL\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/tech.lobobrothers.com\/en\/mysql-8-master-slave\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/tech.lobobrothers.com\/en\/mysql-8-master-slave\/\"},\"author\":{\"name\":\"TL\",\"@id\":\"https:\/\/tech.lobobrothers.com\/en\/#\/schema\/person\/11c359ab9896aa196007651fa6208beb\"},\"headline\":\"MySQL 8 Master\/Slave\",\"datePublished\":\"2023-05-26T17:19:38+00:00\",\"dateModified\":\"2025-02-06T12:19:20+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/tech.lobobrothers.com\/en\/mysql-8-master-slave\/\"},\"wordCount\":1089,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/tech.lobobrothers.com\/en\/#organization\"},\"image\":{\"@id\":\"https:\/\/tech.lobobrothers.com\/en\/mysql-8-master-slave\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/tech.lobobrothers.com\/wp-content\/uploads\/2023\/05\/mysqlreplication.png.webp\",\"articleSection\":[\"Linux World\",\"Open Source\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/tech.lobobrothers.com\/en\/mysql-8-master-slave\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/tech.lobobrothers.com\/en\/mysql-8-master-slave\/\",\"url\":\"https:\/\/tech.lobobrothers.com\/en\/mysql-8-master-slave\/\",\"name\":\"MySQL 8 Master\/Slave - LBT\",\"isPartOf\":{\"@id\":\"https:\/\/tech.lobobrothers.com\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/tech.lobobrothers.com\/en\/mysql-8-master-slave\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/tech.lobobrothers.com\/en\/mysql-8-master-slave\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/tech.lobobrothers.com\/wp-content\/uploads\/2023\/05\/mysqlreplication.png.webp\",\"datePublished\":\"2023-05-26T17:19:38+00:00\",\"dateModified\":\"2025-02-06T12:19:20+00:00\",\"description\":\"We will see one of the most used configurations with mysql, where we have a Master replicating in read-only Slaves\",\"breadcrumb\":{\"@id\":\"https:\/\/tech.lobobrothers.com\/en\/mysql-8-master-slave\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/tech.lobobrothers.com\/en\/mysql-8-master-slave\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/tech.lobobrothers.com\/en\/mysql-8-master-slave\/#primaryimage\",\"url\":\"https:\/\/tech.lobobrothers.com\/wp-content\/uploads\/2023\/05\/mysqlreplication.png.webp\",\"contentUrl\":\"https:\/\/tech.lobobrothers.com\/wp-content\/uploads\/2023\/05\/mysqlreplication.png.webp\",\"width\":1920,\"height\":1280,\"caption\":\"Mysqlreplication\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/tech.lobobrothers.com\/en\/mysql-8-master-slave\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Portada\",\"item\":\"https:\/\/tech.lobobrothers.com\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"MySQL 8 Master\/Slave\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/tech.lobobrothers.com\/en\/#website\",\"url\":\"https:\/\/tech.lobobrothers.com\/en\/\",\"name\":\"Tech LBT\",\"description\":\"Como apasionados de la tecnolog\u00eda y amantes del open source creamos este blog con art\u00edculos interesantes obre linux, cloud, open source, criptomonedas y ciberseguridad\",\"publisher\":{\"@id\":\"https:\/\/tech.lobobrothers.com\/en\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/tech.lobobrothers.com\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/tech.lobobrothers.com\/en\/#organization\",\"name\":\"Lobo Brothers Technology\",\"url\":\"https:\/\/tech.lobobrothers.com\/en\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/tech.lobobrothers.com\/en\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/tech.lobobrothers.com\/wp-content\/uploads\/2019\/06\/logo_red.png\",\"contentUrl\":\"https:\/\/tech.lobobrothers.com\/wp-content\/uploads\/2019\/06\/logo_red.png\",\"width\":110,\"height\":50,\"caption\":\"Lobo Brothers Technology\"},\"image\":{\"@id\":\"https:\/\/tech.lobobrothers.com\/en\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/LoboBrothers\/\",\"https:\/\/www.linkedin.com\/company\/lobobrothers\/about\/?viewAsMember=true\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/tech.lobobrothers.com\/en\/#\/schema\/person\/11c359ab9896aa196007651fa6208beb\",\"name\":\"TL\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/tech.lobobrothers.com\/en\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/a2d3b9e0b67bd28fe8248346c09cbe07?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/a2d3b9e0b67bd28fe8248346c09cbe07?s=96&d=mm&r=g\",\"caption\":\"TL\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"MySQL 8 Master\/Slave - LBT","description":"We will see one of the most used configurations with mysql, where we have a Master replicating in read-only Slaves","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/tech.lobobrothers.com\/en\/mysql-8-master-slave\/","og_locale":"en_US","og_type":"article","og_title":"MySQL 8 Master\/Slave - LBT","og_description":"We will see one of the most used configurations with mysql, where we have a Master replicating in read-only Slaves","og_url":"https:\/\/tech.lobobrothers.com\/en\/mysql-8-master-slave\/","og_site_name":"Blog sobre linux y el mundo opensource","article_publisher":"https:\/\/www.facebook.com\/LoboBrothers\/","article_published_time":"2023-05-26T17:19:38+00:00","article_modified_time":"2025-02-06T12:19:20+00:00","og_image":[{"width":1024,"height":683,"url":"https:\/\/tech.lobobrothers.com\/wp-content\/uploads\/2023\/05\/mysqlreplication-1024x683.png","type":"image\/png"}],"author":"TL","twitter_card":"summary_large_image","twitter_misc":{"Written by":"TL","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/tech.lobobrothers.com\/en\/mysql-8-master-slave\/#article","isPartOf":{"@id":"https:\/\/tech.lobobrothers.com\/en\/mysql-8-master-slave\/"},"author":{"name":"TL","@id":"https:\/\/tech.lobobrothers.com\/en\/#\/schema\/person\/11c359ab9896aa196007651fa6208beb"},"headline":"MySQL 8 Master\/Slave","datePublished":"2023-05-26T17:19:38+00:00","dateModified":"2025-02-06T12:19:20+00:00","mainEntityOfPage":{"@id":"https:\/\/tech.lobobrothers.com\/en\/mysql-8-master-slave\/"},"wordCount":1089,"commentCount":0,"publisher":{"@id":"https:\/\/tech.lobobrothers.com\/en\/#organization"},"image":{"@id":"https:\/\/tech.lobobrothers.com\/en\/mysql-8-master-slave\/#primaryimage"},"thumbnailUrl":"https:\/\/tech.lobobrothers.com\/wp-content\/uploads\/2023\/05\/mysqlreplication.png.webp","articleSection":["Linux World","Open Source"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/tech.lobobrothers.com\/en\/mysql-8-master-slave\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/tech.lobobrothers.com\/en\/mysql-8-master-slave\/","url":"https:\/\/tech.lobobrothers.com\/en\/mysql-8-master-slave\/","name":"MySQL 8 Master\/Slave - LBT","isPartOf":{"@id":"https:\/\/tech.lobobrothers.com\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/tech.lobobrothers.com\/en\/mysql-8-master-slave\/#primaryimage"},"image":{"@id":"https:\/\/tech.lobobrothers.com\/en\/mysql-8-master-slave\/#primaryimage"},"thumbnailUrl":"https:\/\/tech.lobobrothers.com\/wp-content\/uploads\/2023\/05\/mysqlreplication.png.webp","datePublished":"2023-05-26T17:19:38+00:00","dateModified":"2025-02-06T12:19:20+00:00","description":"We will see one of the most used configurations with mysql, where we have a Master replicating in read-only Slaves","breadcrumb":{"@id":"https:\/\/tech.lobobrothers.com\/en\/mysql-8-master-slave\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/tech.lobobrothers.com\/en\/mysql-8-master-slave\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/tech.lobobrothers.com\/en\/mysql-8-master-slave\/#primaryimage","url":"https:\/\/tech.lobobrothers.com\/wp-content\/uploads\/2023\/05\/mysqlreplication.png.webp","contentUrl":"https:\/\/tech.lobobrothers.com\/wp-content\/uploads\/2023\/05\/mysqlreplication.png.webp","width":1920,"height":1280,"caption":"Mysqlreplication"},{"@type":"BreadcrumbList","@id":"https:\/\/tech.lobobrothers.com\/en\/mysql-8-master-slave\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Portada","item":"https:\/\/tech.lobobrothers.com\/en\/"},{"@type":"ListItem","position":2,"name":"MySQL 8 Master\/Slave"}]},{"@type":"WebSite","@id":"https:\/\/tech.lobobrothers.com\/en\/#website","url":"https:\/\/tech.lobobrothers.com\/en\/","name":"Tech LBT","description":"Como apasionados de la tecnolog\u00eda y amantes del open source creamos este blog con art\u00edculos interesantes obre linux, cloud, open source, criptomonedas y ciberseguridad","publisher":{"@id":"https:\/\/tech.lobobrothers.com\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/tech.lobobrothers.com\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/tech.lobobrothers.com\/en\/#organization","name":"Lobo Brothers Technology","url":"https:\/\/tech.lobobrothers.com\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/tech.lobobrothers.com\/en\/#\/schema\/logo\/image\/","url":"https:\/\/tech.lobobrothers.com\/wp-content\/uploads\/2019\/06\/logo_red.png","contentUrl":"https:\/\/tech.lobobrothers.com\/wp-content\/uploads\/2019\/06\/logo_red.png","width":110,"height":50,"caption":"Lobo Brothers Technology"},"image":{"@id":"https:\/\/tech.lobobrothers.com\/en\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/LoboBrothers\/","https:\/\/www.linkedin.com\/company\/lobobrothers\/about\/?viewAsMember=true"]},{"@type":"Person","@id":"https:\/\/tech.lobobrothers.com\/en\/#\/schema\/person\/11c359ab9896aa196007651fa6208beb","name":"TL","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/tech.lobobrothers.com\/en\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/a2d3b9e0b67bd28fe8248346c09cbe07?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a2d3b9e0b67bd28fe8248346c09cbe07?s=96&d=mm&r=g","caption":"TL"}}]}},"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/tech.lobobrothers.com\/en\/wp-json\/wp\/v2\/posts\/4208","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tech.lobobrothers.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tech.lobobrothers.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tech.lobobrothers.com\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/tech.lobobrothers.com\/en\/wp-json\/wp\/v2\/comments?post=4208"}],"version-history":[{"count":3,"href":"https:\/\/tech.lobobrothers.com\/en\/wp-json\/wp\/v2\/posts\/4208\/revisions"}],"predecessor-version":[{"id":8076,"href":"https:\/\/tech.lobobrothers.com\/en\/wp-json\/wp\/v2\/posts\/4208\/revisions\/8076"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/tech.lobobrothers.com\/en\/wp-json\/wp\/v2\/media\/3912"}],"wp:attachment":[{"href":"https:\/\/tech.lobobrothers.com\/en\/wp-json\/wp\/v2\/media?parent=4208"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tech.lobobrothers.com\/en\/wp-json\/wp\/v2\/categories?post=4208"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tech.lobobrothers.com\/en\/wp-json\/wp\/v2\/tags?post=4208"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}