Home  >  Q&A  >  body text

After installing MySQL, how to activate the federation engine?

I have 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 |

I need to enable federation engine in mysql. what should I do?

P粉475126941P粉475126941367 days ago606

reply all(2)I'll reply

  • P粉296080076

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

    I know this post is a bit old, but it seems like a lot of people are having issues with the union engine.

    When installing the mysql binary via yum, you already have the HA (High Availability) plugin. You just load the plugin in the mysql CLI.

    The basic process is as follows:

    Start mysqld (if not already started). Make sure "federated" is not in /etc/my.cnf at this time.

    EX: At this point, /etc/my.cnf will look like this on a standard YUM installation...

    [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 in to the mysql CLI using root (or another account with sufficient permissions).

    Type:   show engines;

    You should not see the FEDERATED engine at this point, as shown below:

    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 pasting <--<--

    To enable the federation engine, type the following:

    install plugin federated soname 'ha_federated.so'

    Now when you "Show Engines" you will see the FEDERATED engine, but it is turned off...

    It looks 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 "federated" line to the /etc/my.cnf file like this:

    
        [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 restarts, etc...)

    After restarting, return to mysql CLI.

    Type 'show engines;'

    You should now see that the FEDERATED engine is available and SUPPORT is 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)
    
    

    You are done...continue to create federated tables...

    Good luck!

    reply
    0
  • P粉457445858

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

    Edit /etc/my.cnf and add the following lines in the [mysqld] section:

    federated

    Equivalent to specifying --federated

    on the command line

    reply
    0
  • Cancelreply