In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Configure one master-slave master-slave synchronization structure and test the configuration on the client side
Master51 > grant all on webdb.* to webuser@ "" identified by "123456"
Pack a bag
Rpm-ivh maxscale-2.1.2-1.rhel.7.x86_64.rpm
[root@host56 ~] # rpm-qa | grep maxscale
Maxscale-2.1.2-1.x86_64
[root@host56 ~] # rpm-qc maxscale
/ etc/maxscale.cnf.template
[root@host56 ~] #
Modify the configuration file
[root@host56 ~] # ls / etc/maxscale.cnf
/ etc/maxscale.cnf
[root@host56 ~] # cp / etc/maxscale.cnf / etc/maxscale.cnf.bak
[root@host56 ~] # vim / etc/maxscale.cnf
[maxscale]
Threads=1 is also auto.
[server1]
Type=server
Address=192.168.4.51
Port=3306
Protocol=MySQLBackend
[server2]
Type=server
Address=192.168.4.52
Port=3306
Protocol=MySQLBackend
[MySQL Monitor]
Type=monitor
Module=mysqlmon
Servers=server1, server2
User=scalemon
Passwd=123456
Monitor_interval=10000
[Read-Write Service]
Type=service
Router=readwritesplit
Servers=server1, server2
User=maxscale
Passwd=123456
Max_slave_connections=100%
[MaxAdmin Service]
Type=service
Router=cli
[Read-Write Listener]
Type=listener
Service=Read-Write Service
Protocol=MySQLClient
Port=4006
[MaxAdmin Listener]
Type=listener
Service=MaxAdmin Service
Protocol=maxscaled
Socket=default
Port=4018
Make appropriate settings according to the configuration file (add users on 2 database servers)
Users who connect to the database server when monitoring the database server
Mysql > grant replication slave, replication client on star. Star to scalemon@'%' identified by "123456"
Verify that the user used to connect to the database server exists on the database server when accessing the data.
Mysql > grant select on mysql.* to maxscale@'%' identified by "123456"
View authorized users
Mysql > select user,host from mysql.user where user in ("scalemon", "maxscale")
+-+ +
| | user | host |
+-+ +
| | maxscale |% | |
| | scalemon |% | |
+-+ +
Start the service
[root@host56] # maxscale-f / etc/maxscale.cnf
View service processes and ports
View Port
[root@host56 ~] # netstat-utnlp | grep: 4006
[root@host56 ~] # netstat-utnlp | grep: 4018
[root@host56] # ps-C maxscale
Out of Service
[root@host56] # ps-C maxscale
PID TTY TIME CMD
29688? 00:00:00 maxscale
[root@host56] # kill-9 29688
[root@host56 ~] #
[root@host56 ~] #
[root@host56] # kill-9 29688
-bash: kill: (29688)-process does not exist
2.2.3 Test configuration
A check the monitoring status at the local access management port
[root@host56] # maxadmin-P4018-uadmin-pmariadb
MaxScale > list servers
Servers.
-+-
Server | Address | Port | Connections | Status
-+-
Server1 | 192.168.4.51 | 3306 | 0 | Master, Running
Server2 | 192.168.4.52 | 3306 | 0 | Slave, Running
-+-
MaxScale > exit
[root@host56 ~] #
B client access data read-write separation server
] # which mysql
] # mysql-h292.168.4.56-P4006-uwebuser-p123456
Mysql > select @ @ hostname
Mysql > execute insert or query (view records locally in 51 and 52)
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.