cacti 错误 ERROR: SQL Assoc Failed!, Error:\'145\'

本文涉及的产品
云数据库 RDS SQL Server,独享型 2核4GB
云数据库 RDS MySQL Serverless,0.5-2RCU 50GB
简介:

错误描述:打开cacti监控,发现已经运行的转码机不产生流量,即cacti监控所显示已经运行的转码机为宕机,查看cacti日志发现error,查资料解决此问题、

cacit监控无数据了,查看日志:

2014年05月03日 09:05:51 AM - CMDPHP: Poller[0] ERROR: A DB Exec Failed!, Error:'145', SQL:"INSERT INTO `cacti`.`syslog_hosts` (host) (SELECT DISTINCT host FROM `cacti`.`syslog_incoming`) ON DUPLICATE KEY UPDATE host=VALUES(host), last_updated=NOW()'
2014年05月03日 09:05:51 AM - CMDPHP: Poller[0] ERROR: A DB Exec Failed!, Error:'145', SQL:"DELETE FROM `cacti`.`syslog_incoming` WHERE status=90'
2014年05月03日 09:05:51 AM - CMDPHP: Poller[0] ERROR: A DB Exec Failed!, Error:'145', SQL:"INSERT INTO `cacti`.`syslog` (logtime, priority_id, facility_id, host_id, message) SELECT TIMESTAMP(`date`, `time`), priority_id, facility_id, host_id, message FROM (SELECT date, time, priority_id, facility_id, host_id, message FROM syslog_incoming AS si INNER JOIN syslog_facilities AS sf ON sf.facility=si.facility INNER JOIN syslog_priorities AS sp ON sp.priority=si.priority INNER JOIN syslog_hosts AS sh ON sh.host=si.host WHERE status=90) AS merge'

查mysql日志:

140504 12:20:45 [ERROR] /usr/libexec/mysqld: Table './cacti/syslog_incoming' is marked as crashed and should be repaired
140504 12:20:45 [ERROR] /usr/libexec/mysqld: Table './cacti/syslog_incoming' is marked as crashed and should be repaired
140504 12:22:00 [ERROR] /usr/libexec/mysqld: Table './cacti/syslog_incoming' is marked as crashed and should be repaired
140504 12:22:00 [ERROR] /usr/libexec/mysqld: Table './cacti/syslog_incoming' is marked as crashed and should be repaired


#连接损坏表所在的数据库:

mysql> use cacti;
Database changed
# REPAIR TABLE 修复数据表
mysql> REPAIR TABLE  poller_item;
+——————-+——–+———-+———-+
| Table             | Op     | Msg_type | Msg_text |
+——————-+——–+———-+———-+
| cacti. poller_item | repair | status   | OK
|
+——————-+——–+———-+———-+
1 row in set ( 0. 02 sec)
mysql>
修复成功。
如果修复失败,可以尝试用USE_FRM选项,例:
mysql> REPAIR TABLE  poller_item USE_FRM;
由于表数量比较多,使用脚本进行检查和修复



#!/bin/bash

#This script used by repair tables
mysql_host=localhost
mysql_user=root 

database=cacti
tables=$(mysql -h$mysql_host -u$mysql_user $database -A -Bse "show tables")
for arg in $tables
do
check_status=$(mysql -h$mysql_host -u$mysql_user $database -A -Bse "check table $arg" | awk '{ print $4 }')
if [ "$check_status" = "OK" ]
then
echo "$arg is ok"
else
echo $(mysql -h$mysql_host -u$mysql_user $database -A -Bse "repair table $arg")
fi
echo $(mysql -h$mysql_host -u$mysql_user $database -A -Bse "optimize table $arg")
done



      本文转自crazy_charles 51CTO博客,原文链接:http://blog.51cto.com/douya/1405653 ,如需转载请自行联系原作者




相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
相关文章
|
11天前
|
SQL 开发框架 .NET
C# Linq SaveChanges()报错 You have an error in your SQL syntex
C# Linq SaveChanges()报错 You have an error in your SQL syntex
5 0
|
5月前
|
SQL 关系型数据库 MySQL
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
错误提示: Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; che
82 0
|
2月前
|
SQL 数据采集 关系型数据库
如何解决MySQL报错 You have an error in your SQL syntax; check the manual that corresponds to your MySQL?
如何解决MySQL报错 You have an error in your SQL syntax; check the manual that corresponds to your MySQL?
|
3月前
|
SQL 分布式计算 Hadoop
【已解决[ERROR] Could not execute SQL statement. Reason:java.lang.ClassNotFoundException: org.apache.had
【已解决[ERROR] Could not execute SQL statement. Reason:java.lang.ClassNotFoundException: org.apache.had
51 0
|
3月前
|
SQL 安全 网络安全
解决:provider:Named Pipes Provider error:40无法打开SQL Server的连接 的3种方式
解决:provider:Named Pipes Provider error:40无法打开SQL Server的连接 的3种方式
106 0
|
4月前
|
SQL 存储 关系型数据库
DB2 SQL Error: SQLCODE=-668, SQLSTATE=57016
DB2 SQL Error: SQLCODE=-668, SQLSTATE=57016
|
4月前
|
SQL 关系型数据库 数据库
DB2 SQL Error: SQLCODE=-302, SQLSTATE=22001, SQLERRMC=null
DB2 SQL Error: SQLCODE=-302, SQLSTATE=22001, SQLERRMC=null
|
4月前
|
SQL 关系型数据库 MySQL
Could not execute query ---> MySql.Data.MySqlClient.MySqlException: You have an error in your SQL sy
Could not execute query ---> MySql.Data.MySqlClient.MySqlException: You have an error in your SQL sy
17 0
|
5月前
|
Java 关系型数据库 MySQL
create connection error, url: jdbc:mysql://localhost:3306/ssm, errorCode 1045, state 28000 java.sql.
create connection error, url: jdbc:mysql://localhost:3306/ssm, errorCode 1045, state 28000 java.sql.
|
9月前
|
SQL 关系型数据库 MySQL
修改mysql的密码时遇到问题ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corre
修改mysql的密码时遇到问题ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corre

热门文章

最新文章