- 论坛徽章:
- 0
|
本帖最后由 oyqiaojin 于 2013-04-17 14:11 编辑
写了个脚本,主要是对mysql的主从的监控,手动执行的时候正常
日志文件check_repl.log,内容如下:
##############################################
Master_Log:000030
Master_Log_Pos:176025373
Relay_Master_Log_File:000030
Exec_Master_Log_Pos:176025373
Slave_IO_Running:Yes
Slave_SQL_Running:Yes
Seconds_Behind_Master:0
0
2013-04-17 12:43:12 Master-Slave is OK.
当我添加到crontab中定时执行的时候,就是这样了
##############################################
Master_Log:000030
Master_Log_Pos:176025373
Relay_Master_Log_File:
Exec_Master_Log_Pos:
Slave_IO_Running:
Slave_SQL_Running:
Seconds_Behind_Master:
2013-04-17 12:05:01 Error:不能获取slave的相关参数
请问为什么会获取不到slave的值能?mysql 主从都是正常的。
这是我脚本----------------------------------------------------------------------------------------------------------
感谢各位!问题已经找到,是环境变量的问题,我把所有的路径都换成绝对路径
比如:- slave=`mysql -u$user -p$passwd -e "show slave status\G;"|egrep "Relay_Master_Log_File|Exec_Master_Log_Pos|Seconds_Behind_Master|Slave_IO_Running|Slave_SQL_Running"`
复制代码 我换成- slave=`/usr/local/mysql/bin/mysql -u$user -p$passwd -e "show slave status\G;"|egrep "Relay_Master_Log_File|Exec_Master_Log_Pos|Seconds_Behind_Master|Slave_IO_Running|Slave_SQL_Running"`
复制代码 --------------------------------------------------------------------------------------------------------- |
|