一、读写分离是什么
读写分离,基本的原理是让主数据库处理事务性增、改、删操作(INSERT、UPDATE、DELETE),而从数据库处理SELECT查询操作。数据库复制被用来把事务性操作导致的变更同步到集群中的从数据库。
二、作用
读写分离,解决由数据库的写入因素而影响了查询的效率的问题。
如果数据库的使用是更新少,查询多的情况下会考虑使用,利用数据库 主从同步,可以减少数据库压力,提高性能。
读写分离解析图:
三、读写分离中间件 maxscale
https://www.cnblogs.com/darren-lee/p/7591416.html
1、安装软件包
[root@host6 ~]# yum -y install maxscale-2.1.2-1.rhel.7.x86_64.rpm
2、修改配置文件
[root@host6 ~]# ls /etc/maxscale.cnf
/etc/maxscale.cnf
[root@host6 ~]# cp /etc/maxscale.cnf /etc/maxscale.cnf.bak
[root@host6 ~]# vim /etc/maxscale.cnf
[maxscale]
threads=1
[server1]
type=server
address=192.168.4.1