Skip to content

mysqli class for usage with galera cluster - includes loadbalancing

License

Notifications You must be signed in to change notification settings

Keden92/php_galera_mysqli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

galera_mysqli

  • mysqli class for usage with galera cluster
  • includes loadbalancing
!!! for ONLY 2 Node Cluster comment in Line 126 !!!

MAIN

  • mysqli class for use with galera cluster Database
  • also works with Standalone Database Server
  • uses "random" for Load-Balancing if no host specified

USAGE

  • simply pass for $host an array of servers
$hosts = array("10.0.0.1", "10.0.0.2", "10.0.0.3");
$mysqli = new galera_mysqli($hosts, $user, $pass,...);
  • for use of en explizit host pass the array_id to $hostindex
$hosts = array("10.0.0.1", "10.0.0.2", "10.0.0.3");
$mysqli = new galera_mysqli($hosts, $user, $pass,..., 2);

ADDITIONAL

  • addet magic __sleep & __wakeup methods for serialization
  • addet method get_selected_db()