Mysql 開啟Federated引擎的辦法。本站提示廣大學習愛好者:(Mysql 開啟Federated引擎的辦法)文章只能為提供參考,不一定能成為您想要的結果。以下是Mysql 開啟Federated引擎的辦法正文
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存儲引擎了。