当前位置:网站首页>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
边栏推荐
- WP collection plug-in free WordPress collection hang up plug-in
- Constantly changing harmonyos custom JS components during the Spring Festival - Smart Koi
- Consul of distributed service registration discovery and unified configuration management
- Add IDM to Google browser
- Practical multifunctional toolbox wechat applet source code / support traffic master
- 1day vulnerability pushback skills practice (3)
- 2022 examination summary of quality controller - Equipment direction - general basis (quality controller) and examination questions and analysis of quality controller - Equipment direction - general b
- Record a problem that soft deletion fails due to warehouse level error
- logistic regression
- JVM family -- heap analysis
猜你喜欢

微信公众号网页授权

JVM family -- heap analysis

Unity knapsack system (code to center and exchange items)

MySQL data query optimization -- data structure of index

渗透实战-guest账户-mimikatz-向日葵-sql提权-离线解密

What is cloud primordial?

Nbear introduction and use diagram
![[latex] production of complex tables: excel2latex and detail adjustment](/img/39/0d448ddf006eda262de3ed75666354.jpg)
[latex] production of complex tables: excel2latex and detail adjustment

This function has none of DETERMINISTIC, NO SQL..... (you *might* want to use the less safe log_bin_t

Recursive structure
随机推荐
MySQL data query optimization -- data structure of index
Site favorites
Recent learning fragmentation (14)
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
Package details_ Four access control characters_ Two details of protected
Which product is better for 2022 annual gold insurance?
How to pipe several commands in Go?
How much does it cost to open a futures account in China? Where is it safe to open an account at present?
[development team follows] API specification
Management and thesis of job management system based on SSM
Record a problem that soft deletion fails due to warehouse level error
150 ppt! The most complete "fair perception machine learning and data mining" tutorial, Dr. AIST Toshihiro kamishima, Japan
潘多拉 IOT 开发板学习(HAL 库)—— 实验6 独立看门狗实验(学习笔记)
Imperial cms7.5 imitation "D9 download station" software application download website source code
Dare to climb here, you're not far from prison, reptile reverse actual combat case
static hostname; transient hostname; pretty hostname
If you have just joined a new company, don't be fired because of your mistakes
96% of the collected traffic is prevented by bubble mart of cloud hosting
JVM family -- monitoring tools
Www 2022 | taxoenrich: self supervised taxonomy complemented by Structural Semantics





