logdir=/data/maxscale3306/log/ #日志位置 datadir=/data/maxscale3306/data/ #数据位置 cachedir=/data/maxscale3306/cache/ #缓存位置 piddir=/data/maxscale3306/ #pid文件位置 connection_timeout=300 #连接超时 max_connections=1000 #最大连接数 #language=/data/maxscale3306/lang/ # Set the address of the server to the network # address of a MySQL server. # #[server1],和[server2]是主从,223是主 224是从,可以有多个在加[server3....]
# Monitor for the servers # # This will keep MaxScale aware of the state of the servers. # MySQL Monitor documentation: # https://github.com/mariadb-corporation/MaxScale/blob/master/Documentation/Monitors/MySQL-Monitor.md
[MySQL Monitor] #监控信息,监控的用户需要对后端数据库有访问replication client的权限 grant replication slave, replication client on *.* to scalemon@'%' identified by '123456'; type=monitor module=mysqlmon servers=server1,server2 user=scalemon passwd=B7A14BD5A08414AF147BD35CE0F761FC #加密的123456,后面有加密的方法,也可不加密 monitor_interval=10000 #监控心跳为1秒 detect_stale_master=true #slave节点全部断掉时,将所有的读写都指向master节点 #max_slave_replication_lag=5 #超过延迟5秒,把请求转发给其他slave,这里就两个节点就没开
# Service definitions # # Service Definition for a read-only service and # a read/write splitting service. #
[Hint] type=filter module=hintfilter # This service enables the use of the MaxAdmin interface # MaxScale administration guide: # https://github.com/mariadb-corporation/MaxScale/blob/master/Documentation/Reference/MaxAdmin.md
[MaxAdmin Service] type=service router=cli
# Listener definitions for the services # # These listeners represent the ports the # services will listen on. #
#Read-Only的全部注释掉了,上面说过了 #[Read-Only Listener] #type=listener #service=Read-Only Service #protocol=MySQLClient #port=4008
[Read-Write Listener] type=listener service=Read-Write Service protocol=MySQLClient port=4006 #连接端口,程序连接端口
[MaxAdmin Listener] type=listener service=MaxAdmin Service protocol=maxscaled port=6603 #管理端口