Tagged: DB Cluster
- AuthorPosts
- May 12, 2023 at 11:56 am #88381IsraelGuest
Hi,
We have PRO version of the plugin and recently found in this post that is possible to use a database cluster to send write and read queries to different database endpoints.
I have copied dbcluster-config-sample.php file into /wp-content/db-cluster-config.php and enabled
$w3tc_dbcluster_config = array(
section like this:$w3tc_dbcluster_config = array( 'databases' => array( 'master' => array( 'host' => DB_HOST, 'user' => DB_USER, 'password' => DB_PASSWORD, 'name' => DB_NAME ), 'slave' => array( 'host' => READER_HOST, 'user' => DB_USER, 'password' => DB_PASSWORD, 'name' => DB_NAME, 'write' => false, 'read' => true, 'timeout' => 0.2, ));
… and have also modified wp-config.php to define ‘READER_HOST’ by adding this:
define('READER_HOST', 'mysql-reader-endpoint.eu-west-1.rds.amazonaws.com');
But I don’t see the ‘Enable database cluster’ option you mentioned in the above post. It should be in General Settings -> Database Cache page but I can’t find it.
By the way, we are using a single WordPress site, not multisite/network.We are in the latest 2.3.2 version of the plugin.
Thanks in advance
May 12, 2023 at 12:00 pm #88403Marko VasiljevicKeymasterHello Israel,
Thank you for reaching out and I am happy to assist you with this.
The ‘Enable database cluster’ option won’t appear on single-blog setups (bug). However, we are working on a fix for this, and this will be added in the future W3 Total Cache releases.
You can find the example of the file in ini/dbcluster-config-sample.phponce edited and placed to /wp-content/db-cluster-config.php – it starts to work regardless of the checkbox. there should be DB cluster word in footer comment
I hope this helps!
Thanks!
May 15, 2023 at 9:16 am #88405IsraelGuestThank you Marko,
I’m monitoring my reader instance and I don’t see any incoming connections so I guess the db-cluster config is not working somehow…
What do you mean by this?
there should be DB cluster word in footer commentDo you have a screenshot that can help me find it on my end?
Thanks a lot!
May 15, 2023 at 1:11 pm #88755Marko VasiljevicKeymasterHello,
Thank you for your feedback.
When you inspect the source and check the developer tools at the bottom of the page there should be a W3TC HTML snippet:
<!-- Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/
Can you please let me know if you can see this and also let me know the website URL?
Thanks!May 18, 2023 at 12:23 pm #88932TorlockGuestHi there,
Having the exact same issue as above at the moment. Edited dbcluster-config-sample.php and moved into /wp-content/db-cluster-config.php. But checking the number of connects on the read replica for the past hour and it’s 0.
Also, I can’t see the comment you mention, is it in the source of a particular page?
<?php global $w3tc_dbcluster_config; $w3tc_dbcluster_config = array( /** * Persistent (bool) * * This determines whether to use mysql_connect or mysql_pconnect. The effects * of this setting may vary and should be carefully tested. * Default: false */ 'persistent' => false, /** * check_tcp_responsiveness * * Enables checking TCP responsiveness by fsockopen prior to mysql_connect or * mysql_pconnect. This was added because PHP's mysql functions do not provide * a variable timeout setting. Disabling it may improve average performance by * a very tiny margin but lose protection against connections failing slowly. * Default: true */ 'check_tcp_responsiveness' => true, /** * Default is to always (reads & writes) use the master db when user is in administration backend. * Set use_master_in_backend to false to disable this behavior. * * WARNING: if your cluster has any replication delays then when this is enabled, you may not see * any admin changes until the replication catches up with the change written to your master * server and will see old content/configuration until that point in time - You should test this * in your environment fully. */ 'use_master_in_backend' => true, /** * This set the charset that the db connection should use. * If DB_CHARSET is set there is no need to set $wpdb_cluster->charset. */ 'charset' => DB_CHARSET, /** * This set the charset that the db connection should use. * If DB_COLLATE is set there is no need to set $wpdb_cluster->collate. */ 'collate' => DB_COLLATE, /** Configuration Functions **/ /** * database is an associative array with these parameters: * host (required) Hostname with optional :port. Default port is 3306. * user (required) MySQL user name. * password (required) MySQL user password. * name (required) MySQL database name. * read (optional) Whether server is readable. Default is 1 (readable). * Also used to assign preference. * write (optional) Whether server is writable. Default is 1 (writable). * Also used to assign preference in multi-master mode. * dataset (optional) Name of dataset. Default is 'global'. * timeout (optional) Seconds to wait for TCP responsiveness. Default is 0.2 * connect_function (optional) connection function to use * zone (optional) name of zone where server is located. * Used for web applications hosted on cluster * * Read & write * A database definition can include 'read' and 'write' parameters. These * operate as boolean switches but they are typically specified as integers. * They allow or disallow use of the database for reading or writing. * * A master database might be configured to allow reading and writing: * 'write' => true, * 'read' => true, * while a slave would be allowed only to read: * 'write' => false, * 'read' => true, * * It might be advantageous to disallow reading from the master, such as when * there are many slaves available and the master is very busy with writes. * 'write' => true, * 'read' => false, * */ /** * This adds the same server again, only this time it is configured as a slave. * The last three parameters are set to the defaults but are shown for clarity. */ $w3tc_dbcluster_config = array( 'databases' => array( 'master' => array( 'host' => DB_HOST, 'user' => DB_USER, 'password' => DB_PASSWORD, 'name' => DB_NAME ), 'slave' => array( 'host' => 'read-replica.redacted.eu-west-2.rds.amazonaws.com', 'user' => DB_USER, 'password' => DB_PASSWORD, 'name' => DB_NAME, 'write' => false, 'read' => true, 'timeout' => 0.4, ));
May 18, 2023 at 12:24 pm #89005Marko VasiljevicKeymasterHello,
Thank you for your feedback.
Let me check this and I’ll get back to you.
Thanks!May 22, 2023 at 12:49 pm #89107IsraelGuestHi Marko and thank you for your message,
Yes, there is a code snippet at the bottom but it seems there is nothing related to ‘DB cluster’:
<!-- Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/ Object Caching 0/2 objects using redis Page Caching using redis Database Caching using redis (Request-wide modification query) Fragment Caching 102/180 fragments using redis Served from: localhost @ 2023-05-19 15:49:06 by W3 Total Cache -->
The website URL is:
https://trustedd.comThank you!
May 22, 2023 at 12:49 pm #89387TorlockGuestH Marko,
Just wondering if you have any update on this one?
May 22, 2023 at 12:50 pm #89468Marko VasiljevicKeymasterHello,
Still testing the behavior, I’ll get bac to you once I have more information.
Thanks!May 22, 2023 at 12:50 pm #89469Marko VasiljevicKeymasterHello,
Still testing the behavior, I’ll get bac to you once I have more information.
Thanks!June 2, 2023 at 12:05 pm #90426TorlockGuestHi Marko,
Sorry to keep bothering you but just wondering if you’ve had any progress on this one?
June 2, 2023 at 12:06 pm #90525Marko VasiljevicKeymasterHello,
Thank you for your feedback.
Following the instructions, this is working in our tests.
We need to make sure that we are able to replicate everything.
Sorry for the delay on this.
Thanks!June 6, 2023 at 10:55 am #90565HugoGuestHello, I have been trying to set this configuration up for a while now and haven’t been able to do so…
Just want to add that after reading numerous posts on boldgrid, wodpress.org plugin page and github issues, a solution is never given by w3tc team, all the responses are somehow vague and don’t really provide any clarification or options (a quick search reveals multiple posts reporting this same issue and none of them have a conclusive response from w3tc team.
I actually bought the premium version of the plugin for this feature exclusively, most of us did and after extensive reading and testing I dare to say that said feature does not work at all, it just seems strange to me w3tc team’s reluctance to admit so, and their efforts to just drag the discussions trying to buy time or something like that.
I’ve read posts from over a couple of years a go and none of them have a solution,
Just a plain definitive answer saying this feature is not ready would help us customers to just move on and find another one
June 12, 2023 at 10:09 am #91180IsraelGuestHi Marko,
Do you have a fix for this problem? I agree with Hugo and we also purchased the premium version to have the database cluster setting, but we have not been able to get it to work after numerous attempts.
Could you please help or have any insight on this?
Thanks in advance
June 12, 2023 at 12:55 pm #91721TorlockGuestIn agreement with the above, we purchased the premium version solely for this feature as we can (in theory) run a cluster alongside Memcached whereas HyperDB conflicted with W3TC previously as they both use the db.php file.
Just an idea of current progress or a rough timeframe would be much appreciated.
June 12, 2023 at 12:56 pm #91728Marko VasiljevicKeymasterHello everyone.
Thank you all for your feedback.
It’s much appreciated. I am in talks with the devs and I’ll get back to you as soon as I have a proper answer.
Thank you for your patience.June 28, 2023 at 12:21 pm #95097IsraelGuestHi Marko,
Do you have any updates on this?
Thank you
June 28, 2023 at 12:21 pm #95333TorlockGuestHi Marko,
Just checking if there has been any progress on this one so far?
June 28, 2023 at 12:38 pm #95380Marko VasiljevicKeymasterHello Everyone,
First of all, my sincerest apologies for the delay on this matter.
We have managed to find the problem and the reason why we could not replicate the issue. In the past weeks, we’ve put a lot of effort into this and we have found the solution.
This problem will be fixed in the next release, and since we need to change some files, unfortunately, it’s not a one-liner fix.I’ll make sure to share the fix immediately once we confirm it’s working.
Once again, thank you for your patience, and please make sure to check for the upcoming release, or this topic thread where I’ll share the information about the fix.
Thank you once again!
June 28, 2023 at 12:38 pm #95381Marko VasiljevicKeymasterHello Everyone,
First of all, my sincerest apologies for the delay on this matter.
We have managed to find the problem and the reason why we could not replicate the issue. In the past weeks, we’ve put a lot of effort into this and we have found the solution.
This problem will be fixed in the next release, and since we need to change some files, unfortunately, it’s not a one-liner fix.I’ll make sure to share the fix immediately once we confirm it’s working.
Once again, thank you for your patience, and please make sure to check for the upcoming release, or this topic thread where I’ll share the information about the fix.
Thank you once again!
- AuthorPosts
- The topic ‘Database cluster’ is closed to new replies.