ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 安装federated存储引擎

安装federated存储引擎

原创 Linux操作系统 作者:adrain_001 时间:2012-03-30 23:53:32 0 删除 编辑

Federated存储引擎可以使你在本地数据库中访问远程数据库中的数据,针对federated存储引擎表的查询会被发送到远程数据库的表上执行,本地是不存储任何数据的。

简要介绍后,是不是发现它和Oracledatabase link(数据库链接)非常相似,它所实现的功能和db link类似,要在MySQL下找寻db link替代品的,federated存储引擎是不二的选择。

1. 查看当前支持的存储引擎

SQL>show engines;

  1. +------------+---------+------------------------------------------------------------+--------------+------+------------+
  2. | Engine | Support | Comment | Transactions | XA | Savepoints |
  3. +------------+---------+------------------------------------------------------------+--------------+------+------------+
  4. | CSV | YES | CSV storage engine | NO | NO | NO |
  5. | MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
  6. | MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
  7. | InnoDB | DEFAULT | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
  8. | MyISAM | YES | Default engine as of MySQL 3.23 with great performance | NO | NO | NO |
  9. +------------+---------+------------------------------------------------------------+--------------+------+------------+
  10. 5 rows in set (0.00 sec)

发现安装MySQL时没有编译进来,只能现安装了。

2. 安装federated存储引擎

由于编译时没有选择federated,所以打算通过INSTALL PLUGIN的方式安装,正常情况下,federated是支持动态安装的:

=== Federated Storage Engine ===

Plugin Name: federated

Description: Connects to tables on remote MySQL servers

Supports build: static and dynamic

Configurations: max, max-no-ndb

可是执行以下命令时报错:

SQL>install plugin federated soname 'ha_federated.so';

ERROR 1126 (HY000): Can't open shared library '/usr/local/mysql/lib/mysql/plugin/ha_federated.so' (errno: 2 undefined symbol: dynstr_append_mem)

搜了一下,发现是个老问题,竟然到现在都没解决,可见MySQL团队的效率和管理的混乱。http://bugs.mysql.com/bug.php?id=40942

没有办法了,只有重新编译MySQL源码了, 加上--with-plugins=federated。从5.1.26开始,默认MySQL不启用federated存储引擎,所以需要在my.cnf中加入federated选项或是在命令行用--federated选项启动mysqld。编译后的结果如下:

SQL>show engines;

  1. +------------+---------+----------------------------------------------------------------------------+--------------+------+------------+
  2. | Engine | Support | Comment | Transactions | XA | Savepoints |
  3. +------------+---------+----------------------------------------------------------------------------+--------------+------+------------+
  4. | CSV | YES | CSV storage engine | NO | NO | NO |
  5. | MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
  6. | FEDERATED | YES | Federated MySQL storage engine | NO | NO | NO |
  7. | MyISAM | YES | Default engine as of MySQL 3.23 with great performance | NO | NO | NO |
  8. | InnoDB | DEFAULT | Percona-XtraDB, Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
  9. | MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
  10. +------------+---------+----------------------------------------------------------------------------+--------------+------+------------+
  11. 6 rows in set (0.00 sec)

至此,我们已经可以使用federated存储引擎了。

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26690043/viewspace-719996/,如需转载,请注明出处,否则将追究法律责任。

上一篇: innoDB启动选项
请登录后发表评论 登录
全部评论

注册时间:2012-02-13

  • 博文量
    113
  • 访问量
    259706