I have implemented MySQL Sharding using MySQL Fabric as following steps:
Steps:
1. Install latest (mysql-utilities-1.5.2 utility) for MySQL Fabric and enable mysqlnd_ms for php-aware-connector
2. Set up and manage MySQL Fabric
3. Create group (global, shard groups) and add server into groups
4. Define database schema and tables , range all for shard the database/table
5. Enable GTID all servers as per requirement
5. Verify and Test using command (mysqlfabric sharding lookup_servers database_name.table_name 100000), It ping the right servers as I need
Issue: I am not able to connect PHP application with MySQL Fabric, but the same set up of MySQL Fabric if I use with python application(its connector) works fine.
I got this error while connecting php application to MySQL Fabric:
Warning: mysqlnd_ms_fabric_select_shard(): (mysqlnd_ms) Didn't receive usable servers from MySQL Fabric in /var/www/html/shard.php on line 49
Warning: mysqli::query(): (mysqlnd_ms) Couldn't find the appropriate master connection. 0 masters to choose from. Something is wrong in /var/www/html/shard.php on line 53
Warning: mysqli::query(): (mysqlnd_ms) No connection selected by the last filter in /var/www/html/shard.php on line 53
[2000] (mysqlnd_ms) No connection selected by the last filter