博客首页 注册 建议与交流 排行榜 加入友情链接
推荐 投诉 搜索: 帮助

上帝他爷

分别担任CU、ITPUB以及CSDN社区的MySQL版主! 我本来想说我是吃屎的! ^_^
  yueliangdao0608.cublog.cn

关于作者
姓名:杨涛
职业:DBA
年龄:25
位置:中国-深圳
个性介绍:又长了一岁
QQ:38257291
MSN:yueliangdao0608@gmail.com
|| << >> ||
我的分类


[原创]MYSQL集群SQL节点的错误归档
1、今天倒入数据的时候碰到一个错误。
Error occured at:2007-12-03 14:41:01
Line no.:154
Error Code: 1118 - Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8052. You have to change some columns to TEXT or BLOBs

查了我对应的表,原来有的字段类型为:varchar(512).看来MySQL5.1的集群对VARCHAR类型还不是很好的支持。只能支持到VARCHAR(255)。

2、Cluster configuration warning line 46: Could not use next node id 5 for section [API], using next unused node id 7.

这个警告在于管理节点的配置里指定了具体的ID。
[mysqld]
id=5
[mysqld]
这个ID系统自己分配。
3、ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction
Temporary error: 266: Time-out in NDB, probably caused by deadlock
或者:

mysql> show warnings;
+-------+------+---------------------------------------------------------------------------------+
| Level | Code | Message                                                                         |
+-------+------+---------------------------------------------------------------------------------+
| Error | 1297 | Got temporary error 274 'Time-out in NDB, probably caused by deadlock' from NDB |
+-------+------+---------------------------------------------------------------------------------+
1 row in set (0.00 sec)

解决方法:

在管理节点的[ndbd default]
区加:
TransactionDeadLockDetectionTimeOut=10000(我这里设置了10秒)默认是1200(1.2秒)

按照顺序重新启动各个节点就不会出现问题了。


4、创建LOGFILE GROUP 失败
mysql> create logfile group lg_2
    -> add undofile 'undo_3.dat'
    -> initial_size 400M
    -> undo_buffer_size 50M
    -> engine ndb;
ERROR 1525 (HY000): Failed to create LOGFILE GROUP
mysql> show warnings;
+-------+------+---------------------------------------------------------------------------+
| Level | Code | Message                                                                   |
+-------+------+---------------------------------------------------------------------------+
| Error | 1296 | Got error 1514 'Currently there is a limit of one logfile group' from NDB |
| Error | 1525 | Failed to create LOGFILE GROUP                                            |
+-------+------+---------------------------------------------------------------------------+
2 rows in set (0.00 sec)

解决办法:
原来现在的MYSQL只支持创建一个LOGFILE GROUP文件。
只有删掉原来的才可以创建新的。

5、当把表数据存放到磁盘上时出现表满现象。
The table '#sql-51c5_1f9' is full

mysql> create index f_id on t11(id);
ERROR 1114 (HY000): The table '#sql-51c5_1f9' is full
解决办法:
增加表空间:
mysql> alter tablespace ts_1
    -> add datafile 'data_3.dat'
    -> initial_size 10M
    -> engine ndb;
Query OK, 0 rows affected (0.78 sec)

mysql> create index f_id on t11(id);
Query OK, 9900 rows affected (23.31 sec)
Records: 9900  Duplicates: 0  Warnings: 0
6、下午突然网络断了。然后查看MYSQL。
[root@localhost ~]# service mysqld status ERROR! MySQL is not running, but lock exists
不过最后自己好了。原因还没有彻底弄明白。

发表于: 2007-12-03,修改于: 2008-01-16 11:24,已浏览783次,有评论6条 推荐 投诉


网友评论
网友: zyangj 时间:2008-01-15 10:03:19 IP地址:125.33.160.★
ERROR 1525 (HY000): Failed to create LOGFILE GROUP

大侠,这个错误要如何删除原有的logfile group?具体目录是哪个?

Blog作者的回复:
把你所有数据节点目录下的UNDO以及REDO文件删除就可以了。

进入 数据节点目录,然后rm -rf *.dat


网友: zyangj 时间:2008-01-15 13:21:33 IP地址:125.33.160.★
mysql> create logfile group lg_1 add undofile 'undo_1.dat' initial_size 2048M undo_buffer_size 1024M engine=ndbcluster;
ERROR 1525 (HY000): Failed to create LOGFILE GROUP
mysql> show warnings;
+-------+------+---------------------------------------------------+
| Level | Code | Message                                           |
+-------+------+---------------------------------------------------+
| Error | 1296 | Got error 1504 'Out of logbuffer memory' from NDB |
| Error | 1525 | Failed to create LOGFILE GROUP                    |
+-------+------+---------------------------------------------------+
这个错跟您的错误码有些不同,好像是内存问题
是不是默认情况下,CLUSTER全部使用物理内存存储数据,现在的节点使用率达下面情况,该如何扩充到硬盘上,我用的是5.1.22
2008-01-15 13:46:57 [MgmSrvr] INFO     -- Node 4: Data usage is 100%(38400 32K pages of total 38400)
   2564 2008-01-15 13:46:57 [MgmSrvr] INFO     -- Node 4: Index usage is 0%(601 8K pages of total 153632)
   2565 2008-01-15 13:46:57 [MgmSrvr] INFO     -- Node 4: Resource 0 min: 0 max: 639 curr: 2
   2566 2008-01-15 13:46:57 [MgmSrvr] INFO     -- Node 4: Resource 2 min: 0 max: 0 curr: 2
   2567 2008-01-15 13:46:57 [MgmSrvr] INFO     -- Node 5: Data usage is 98%(37909 32K pages of total 38400)
   2568 2008-01-15 13:46:57 [MgmSrvr] INFO     -- Node 5: Index usage is 0%(561 8K pages of total 153632)
   2569 2008-01-15 13:46:57 [MgmSrvr] INFO     -- Node 5: Resource 0 min: 0 max: 639 curr: 2
   2570 2008-01-15 13:46:57 [MgmSrvr] INFO     -- Node 5: Resource 2 min: 0 max: 0 curr: 2
   2571 2008-01-15 13:46:57 [MgmSrvr] INFO     -- Node 6: Data usage is 99%(38338 32K pages of total 38400)
   2572 2008-01-15 13:46:57 [MgmSrvr] INFO     -- Node 6: Index usage is 0%(621 8K pages of total 153632)
   2573 2008-01-15 13:46:57 [MgmSrvr] INFO     -- Node 6: Resource 0 min: 0 max: 639 curr: 2
   2574 2008-01-15 13:46:57 [MgmSrvr] INFO     -- Node 6: Resource 2 min: 0 max: 0 curr: 2

Blog作者的回复:
你看一下你这几个数据节点安装目录下面有没有REDU和UNDO文件。
或者贴出你之前创建LOGFILE GROUP的语句。MYSQL现在只支持在CLUSTER中创建一个LOGFILE GROUP。


网友: zyangj 时间:2008-01-15 13:24:53 IP地址:125.33.160.★
下面是你的节点情况,我在配置文件中设置的都是1200M的内存使用.为什么实际使用却这么少.....存了五十万条数据不同,表就满了....
Connected to Management Server at: localhost:1186
Cluster Configuration
---------------------
[ndbd(NDB)]     4 node(s)
id=3 (not connected, accepting connect from 192.168.8.47)
id=4    @192.168.8.46  (Version: 5.1.22, Nodegroup: 0, Master)
id=5    @192.168.8.45  (Version: 5.1.22, Nodegroup: 1)
id=6    @192.168.8.43  (Version: 5.1.22, Nodegroup: 1)

[ndb_mgmd(MGM)] 2 node(s)
id=1    @192.168.8.36  (Version: 5.1.22)
id=2    @192.168.8.50  (Version: 5.1.22)

[mysqld(API)]   2 node(s)
id=7    @192.168.8.49  (Version: 5.1.22)
id=8    @192.168.8.43  (Version: 5.1.22)

Blog作者的回复:
你的表结构也得贴出来。
只有非索引的数据才会保存到磁盘中。其他的都在内存中保存。


网友: zyangj 时间:2008-01-15 14:37:37 IP地址:125.33.160.★
我之前就没有用过创建LOGFILE GROUP的语句,在看过您的大作后才试着这样去做.结果发现不行.....我检索我目录下面没有发现UNDO以及REDO文件,这些文件都会在数据目录(data)下面吗?

另外,如果表结构中含有索引字段,是否就不能使用表空间来存储数据了?

Blog作者的回复:
你的undo_buffer_size 给的太大。

如果你的内存许可的话。在管理节点的配置文件里面修改UNDODATABUFFER 的值,然后重新启动所有节点。


网友: zyangj 时间:2008-01-15 14:57:56 IP地址:125.33.160.★
CREATE TABLE IF NOT EXISTS `videos` (
  `vid` bigint(20) NOT NULL AUTO_INCREMENT,
  `dead` char(1) DEFAULT NULL,
  `url` varchar(255) NOT NULL,
  `snapUrl` varchar(200) DEFAULT NULL,
  `siteUrl` varchar(200) NOT NULL,
  `playerUrl` varchar(200) DEFAULT NULL,
  `channelUrl` varchar(200) NOT NULL,
  `caption` varchar(60) DEFAULT NULL,
  `keywords` varchar(60) DEFAULT NULL,
  `author` varchar(60) DEFAULT NULL,
  `size` varchar(20) DEFAULT NULL,
  `duration` varchar(20) DEFAULT NULL,
  `visitedCount` int(8) DEFAULT NULL,
  `collectionCount` int(8) DEFAULT NULL,
  `commentCount` int(8) DEFAULT NULL,
  `quotationCount` int(8) DEFAULT NULL,
  `embedcodes` mediumtext,
  `flv` varchar(512) DEFAULT NULL,
  `pubedDays` int(4) DEFAULT NULL,
  `currentTime` datetime DEFAULT '1982-12-06 06:30:00',
  `createdTime` datetime DEFAULT '1982-12-06 06:30:00',
  `description` mediumtext,
  PRIMARY KEY (`vid`,`url`),
  KEY `video_url` (`url`),
  KEY `video_siteUrl` (`siteUrl`),
  KEY `video_catagoryName` (`channelUrl`)
) ENGINE=ndbcluster DEFAULT CHARSET=utf8 AUTO_INCREMENT=566581 ;

Blog作者的回复:
mysql> create database cu_test
    -> ;
Query OK, 1 row affected (0.30 sec)

mysql> use cu_test;
Database changed
mysql> show tables;
Empty set (0.01 sec)

mysql> 
mysql> 
mysql> CREATE TABLE IF NOT EXISTS `videos` (
    -> 
    ->   `vid` bigint(20) NOT NULL AUTO_INCREMENT,
    -> 
    ->   `dead` char(1) DEFAULT NULL,
    -> 
    ->   `url` varchar(255) NOT NULL,
    -> 
    ->   `snapUrl` varchar(200) DEFAULT NULL,
    -> 
    ->   `siteUrl` varchar(200) NOT NULL,
    -> 
    ->   `playerUrl` varchar(200) DEFAULT NULL,
    -> 
    ->   `channelUrl` varchar(200) NOT NULL,
    -> 
    ->   `caption` varchar(60) DEFAULT NULL,
    -> 
    ->   `keywords` varchar(60) DEFAULT NULL,
    -> 
    ->   `author` varchar(60) DEFAULT NULL,
    -> 
    ->   `size` varchar(20) DEFAULT NULL,
    -> 
    ->   `duration` varchar(20) DEFAULT NULL,
    -> 
    ->   `visitedCount` int(8) DEFAULT NULL,
    -> 
    ->   `collectionCount` int(8) DEFAULT NULL,
    -> 
    ->   `commentCount` int(8) DEFAULT NULL,
    -> 
    ->   `quotationCount` int(8) DEFAULT NULL,
    -> 
    ->   `embedcodes` mediumtext,
    -> 
    ->   `flv` varchar(512) DEFAULT NULL,
    -> 
    ->   `pubedDays` int(4) DEFAULT NULL,
    -> 
    ->   `currentTime` datetime DEFAULT '1982-12-06 06:30:00',
    -> 
    ->   `createdTime` datetime DEFAULT '1982-12-06 06:30:00',
    -> 
    ->   `description` mediumtext,
    -> 
    ->   PRIMARY KEY (`vid`,`url`),
    -> 
    ->   KEY `video_url` (`url`),
    -> 
    ->   KEY `video_siteUrl` (`siteUrl`),
    -> 
    ->   KEY `video_catagoryName` (`channelUrl`)
    -> 
    -> ) ENGINE=ndbcluster DEFAULT CHARSET=utf8 AUTO_INCREMENT=566581 ;
Query OK, 0 rows affected (2.21 sec)

mysql> show tables;
+-------------------+
| Tables_in_cu_test |
+-------------------+
| videos            | 
+-------------------+
1 row in set (0.00 sec)

mysql> create logfile group lg_1
    -> add undofile 'undo_1.dat'
    -> initial_size 200M
    -> undo_buffer_size 200M
    -> engine ndb;
ERROR 1525 (HY000): Failed to create LOGFILE GROUP
mysql> show errors;
+-------+------+---------------------------------------------------+
| Level | Code | Message                                           |
+-------+------+---------------------------------------------------+
| Error | 1296 | Got error 1504 'Out of logbuffer memory' from NDB | 
| Error | 1525 | Failed to create LOGFILE GROUP                    | 
+-------+------+---------------------------------------------------+
2 rows in set (0.00 sec)

mysql> create logfile group lg_1 add undofile 'undo_1.dat' initial_size 200M undo_buffer_size 25M engine ndb;
Query OK, 0 rows affected (5.78 sec)


网友: zyangj 时间:2008-01-15 18:08:47 IP地址:125.33.160.★
主要是你给这个200M内存可以存多大的数据,我怕过些时,表又满了....我要存的数据有近一二百万行.....可能容量在1-2G.所以我想把这个调大点....

再次谢谢大侠....

Blog作者的回复:
这个200M你完全可以加多点。

我也问过这个问题,在官方论坛上
目前也是一边学习一边工作。

http://forums.mysql.com/read.php?25,188421,190944,quote=1


 发表评论