maxscale异常分析
日志文件:/var/log/maxscale/maxscale.log
2021-01-08 11:15:51 error : Failed to open PID file '/var/run/maxscale/maxscale.pid'. (Permission denied)
2021-01-08 11:23:38 error : Failed to open lock file /var/cache/maxscale/maxscale.lock: Permission denied
2021-01-08 11:38:26 error : Failed to open lock file /var/lib/maxscale/maxscale.lock: Permission denied
删除以上不能访问的文件 重启maxscale
systemctl restart maxscale
日志文件:/var/log/maxscale/maxscale.log
2021-01-08 11:41:33 warning: (34) [readwritesplit] Router session exceeded session command history limit. Server reconnection is disabled and only servers with consistent session state are used for the duration ofthe session. To disable this warning and the session command history, add `disable_sescmd_history=true` to service 'Read-Write-Service'. To increase the limit (currently 50), add `max_sescmd_history` to the same service and increase the value.
[root@ic-maxscale01 etc]# maxadmin -uadmin -pmariadb
MaxScale> show services
....
Service: Read-Write-Service
Router: readwritesplit
State: Started
use_sql_variables_in: all
slave_selection_criteria: LEAST_CURRENT_OPERATIONS
master_failure_mode: fail_instantly
max_slave_replication_lag: 0
retry_failed_reads: true
strict_multi_stmt: false
strict_sp_calls: false
prune_sescmd_history: false
disable_sescmd_history: false
max_sescmd_history: 50
master_accept_reads: false
connection_keepalive: 300
causal_reads: false
causal_reads_timeout: 10
master_reconnection: false
delayed_retry: false
delayed_retry_timeout: 10
....
修改配置文件 /etc/maxscale.cnf
添加
disable_sescmd_history=true
max_sescmd_history=1500
日志文件:/var/log/maxscale/maxscale.log
2021-01-08 11:41:24 notice : Service 'Read-Write-Service' started (3/3)
2021-01-08 11:41:24 error : Failed to inspect journal file: 13, Permission denied
2021-01-08 11:41:24 warning: Removing stale journal file for monitor 'MySQL-Monitor'.
2021-01-08 11:41:24 error : Failed to open journal file: 13, Permission denied
2021-01-08 11:41:24 notice : [mariadbmon] Selecting new master server.
021-01-08 11:41:24 notice : Server changed state: server3[ic-mysql03.ycbus.com:3306]: new_slave. [Running] -> [Slave, Running]
2021-01-08 11:41:24 error : Failed to open file '/var/lib/maxscale/MySQL-Monitor/monitor.dattl6sAQ': 13, Permission denied
2021-01-08 11:41:26 error : Failed to open file '/var/lib/maxscale/MySQL-Monitor/monitor.dat84TM1D': 13, Permission denied
2021-01-08 11:41:29 error : Failed to open file '/var/lib/maxscale/MySQL-Monitor/monitor.datD5KjJw': 13, Permission denied
2021-01-08 11:41:31 error : Failed to open file '/var/lib/maxscale/MySQL-Monitor/monitor.datMzDVGu': 13, Permission denied
2021-01-08 11:41:33 error : Failed to open file '/var/lib/maxscale/MySQL-Monitor/monitor.datflgLUx': 13, Permission denied
2021-01-08 11:41:35 error : Failed to open file '/var/lib/maxscale/MySQL-Monitor/monitor.dat6RI5oG': 13, Permission denied
2021-01-08 11:41:37 error : Failed to open file '/var/lib/maxscale/MySQL-Monitor/monitor.datHht88T': 13, Permission denied
[root@ic-maxscale01 maxscale]# ls -l
总用量 16
drwxr-xr-x 2 maxscale maxscale 6 1月 8 12:58 data3853
drwxr--r-- 2 maxscale maxscale 25 1月 8 12:57 MariaDB-Monitor
-rw-r----- 1 maxscale maxscale 147 1月 17 2020 maxadmin-users
drwxr-xr-x 2 maxscale maxscale 6 1月 17 2020 maxscale.cnf.d
-rwxr-xr-x 1 maxscale maxscale 4 1月 8 12:58 maxscale.lock
-rw------- 1 root root 69 12月 31 10:39 monitor.dat
drwxr--r-- 2 root root 6 1月 8 12:58 MySQL-Monitor
修改 MySQL-Monitor 文件用户与组
[root@ic-maxscale01 maxscale]# chown maxscale.maxscale MySQL-Monitor
重启maxscale
systemctl restart maxscale
以上错误消失
也许原因在这:
/usr/bin/maxscale -f /etc/maxscale.cnf -U root
maxscale -f /etc/maxscale.cnf -U maxscale
最后复盘,原因真的在里。
结论:
一开始不清楚maxscale,出问题时,公司没人会,领导客户都急。只能硬上了,经常处理,中间件启来了。应用也通了。
问题过程:大事务导致maxscale内存溢出,挂了。重启时发现启动不了,查看日志发现,文件拒绝操作,删除操作有问题文件(后来想想,其实只要改文件的权限就可以了,删除操作实在是low) ,重启成功。