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 #管理端口