Federated MySQL storage engine

8. Engine

mysql> show engines;
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| Engine             | Support | Comment                                                        | Transactions | XA   | Savepoints |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| FEDERATED          | NO      | Federated MySQL storage engine                                 | NULL         | NULL | NULL       |
| MRG_MYISAM         | YES     | Collection of identical MyISAM tables                          | NO           | NO   | NO         |
| MyISAM             | YES     | MyISAM storage engine                                          | NO           | NO   | NO         |
| BLACKHOLE          | YES     | /dev/null storage engine (anything you write to it disappears) | NO           | NO   | NO         |
| MEMORY             | YES     | Hash based, stored in memory, useful for temporary tables      | NO           | NO   | NO         |
| CSV                | YES     | CSV storage engine                                             | NO           | NO   | NO         |
| ARCHIVE            | YES     | Archive storage engine                                         | NO           | NO   | NO         |
| PERFORMANCE_SCHEMA | YES     | Performance Schema                                             | NO           | NO   | NO         |
| InnoDB             | DEFAULT | Supports transactions, row-level locking, and foreign keys     | YES          | YES  | YES        |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
9 rows in set (0.00 sec)

8.1. FEDERATED

启用 FEDERATED 引擎, 服务器环境 Ubuntu 13.04

$ sudo vim /etc/mysql/conf.d/federated.cnf
[mysqld]
federated

$ sudo service mysql restart
		
mysql> show engines;
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| Engine             | Support | Comment                                                        | Transactions | XA   | Savepoints |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| FEDERATED          | YES     | Federated MySQL storage engine                                 | NO           | NO   | NO         |
| MRG_MYISAM         | YES     | Collection of identical MyISAM tables                          | NO           | NO   | NO         |
| MyISAM             | YES     | MyISAM storage engine                                          | NO           | NO   | NO         |
| BLACKHOLE          | YES     | /dev/null storage engine (anything you write to it disappears) | NO           | NO   | NO         |
| MEMORY             | YES     | Hash based, stored in memory, useful for temporary tables      | NO           | NO   | NO         |
| CSV                | YES     | CSV storage engine                                             | NO           | NO   | NO         |
| ARCHIVE            | YES     | Archive storage engine                                         | NO           | NO   | NO         |
| PERFORMANCE_SCHEMA | YES     | Performance Schema                                             | NO           | NO   | NO         |
| InnoDB             | DEFAULT | Supports transactions, row-level locking, and foreign keys     | YES          | YES  | YES        |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
9 rows in set (0.00 sec)

A 服务器

CREATE TABLE `t1` (
	`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
	`name` VARCHAR(50) NOT NULL,
	`sex` ENUM('Y','N') NULL DEFAULT 'Y',
	`passwd` VARCHAR(50) NULL DEFAULT NULL,
	`ctime` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
	`mtime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
	PRIMARY KEY (`id`)
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB
AUTO_INCREMENT=4;
		

B 服务器

DROP TABLE `users`;

CREATE TABLE `users` (
	`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
	`name` VARCHAR(50) NOT NULL,
	`sex` ENUM('Y','N') NULL DEFAULT 'Y',
	`ctime` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
	`mtime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
	PRIMARY KEY (`id`)
) ENGINE=FEDERATED connection = 'mysql://www:qwer123@192.168.2.1:3306/test/t1';
		

上面字段描述是你需要的字段,并非所有字段。这里屏蔽了passwd字段

提示

connection = 'MySQL://用户名:密码@主机:端口/数据库/表名'

mysql> DROP TABLE `users`;
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE TABLE `users` (
    -> `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
    -> `name` VARCHAR(50) NOT NULL,
    -> `sex` ENUM('Y','N') NULL DEFAULT 'Y',
    -> `ctime` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
    -> `mtime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    -> PRIMARY KEY (`id`)
    -> ) ENGINE=FEDERATED connection = 'mysql://www:qwer123@192.168.2.1:3306/test/t1';
Query OK, 0 rows affected (0.06 sec)

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

mysql> desc users;
+-------+------------------+------+-----+---------------------+-----------------------------+
| Field | Type             | Null | Key | Default             | Extra                       |
+-------+------------------+------+-----+---------------------+-----------------------------+
| id    | int(10) unsigned | NO   | PRI | NULL                | auto_increment              |
| name  | varchar(50)      | NO   |     | NULL                |                             |
| sex   | enum('Y','N')    | YES  |     | Y                   |                             |
| ctime | timestamp        | NO   |     | 0000-00-00 00:00:00 |                             |
| mtime | timestamp        | NO   |     | CURRENT_TIMESTAMP   | on update CURRENT_TIMESTAMP |
+-------+------------------+------+-----+---------------------+-----------------------------+
5 rows in set (0.00 sec)

mysql> select * from users;
+----+------+------+---------------------+---------------------+
| id | name | sex  | ctime               | mtime               |
+----+------+------+---------------------+---------------------+
|  1 | neo  | Y    | 0000-00-00 00:00:00 | 2013-05-17 18:05:09 |
|  2 | zen  | Y    | 0000-00-00 00:00:00 | 2013-05-17 18:05:11 |
|  3 | lily | N    | 0000-00-00 00:00:00 | 2013-05-17 18:05:22 |
+----+------+------+---------------------+---------------------+
3 rows in set (0.01 sec)
时间: 2024-11-15 20:24:01

Federated MySQL storage engine的相关文章

mysql建表unknown storage engine innodb

问题描述 mysql建表unknown storage engine innodb 建表的时候出现的问题,网上百度了一下给出的方法都没有解决. 解决方案

apache mysql php配置与mysqlDefault storage engine (InnoDB) is not available解决办法

安装配置apache2 1.到apache(www.apache.org)官方网站下载最新的源代码包 2.用tar -zxvf apache_[version].tar.gz解压,得到一个目录 3.进入目录执行./configure prefix=[path] enable-module=so开始配置 例如要将apache安装在/www/ 下,则可以./configure prefix=/wwwenable-moudle=so 4.配置过后执行make,接着make install,apache

MYSQL无法启动提示: Default storage engine (InnoDB) is not available的解决方法_Mysql

在my.ini(linux下/etc/my.cnf)加上skip-innodb,就可以了. 我这样设置后,在linux下都没问题,今天在我本机winXP启动MYSQL,提示启动不起来.看下mysql目录的错误日志: 引用 090613 10:15:27 [ERROR] Default storage engine (InnoDB) is not available 090613 10:15:27 [ERROR] Aborting 090613 10:15:27 [Note] C:\www\mys

解决Default storage engine (InnoDB) is not available导致mysql无法启动的修改办法_应用技巧

一次为了修改mysql的root用户密码,就启用了本机启动模式,可再次启用mysql时,却揭示:Default storage engine (InnoDB) is not available ,mysql无法启动,后搜索网络,得知 应该是配置文件有错,这里提示:"060827  1:12:22 [ERROR] Default storage engine (InnoDB) is not available"  打开my.ini或my.cnf文件,找到default-storage-e

mysql报错Plugin 'InnoDB' registration as a STORAGE ENGINE failed

在系统日志中查看到 事件类型: 错误 事件来源: MySQL 事件种类: 无 事件 ID: 100 日期:  2016-11-10 事件:  10:00:11 用户:  N/A 计算机: xxxxxx005D 描述:Plugin 'InnoDB' registration as a STORAGE ENGINE failed. For more information, see Help and Support Center at http://www.mysql.com.  上面这句话的意思是

Plugin InnoDB registration as a STORAGE ENGINE failed解决方法

原先一台数据库未安装Innodb引擎,今天动态增加他,发现innodb加载不了,报错Plugin 'InnoDB' registration as a STORAGE ENGINE failed,从详细日志里面发现创建log file创建失败.详细日志如下:  代码如下 复制代码 InnoDB: If this error appears when you are creating an InnoDB database, InnoDB: the problem may be that durin

mysql中engine=innodb和engine=myisam的区别介绍

MyISAM类型不支持事务处理等高级处理,而InnoDB类型支持,本文为大家讲解下mysql中engine=innodb和engine=myisam的区别,不懂的朋友可以学习下,希望对大家有所帮助   最开始用MySQL Administrator建数据库的时候,表缺省是InnoDB类型,也就没有在意.后来用Access2MySQL导数据的时候发现只能导成 MyISAM类型的表,不知道这两种类型有什么区别,就去查了查.原来是MyISAM类型不支持事务处理等高级处理,而InnoDB类型支持. My

mysql中engine=innodb和engine=myisam的区别介绍_Mysql

最开始用MySQL Administrator建数据库的时候,表缺省是InnoDB类型,也就没有在意.后来用Access2MySQL导数据的时候发现只能导成 MyISAM类型的表,不知道这两种类型有什么区别,就去查了查.原来是MyISAM类型不支持事务处理等高级处理,而InnoDB类型支持. MyISAM类型的表强调的是性能,其执行数度比InnoDB类型更快,但是不提供事务支持,而InnoDB提供事务支持已经外部键等高级数据库功能.这 样就可以根据数据表不同的用处是用不同的存储类型. 另外,My

修改mysql的engine引擎

修改mysql教程的engine引擎 修改my.ini,在[mysqld]下加上     default-storage-engine=INNODB 其中红色字体部分是要指定的引擎名称. 用sql语句修改已经建成表的引擎: alter table tableName type=InnoDB 下面贴出我的my.ini文件供参考(http://www.111cn.net): [mysqld] basedir=C:Program FilesVertrigoServMysql datadir=C:Pro