MySQL 安装后如何在mysql中启用联合引擎?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5210309/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 19:00:23  来源:igfitidea点击:

how can i enable federated engine in mysql after installation?

mysqlfederated-storage-engine

提问by Alaa


I have mysql 5.1.44


我有 mysql 5.1.44

mysql> show engines;
+------------+---------+
| Engine     | Support | 
+------------+---------+
| ndbcluster | NO      | 
| MRG_MYISAM | YES     | 
| BLACKHOLE  | YES     | 
| CSV        | YES     | 
| MEMORY     | YES     | 
| FEDERATED  | NO      | 
| ARCHIVE    | YES     | 
| InnoDB     | YES     | 
| MyISAM     | DEFAULT |

now, i need to enable federated engine in mysql, how can i do so?

现在,我需要在 mysql 中启用联合引擎,我该怎么做?

回答by Lina

Edit /etc/my.cnfand in the [mysqld]section, add the line:

编辑/etc/my.cnf并在该[mysqld]部分中添加以下行:

federated

It's equivalent to specifying --federatedon the command line

相当于--federated在命令行指定

回答by William McCarthy

I know the post is a little old, but it seems that many people are having issues with federated engines.

我知道这篇文章有点旧,但似乎很多人都遇到了联合引擎的问题。

When the mysql binaries are installed via yum, you already have the HA (High Availability) plugins. You simply need to load the plugins within the mysql CLI.

通过 yum 安装 mysql 二进制文件时,您已经拥有 HA(高可用性)插件。您只需要在 mysql CLI 中加载插件。

Here is the basic process:

下面是基本过程:

Start mysqld if it is not already started. Make sure 'federated' is NOT in /etc/my.cnf at this point.

如果 mysqld 尚未启动,则启动它。确保此时 'federated' 不在 /etc/my.cnf 中。

EX: At this time, /etc/my.cnf will look like this from a standard YUM install....

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

Log into the mysql CLI with root (or another account with sufficient privilege).

使用 root(或其他具有足够权限的帐户)登录 mysql CLI。

Type:   show engines;

You should see no FEDERATED engine at this point, like this:

此时您应该看不到 FEDERATED 引擎,如下所示:

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)

--> END PASTE <--

--> 结束粘贴 <--

To enable the federate engine, type the following:

要启用联邦引擎,请键入以下内容:

install plugin federated soname 'ha_federated.so'

NOW, when you 'show engines' you will see the FEDERATED Engine, but turned off...

现在,当您“显示引擎”时,您将看到 FEDERATED 引擎,但已关闭...

It will look like this:

它看起来像这样:

    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)

You can now safely add the line 'federated' to the /etc/my.cnf file like this:

您现在可以像这样安全地将 'federated' 行添加到 /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

Restart mysqld (service mysqld restart, etc...)

重启mysqld(服务mysqld重启等...)

After the restart, go back in to the mysql CLI.

重启后,回到mysql CLI。

Type 'show engines;'

You should now see the FEDERATED Engine available and with SUPPORT as YES.

您现在应该看到 FEDERATED Engine 可用,并且 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)

And you are done...go forth and create federate tables...

你已经完成了......继续创建联邦表......

Good luck!

祝你好运!

回答by The Scrum Meister

Beginning with MySQL 5.0.64, the FEDERATED storage engine is not enabled by default in the running server; to enable FEDERATED, you must start the MySQL server binary using the --federatedoption. — MySQL Documentation

从 MySQL 5.0.64 开始,在运行的服务器中默认不启用 FEDERATED 存储引擎;要启用 FEDERATED,您必须使用该--federated选项启动 MySQL 服务器二进制文件。— MySQL 文档

To use the --federatedoptionin a configuration file drop the --.

要在配置文件中使用该--federated选项,请删除--.

Example

例子

my.cnf

我的.cnf

[mysqld]
federated