项目作者: nalgoo

项目描述 :
Galera cluster driver for Doctrine
高级语言: PHP
项目地址: git://github.com/nalgoo/cluster-connection.git
创建时间: 2019-09-14T15:20:44Z
项目社区:https://github.com/nalgoo/cluster-connection

开源协议:

下载


ClusterConnection

Alows Doctrine to connect to Galera cluster (multiple “master” nodes). Initial connection will be made to node1,
but when query fails because of “cluster not ready” error, connection will be made to another node and query will
be executed again.

Usage:

  1. $em = EntityManager::create(
  2. [
  3. 'url' => 'mysql://user:pass@node1/db_name',
  4. 'wrapperClass' => ClusterConnection::class,
  5. 'driverClass' => ClusterAwarePDOMysqlDriver::class
  6. ],
  7. $config
  8. );
  9. $em->getConnection()->addNode('node2:3000');
  10. $em->getConnection()->addNode('node3');

OR

  1. $connection = ClusterConnection::createFromUrl('mysql://user:pass@node1,node2:3000,node3/db_name');
  2. $em = EntityManager::create($connection, $config);

TODO

  • Manage priority of nodes
  • Transaction support

License

MIT