当前位置:网站首页>MySQL maxscale realizes read-write separation
MySQL maxscale realizes read-write separation
2022-07-04 03:34:00 【yzm4399】
1. If work
Understand and deploy Master slave copy
2. download MaxScale middleware
Download Online
wget https://dlm.mariadb.com/1065384/MaxScale/2.3.20/centos/7/x86_64/maxscale-2.3.20-1.centos.7.x86_64.rpm

install
yum -y install maxscale-2.3.20-1.centos.7.x86_64.rpm

3.master Main library creation user
Master slave replication has been realized : Users created by the main library , Can be synchronized to the slave Library
Create monitoring users
create user 'maxmon'@'%' identified by 'maxmon';
ALTER USER 'maxmon'@'%' IDENTIFIED WITH mysql_native_password BY 'maxmon';
grant replication slave,replication client on *.* to 'maxmon'@'%';
Create routing users
create user 'maxrou'@'%' identified by 'maxrou';
ALTER USER 'maxrou'@'%' IDENTIFIED WITH mysql_native_password BY 'maxrou';
grant all on *.* to 'maxrou'@'%';
flush privileges;


4. To configure MaxScale
vim /etc/maxscale.cnf
find [server1] part , Modify the address and port, Point to master Of IP And port
Copy 2 Time [server1] The whole content of , Change it to [server2] And [server3], Also modify the address and port, Point to respectively slave1 and slave2
[MariaDB-Monitor] part , modify servers by server1,server2,server3, modify user and password Information for previously created monitoring users
Comment out [Read-Only-Service] part , Read and write by maxscale Control is enough
[Read-Write Service] part , modify servers by server1,server2,server3, modify user and password Information for the previously created routing user
notes [Read-Only-Listener] part , stay [MaxAdmin-Listener] Final addition port=6603
5. start-up MaxScale
establish maxscale Related contents , The user is mysql
mkdir /usr/local/mysql/maxscale
mkdir /usr/local/mysql/maxscale/data
mkdir /usr/local/mysql/maxscale/logs
mkdir /usr/local/mysql/maxscale/cache

Under reconfiguration
vim /etc/maxscale.cnf
logdir=/usr/local/mysql/maxscale/logs
datadir=/usr/local/mysql/maxscale/data
piddir=/usr/local/mysql/maxscale/logs
cachedir=/usr/local/mysql/maxscale/cache

start-up , Can't use root User start , Designated here mysql user
maxscale --config=/etc/maxscale.cnf --user=mysql
netstat -ntelp

Sign in MaxScale Manager
maxadmin --user=admin --password=mariadb
View service
list servers

6. test
Create a test user
create user 'rtest'@'%' identified by 'rtest';
ALTER USER 'rtest'@'%' IDENTIFIED WITH mysql_native_password BY 'rtest';
grant select,insert on testdb.* to 'rtest'@'%';
flush privileges;

mysql Connect MaxScale
mysql -urtest -prtest -h'192.168.192.128' -P4006
View the current server name
Select @@hostname;

Open transaction ,MaxScale Switch to master
start transaction;

Roll back
rollback;

Write operations go to the main library , Read operation from the library , It can realize the separation of reading and writing
边栏推荐
- Webhook triggers Jenkins for sonar detection
- 150 ppt! The most complete "fair perception machine learning and data mining" tutorial, Dr. AIST Toshihiro kamishima, Japan
- Experience summary of the 12th Blue Bridge Cup (written for the first time)
- 基於.NetCore開發博客項目 StarBlog - (14) 實現主題切換功能
- How about the ratings of 2022 Spring Festival Gala in all provinces? Map analysis helps you show clearly!
- 2006 translation
- JVM family -- heap analysis
- New year's first race, submit bug reward more!
- 深入浅出对话系统——使用Transformer进行文本分类
- Contest3145 - the 37th game of 2021 freshman individual training match_ 1: Origami
猜你喜欢

Recursive structure

MySQL data query optimization -- data structure of index

The 37 year old programmer was laid off, and he didn't find a job for 120 days. He had no choice but to go to a small company. As a result, he was confused
![[Valentine's Day confession code] - Valentine's Day is approaching, and more than 10 romantic love effects are given to the one you love](/img/ab/066923f1aa1e8dd8dcc572cb60a25d.jpg)
[Valentine's Day confession code] - Valentine's Day is approaching, and more than 10 romantic love effects are given to the one you love

Command Execution Vulnerability - command execution - vulnerability sites - code injection - vulnerability exploitation - joint execution - bypass (spaces, keyword filtering, variable bypass) - two ex

If you have just joined a new company, don't be fired because of your mistakes

New year's first race, submit bug reward more!

2022-07-03:数组里有0和1,一定要翻转一个区间,翻转:0变1,1变0。 请问翻转后可以使得1的个数最多是多少? 来自小红书。3.13笔试。

Jenkins continuous integration environment construction V (Jenkins common construction triggers)

What is the difference between enterprise wechat applet and wechat applet
随机推荐
PHP database connection succeeded, but data cannot be inserted
Setting methods, usage methods and common usage scenarios of environment variables in postman
Session learning diary 1
7 * 24-hour business without interruption! Practice of applying multiple live landing in rookie villages
150 ppt! The most complete "fair perception machine learning and data mining" tutorial, Dr. AIST Toshihiro kamishima, Japan
Examination question bank of constructor decoration direction post skills (constructor) and examination data of constructor decoration direction post skills (constructor) in 2022
[Wu Enda deep learning] beginner learning record 3 (regularization / error reduction)
what does ctrl + d do?
[PaddleSeg 源码阅读] PaddleSeg计算Dice
基于PHP的轻量企业销售管理系统
Teach you how to optimize SQL
super_ Subclass object memory structure_ Inheritance tree traceability
Calculate the odd sum of 1~n (1~100 as an example)
機器學習基礎:用 Lasso 做特征選擇
Object oriented -- encapsulation, inheritance, polymorphism
[PaddleSeg 源码阅读] PaddleSeg计算 mIoU
Future源碼一觀-JUC系列
Zblog collection plug-in does not need authorization to stay away from the cracked version of zblog
[.NET + mqtt]. Mise en œuvre de la communication mqtt dans l'environnement net 6 et démonstration de code pour l'abonnement et la publication de messages bilatéraux du serveur et du client
Unity knapsack system (code to center and exchange items)





