centos8 mysql master-slave replication

♥️Author : Xiao Liu at Station C

♥️Personal homepage: Xiao Liu's homepage

♥️ Share cloud computing network operation and maintenance classroom notes every day, hard work may not necessarily pay off, but there will be gains, come on! Work hard together for a better life!

♥️Under the setting sun, it is the most beautiful bloom, the tree is thousands of feet high, and the fallen leaves return to the roots. Life is not easy, and the true love in the world

Table of contents

Linux

i tried8

The first step is to modify the hostname in the initial configuration of the three systems, close selinux, permanently close the firewall, and configure the network yum source

The second step, all three use yum to install mysql-server

The third step is to create test databases and tables in the three systems and set up authorized porxysql users

The fourth step is to modify the my.conf configuration on the master server mysql_m as follows

The fifth step, configure the master-slave

If two yes are displayed, the configuration is successful

Master-slave replication is configured


system

CPU name

software

ip address

Centos8

mysql_m

mysql

192.168.3.102

Centos8

mysql_s1

mysql

192.168.3.105

Centos8

mysql_s2

mysql

192.168.3.106

Linux

Linux, the full name of GNU/Linux, is a free-to-use and freely disseminated UNIX-like operating system. Its kernel was first created by Linus Benedict Torvalds on October 5, 1991. Released, which is mainly inspired by the ideas of Minix and Unix , is a POSIX -based multi-user, multi-tasking , multi-threading and multi- CPU operating system . It supports 32-bit and 64-bit hardware and can run major Unix utilities, applications and network protocols.

Linux inherits Unix's network-centric design idea and is a multi-user network operating system with stable performance. There are hundreds of different distributions of Linux, such as debian and archlinux based on community development, and Red Hat Enterprise Linux , SUSE , Oracle Linux and so on based on commercial development .

i tried8

CentOS 8 is an open source server operating system released by the CentOS project , which was officially released on September 24, 2019. [1]  [8] 

CentOS 8 is a stable, highly predictable, highly manageable, and highly repeatable Linux platform redistributed from the source code of RedHat Enterprise Linux ( RHEL ). Based on Fedora 28 and kernel version 4.18, CentOS 8 provides users with a stable, secure, and consistent foundation to span hybrid cloud deployments and support the tools needed for traditional and emerging workloads.

The first step is to modify the hostname in the initial configuration of the three systems, close selinux, permanently close the firewall, and configure the network yum source

The second step, all three use yum to install mysql-server

The third step is to create test databases and tables in the three systems and set up authorized porxysql users

Use mysql -u root -p command to enter mysql (password skipped)

Create authorized users and test databases in mysql including tables in the database

  Note that after creating a database below, you need to enter use brief_test to use this database, or you will report an error if you create a table directly   

   create database breif_test;

   use letter_test;

   create table `test`  (

   CREATE TABLE `test` (

        `id` int NOT NULL AUTO_INCREMENT COMMENT 'primary key',

        `service_name` varchar(50) NOT NULL COMMENT '自增',

         PRIMARY KEY (`id`)

) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; # create test table                                                                                                                                                         

The fourth step is to modify the my.conf configuration on the master server mysql_m as follows

Among them, the server-id three mysql numbers cannot be the same

Restart the mysql service after the main mysql configuration file is modified

systemctl  restart  mysqld.service

The configuration files of the other two slave mysql servers are shown in the figure

After the completion, restart the mysql service of the two slave mysql servers

The fifth step, configure the master-slave

Enter the mysql of the master server to view the status of the master

show  master  status

Note that the contents of flie and position are used in the slave server

The following contents of the two slave server configurations are the same. Enter mysql to do the slave configuration

The interim explanation is as follows

Finally, check the status on the two slave servers

If two yes are displayed, the configuration is successful

Master-slave replication is configured

♥️Following is the driving force for my creation

♥️Like, is the greatest recognition for me

♥️This is Xiaoliu, I am inspiring to do every article well, thank you everyone

Guess you like

Origin blog.csdn.net/lzl10211345/article/details/130097859