当前位置:网站首页>Installing MySQL and cluster operation on virtual machine in Linux system

Installing MySQL and cluster operation on virtual machine in Linux system

2022-06-11 08:21:00 WldKid_ zxy

Linux Online installation

One 、mysql Online installation

1. Check to see if... Is already installed Mysql

rpm -qa | grep mysql

No directories
 Insert picture description here

If you see something , You can use the following command to delete (xxx For the full name of the file ) rpm -e xxx

2. Installation steps ( According to the order Input 1-4 command )

1.yum -y install wget

2.wget http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm

3.yum -y install mysql57-community-release-el7-10.noarch.rpm

4.yum install mysql-community-server --nogpgcheck

5.service mysqld restart

*6(). verification  ps  -ef|grep mysql

The display is successful
 Insert picture description here

3. Change Password
 Insert picture description here
Enter the command in turn

1.set global validate_password_length=4;
2.alter user '[email protected]' identified by '199957'
3.GRANT ALL PRIVILEGES ON *.* TO '[email protected]''%' identified by '199957'
4.flush privileges;

Two 、 colony

-I/O Threads : Zhou Zhu monitors the two leaders of the master or the point bni og journal , Once the master node sends the master handover change , that ijo The thread reads the change , then I/O The thread writes the read content to our binary relay log Re
lay in .( Relay logs and binlog Keep the log consistent , And the default is none , Need configuration )

-SQL Threads : Monitor the relay log of the slave node , Once the relay log changes , that SQL The thread reads , analysis , Then redo it from the library .

 Insert picture description here

1. Configure the host

1.1 Edit the file vim. /etc/my.cnf
Insert... At the end

log-bin=mysql-bin
server-id=214
 Insert picture description here
1.2. restart Mysql service mysqld restart
 Insert picture description here
1.3 Create a user on the host
 Insert picture description here

2. Configure slave

2.1 Edit the file vim. /etc/my.cnf*

# relay logs
server-id=111
relay-log=relay-log
relay-log-index=relay-log.index

 Insert picture description here
2.2 Restart slave mysql service mysqld restart

3. Configure the parameters of the template node

3.1 Check the information
 Insert picture description here
3.2 Log in to the slave mysql Type in the command

change master to master_host=‘192.168.23.57’ ,master_user=‘txdev’,master_password=‘txdev’,master_log_file=‘mysql-bin.000001’,master_log_pos=1181;

master_user=‘txdev’,master_password=‘txdev’, The user name and password created by the host

3.3 stay mysql From the plane Restart the replication thread

start slave
show slave status\G;

 Insert picture description here
4.navicar Threaded connection

 Insert picture description here
4.1 verification
a. stay Linux Create... Under connection j09 database
b. Refresh
c. Linux58 Automatically create and Linux Like goose database
 Insert picture description here

========= Cluster diagram

 Insert picture description here

原网站

版权声明
本文为[WldKid_ zxy]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/03/202203020512142114.html