我知道這篇文章有點舊,但似乎很多人都遇到聯合引擎的問題。
當通過yum安裝mysql二進制文件時,您已經擁有HA(高可用性)插件。您只需在mysql CLI中加載插件即可。
這裏的基本過程是:
啓動mysqld如果它尚未啓動。確保'federated'不在/etc/my.cnf中。
EX:此時的/etc/my.cnf看起來像這樣從一個標準的YUM安裝....
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
登錄到MySQL的CLI以root(或具有足夠權限的另一個帳戶)。
Type: show engines;
你應該看不到任何聯邦引擎在這一點上,像這樣:
mysql> show engines;
+------------+---------+------------------------------------------------------------+--- -----------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+------------+---------+------------------------------------------------------------+--- -----------+------+------------+
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| CSV | YES | CSV storage engine | NO | NO | NO |
| MyISAM | DEFAULT | Default engine as of MySQL 3.23 with great performance | NO | NO | NO |
| InnoDB | YES | 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 |
+------------+---------+------------------------------------------------------------+--------------+------+------------+
5 rows in set (0.00 sec)
- >糊底< -
爲了使盟員引擎,鍵入以下內容:
install plugin federated soname 'ha_federated.so'
現在,當你'顯示引擎'時,你會看到FEDERATED引擎,但關閉.. 。
它看起來是這樣的:
mysql> show engines;
+------------+---------+------------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+------------+---------+------------------------------------------------------------+--------------+------+------------+
| FEDERATED | NO | Federated MySQL storage engine | NULL | NULL | NULL |
| CSV | YES | CSV storage engine | NO | NO | NO |
| MyISAM | DEFAULT | Default engine as of MySQL 3.23 with great performance | NO | NO | NO |
| InnoDB | YES | 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 |
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
+------------+---------+------------------------------------------------------------+--------------+------+------------+
6 rows in set (0.00 sec)
您現在可以安全地添加行 '聯合' 到/etc/my.cnf文件裏是這樣的:
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
federated
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
重啓mysqld(服務mysqld restart等)
重啓後,回到mysql CLI。
Type 'show engines;'
您現在應該看到FEDERATED引擎可用,並且以SUPPORT方式顯示爲YES。
mysql> show engines;
+------------+---------+------------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+------------+---------+------------------------------------------------------------+--------------+------+------------+
| FEDERATED | YES | Federated MySQL storage engine | NO | NO | NO |
| CSV | YES | CSV storage engine | NO | NO | NO |
| MyISAM | DEFAULT | Default engine as of MySQL 3.23 with great performance | NO | NO | NO |
| InnoDB | YES | 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 |
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
+------------+---------+------------------------------------------------------------+--------------+------+------------+
6 rows in set (0.00 sec)
和你做......出去並建立聯合表...
祝你好運!
在Windows上,要修改的文件是安裝目錄中的my.ini文件(例如'C:\ Program Files \ MySQL \ MySQL Server 5.1') – 2012-12-10 08:23:57
在Windows中,它也必須是下一件事在[mysqld]之後加上換行符,就像這樣 - > [mysqld](換行符) 聯合 – 2013-07-11 07:55:07
無法得到這個工作,打開my.ini並在'[mysqld]'之後的新行中添加'federated',仍然沒有看到它啓用。我正在使用Windows 8上的MySQL 5.6.12。任何想法可能是錯的? – 2013-07-29 06:01:03