t4g/ha-proxy

Basic HAProxy Split R/W implementation for PDO

1.2.4 2014-08-18 12:38 UTC

This package is not auto-updated.

Last update: 2024-04-23 04:27:27 UTC


README

##Introduction

This project exposes the following namespaces for use in your custom use:

  • CSI\Drivers\PDO\HAProxy

EXAMPLE

For Vanilla FW

	use CSI\Drivers\PDO

	$proxy = new HAProxy();
	$proxy->CreatMaster('mysql:host=MASTER_DB_HOST;dbname=MASTER_DB_NAME','MASTER_DB_USER','MASTER_DB_PASSWORD');
	$proxy->CreateReadonly( 'mysql:host=readonly_DB_HOST;dbname=readonly_DB_NAME','readonly_DB_USER','readonly_DB_PASSWORD');


	// Framework::setup($proxy);

For PDO override

	use CSI\Drivers\PDO\HAProxy as PDO;

or:

	if ($dsn instanceof PDO || $dsn instanceof HAProxy) {

	This line happens twice on current RedBean v3.0.1, on lines 29 and 1937 on rb.php file. Repalce both.

or:

	$SOME_PDO  ...

	$SOME_PDO = new HAProxy($SOME_PDO);
	$SOME_PDO->CreateReadonly( 'mysql:host=readonly_DB_HOST;dbname=readonly_DB_NAME','readonly_DB_USER','readonly_DB_PASSWORD');


	\PDO $SOME_PDO  ...

Limitations

HAProxy supports the simplest MySQL Replication setup, where you have a Master, and a readonly.

Contributors & Authors

@t4g @mauricoder