suchen

Heim  >  Fragen und Antworten  >  Hauptteil

Wie aktiviere ich nach der Installation von MySQL die Federation Engine?

Ich habe 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 |

Ich muss die Verbund-Engine in MySQL aktivieren. was soll ich machen?

P粉475126941P粉475126941409 Tage vor637

Antworte allen(2)Ich werde antworten

  • P粉296080076

    P粉2960800762023-10-19 07:17:27

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

    当通过 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

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

    Type:   show engines;

    此时您应该看不到 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)

    --> 结束粘贴 <--

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

    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)
    
    

    您现在可以安全地将“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
    
    

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

    重启后,返回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)
    
    

    您已完成...继续创建联邦表...

    祝你好运!

    Antwort
    0
  • P粉457445858

    P粉4574458582023-10-19 00:08:00

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

    federated

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

    Antwort
    0
  • StornierenAntwort