Selepas memasang MySQL, bagaimana untuk mengaktifkan enjin persekutuan?
P粉475126941
P粉475126941 2023-10-18 08:51:44
0
2
640

Saya ada 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 |

Saya perlu mendayakan enjin bersekutu dalam mysql. apa patut saya buat?

P粉475126941
P粉475126941

membalas semua(2)
P粉296080076

Saya tahu siaran ini agak lama, tetapi nampaknya ramai yang menghadapi masalah dengan enjin kesatuan.

Apabila memasang binari mysql melalui yum, anda sudah mempunyai pemalam HA (Ketersediaan Tinggi). Anda hanya memuatkan pemalam dalam mysql CLI.

Proses asasnya adalah seperti berikut:

Mulakan mysqld jika belum bermula. Pastikan "federated" tiada dalam /etc/my.cnf pada masa ini.

Cth: Pada ketika ini, /etc/my.cnf akan kelihatan seperti ini pada pemasangan YUM standard...

[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 masuk ke mysql CLI menggunakan root (atau akaun lain dengan kebenaran yang mencukupi).

Type:   show engines;

Pada ketika ini anda tidak sepatutnya melihat enjin PERSEKUTUAN, seperti yang ditunjukkan di bawah:

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)

--> Tamat tampal

Untuk mendayakan enjin persekutuan, taip yang berikut:

install plugin federated soname 'ha_federated.so'

Sekarang apabila anda "Show Engines" anda akan nampak enjin FEDERATED, tetapi dimatikan...

Ia kelihatan seperti ini:


    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)

Anda kini boleh menambah baris "bersekutu" dengan selamat pada fail /etc/my.cnf seperti ini:


    [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

Mulakan semula mysqld (perkhidmatan mysqld restart dll...)

Selepas dimulakan semula, kembali ke mysql CLI.

Type 'show engines;'

Anda kini harus melihat bahawa enjin PERSEKUTUAN tersedia dan SOKONGAN adalah YA.


    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)

Anda sudah selesai...teruskan mencipta meja persekutuan...

Semoga berjaya kepada anda!

P粉457445858

Edit /etc/my.cnf 并在 [mysqld] bahagian dan tambah baris berikut:

federated

Setara dengan menyatakan --federated

pada baris arahan
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan