Search code examples
yii2mysql-cluster

Connect Yii2 app to My sql cluster


Does it makes any different if I was using mysql db and now I want to use Mysql cluster on my server. How will this affect my yii2 application ?? do I have to make any changes to db connection or just connect to any node ? does this affect Active Queries ?? Does it affect the active model relations ??

Thanks in advance.


Solution

  • You need to carefully read Known Limitations of NDB Cluster section in the MySQL docs.

    Most important parts are:

    • column width limit for indexation,
    • TEXT and BLOB cannot be indexed,
    • BIT column cannot be a primary key, unique key, or index, nor can it be part of a composite primary key, unique key, or index,
    • you cannot have table with AUTO_INCREMENT column and no explicit primary key,
    • only READ COMMITTED transaction isolation level,
    • foreign keys are supported only in NDB Cluster 7.3 and later.

    AR implementation in Yii 2 should be basically fine. You connect in the same way as usual.