Tagged: 

Viewing 20 posts - 1 through 20 (of 20 total)
  • Author
    Posts
  • #88381
    Israel
    Guest

    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

    #88403
    Marko Vasiljevic
    Keymaster

    Hello 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.php

    once 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!

    #88405
    Israel
    Guest

    Thank 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 comment

    Do you have a screenshot that can help me find it on my end?

    Thanks a lot!

    #88755
    Marko Vasiljevic
    Keymaster

    Hello,

    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!

    #88932
    Torlock
    Guest

    Hi 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,
    ));
    #89005
    Marko Vasiljevic
    Keymaster

    Hello,

    Thank you for your feedback.
    Let me check this and I’ll get back to you.
    Thanks!

    #89107
    Israel
    Guest

    Hi 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{w3tc_pagecache_reject_reason}
    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.com

    Thank you!

    #89387
    Torlock
    Guest

    H Marko,

    Just wondering if you have any update on this one?

    #89468
    Marko Vasiljevic
    Keymaster

    Hello,

    Still testing the behavior, I’ll get bac to you once I have more information.
    Thanks!

    #89469
    Marko Vasiljevic
    Keymaster

    Hello,

    Still testing the behavior, I’ll get bac to you once I have more information.
    Thanks!

    #90426
    Torlock
    Guest

    Hi Marko,

    Sorry to keep bothering you but just wondering if you’ve had any progress on this one?

    #90525
    Marko Vasiljevic
    Keymaster

    Hello,

    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!

    #90565
    Hugo
    Guest

    Hello, 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

    #91180
    Israel
    Guest

    Hi 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

    #91721
    Torlock
    Guest

    In 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.

    #91728
    Marko Vasiljevic
    Keymaster

    Hello 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.

    #95097
    Israel
    Guest

    Hi Marko,

    Do you have any updates on this?

    Thank you

    #95333
    Torlock
    Guest

    Hi Marko,

    Just checking if there has been any progress on this one so far?

    #95380
    Marko Vasiljevic
    Keymaster

    Hello 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!

    #95381
    Marko Vasiljevic
    Keymaster

    Hello 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!

Viewing 20 posts - 1 through 20 (of 20 total)
  • The topic ‘Database cluster’ is closed to new replies.