YES
支持並開啟
DEFAULT
支持並開啟
, 並且為默認引擎
NO
不支持
DISABLED
支持,但未開啟參考一下在windows下的解決辦法,在my.cnf中增加一行
復制代碼 代碼如下:
federated
重啟mysql服務後,
mysql> show engines;
Federated存儲引擎可以使你在本地數據庫中訪問遠程數據庫中的數據,針對federated存儲引擎表的查詢會被發送到遠程數據庫的表上執行,本地是不存儲任何數據的。
簡要介紹後,是不是發現它和Oracle的database link(數據庫鏈接)非常相似,它所實現的功能和db link類似,要在MySQL下找尋db link替代品的,federated存儲引擎是不二的選擇。
1. 查看當前支持的存儲引擎
SQL>show engines;
復制代碼 代碼如下:
+------------+---------+------------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+------------+---------+------------------------------------------------------------+--------------+------+------------+
| CSV | YES | CSV storage engine | NO | NO | NO |
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
| InnoDB | DEFAULT | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
| MyISAM | YES | Default engine as of MySQL 3.23 with great performance | NO | NO | NO |
+------------+---------+------------------------------------------------------------+--------------+------+------------+
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;
復制代碼 代碼如下:
+------------+---------+----------------------------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+------------+---------+----------------------------------------------------------------------------+--------------+------+------------+
| CSV | YES | CSV storage engine | NO | NO | NO |
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| FEDERATED | YES | Federated MySQL storage engine | NO | NO | NO |
| MyISAM | YES | Default engine as of MySQL 3.23 with great performance | NO | NO | NO |
| InnoDB | DEFAULT | Percona-XtraDB, Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
+------------+---------+----------------------------------------------------------------------------+--------------+------+------------+
6 rows in set (0.00 sec)
至此,我們已經可以使用federated存儲引擎了。