WordPress数据库错误: [Got error 28 from storage engine]
SHOW FULL COLUMNS FROM `wp_options`

WordPress数据库错误: [Got error 28 from storage engine]
SELECT t.*, tt.*, tr.object_id FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON t.term_id = tt.term_id INNER JOIN wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ('category', 'post_tag', 'post_format') AND tr.object_id IN (249) ORDER BY t.name ASC

mysql cluster 7.1 集群配置 – Crazy knowledge base
Crazy knowledge base

mysql cluster 7.1 集群配置

本实例以三台虚拟机Linux CentOS系统为例:
Server1:192.168.0.100 # NDB Management Server
Server2:192.168.0.101 # 既Data Node又是SQL Node
Server3:192.168.0.102 # 既Data Node又是SQL Node
为了节约资源我把DataNode和SQLNode放在同一台机器

最新mysql-cluster(218M)下载地址:
http://ftp.jaist.ac.jp/pub/mysql/Downloads/MySQL-Cluster-7.1/mysql-cluster-gpl-7.1.14-linux-i686-glibc23.tar.gz

配置NDB Management Server

操作步骤:
tar -zxf mysql-cluster-gpl-7.1.14-linux-i686-glibc23.tar.gz
mv mysql-cluster-gpl-7.1.14-linux-i686-glibc23 /usr/local/mysql
cd /usr/local/mysql
cp bin/ndb* /usr/bin/
mkdir /var/lib/mysql-cluster
cd /var/lib/mysql-cluster
vi config.ini

[NDBD DEFAULT]
NoOfReplicas=2
[MYSQLD DEFAULT]
[NDB_MGMD DEFAULT]
[TCP DEFAULT]
# Managment Server
[NDB_MGMD]
HostName=192.168.0.100
# Storage Engines
[NDBD]
HostName=192.168.0.101
DataDir= /var/lib/mysql-cluster
[NDBD]
HostName=192.168.0.102
DataDir=/var/lib/mysql-cluster
[MYSQLD]
# 内容为空是让服务动态配置IP节点
# 配置文件要预留3个以上的空节点,因为备份需要连接一个节点
[MYSQLD]
[MYSQLD]

保存退出,启动管理服务
ndb_mgmd –initial -f config.ini #initial参数只有在config.ini文件改动的情况下需要
ndb_mgm -e show #查看启动状态

配置Data Node和SQL Node

操作步骤如下:
tar -zxf mysql-cluster-gpl-7.1.14-linux-i686-glibc23.tar.gz
mv mysql-cluster-gpl-7.1.14-linux-i686-glibc23 /usr/local/mysql
cd /usr/local/mysql
groupadd mysql
useradd -g mysql mysql
scripts/mysql_install_db –user=mysql
chown -R mysql.mysql *
cp support-files/mysql.server /etc/rc.d/init.d/mysqld
cp support-files/my-medium.cnf /etc/my.cnf
cp bin/ndb* /usr/bin/
chmod +x /etc/rc.d/init.d/mysqld

vi /etc/my.cnf
在末尾加入

[mysqld]
ndbcluster
ndb-connectstring=192.168.0.100
[mysql_cluster]
ndb-connectstring=192.168.0.100

mkdir /var/lib/mysql-cluster
cd /var/lib/mysql-cluster
ndbd –initial #initial参数只有在管理服务器config.ini文件改动的情况下需要
/etc/init.d/mysqld restart

测试检查
查看Server1工作状态:
[root@mysql3 root]# ndb_mgm
— NDB Cluster — Management Client —
ndb_mgm> show
Connected to Management Server at: localhost:1186
Cluster Configuration
———————
[ndbd(NDB)] 2 node(s)
id=2 @192.168.0.101 (mysql-5.1.56 ndb-7.1.14, Nodegroup: 0, Master)
id=3 @192.168.0.102 (mysql-5.1.56 ndb-7.1.14, Nodegroup: 0)

[ndb_mgmd(MGM)] 1 node(s)
id=1 @192.168.0.100 (mysql-5.1.56 ndb-7.1.14)

[mysqld(API)] 3 node(s)
id=4 @192.168.0.101 (mysql-5.1.56 ndb-7.1.14)
id=5 @192.168.0.102 (mysql-5.1.56 ndb-7.1.14)
id=6 (not connected, accepting connect from any host)

出现如上信息证明已经配置成功。

在Server2中:
# mysql
> use test;
> CREATE TABLE ctest (i INT) ENGINE=NDBCLUSTER;
> INSERT INTO ctest () VALUES (1);
> SELECT * FROM ctest;
应该可以看到1 row returned信息(返回数值1)。
如果上述正常,则换到Server2上重复上面的测试,观察效果。如果成功,则在Server2中执行INSERT再换回到Server1观察是否工作正常。
如果都没有问题,那么恭喜成功!

备份与恢复

备份:
在Server1中执行
[root@mysql3 root]# ndb_mgm
ndb_mgm> start backup
查看Server2, Server3 /var/lib/mysql-cluster目录下出现BACKUP备份成功。

恢复:
在存储节点Master(192.168.0.101)上执行ndb_restore还原命令
cd /var/lib/mysql-cluster
ndb_restore -n2 -b1 -r -m –backup_path=BACKUP/BACKUP-1/
命令解释:
-n 当前存储节点的nodeid
-b 要还原的backupid
-r 数据开关,也就是还原数据了
-m 还原表结构
–backup_path 备份路径
在存储节点Slave(192.168.0.102)上执行ndb_restore还原命令
cd /var/lib/mysql-cluster
ndb_restore -n3 -b1 -r -d –backup_path=BACKUP/BACKUP-1/
在Master备份的时候要加 -m 开关。
在Slave上要加-d 而且不要-m开关。

恢复时曾经出现这样的错误
Configuration error: Error : Could not alloc node id at 192.168.0.100 port 1186: No free
node id found for mysqld
Failed to connect to ndb!!
Failed to initialize consumers

这个错误的原因是恢复时需要一个SQL Node结点,这也为什么以上config.ini文件中有三个[MYSQLD]的原因。

详细文档请参见:
http://dev.mysql.com/doc/refman/5.1/zh/ndbcluster.html#mysql-cluster-configuration

mysql cluster 7.1 集群配置

WordPress数据库错误: [Got error 28 from storage engine]
SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON t.term_id = tt.term_id INNER JOIN wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ('category') AND tr.object_id IN (248) ORDER BY t.name ASC

WordPress数据库错误: [Got error 28 from storage engine]
SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON t.term_id = tt.term_id INNER JOIN wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ('category') AND tr.object_id IN (250) ORDER BY t.name ASC

滚动到顶部