• Resolved maintanosgr

    (@maintanosgr)


    Hi,

    I’m trying to configure W3TC with Redis and I’m experiencing multiple configuration issues.

    Let me explain my situation and setup first so that the rest will be more clear

    On the localhost I have set up

    – a redis-server which is listening on 127.0.0.1:6379 with empty password
    – a docker instance redis-server which is listening on 127.0.0.1:63790 with a password

    I’m running monitor db command in both redis instances to see where W3TC is writing at.

    And I would like to setup W3TC to use the docker instance only.

    I’ve read about the db-config.php file but in my case adding that to

    wp-content\plugins\w3-total-cache\ini\

    does not work.

    It doesn’t seem to load the file at all. I’ve tried naming it db-config.php and config-db.php after I found the file wp-content\plugins\w3-total-cache\ini\config-db-sample.php

    None of the above worked. This is the first issue.

    In the end I’ve copied the config from file

    wp-content\plugins\w3-total-cache\ini\config-db-sample.php to wp-config.php to make sure the variables are defined even before W3TC is initiated and that seems to have an effect. So I added the following

    
    define( 'W3TC_CONFIG_CACHE_ENGINE', 'redis');
    define( 'W3TC_CONFIG_CACHE_REDIS_SERVERS', 'redis_hostname::63790' );
    
    // optional redis settings
    define( 'W3TC_CONFIG_CACHE_REDIS_PERSISTENT', true );
    define( 'W3TC_CONFIG_CACHE_REDIS_DBID', 0 );
    define( 'W3TC_CONFIG_CACHE_REDIS_PASSWORD', 'mypass' );
    

    Now I’m monitoring my redis-servers and W3TC is writing to both redis-servers the data.

    I’ve shut down the redis-server on localhost and it’s only writing to the docker instance. I’ve shut down the docker instance and it’s only writing to the local instance.

    So, how do I force it to write only to the defined instance via config properly? This is my second issue

    Finally it’s always writing to database 0, never to 15 that I added to the config in both instances local and docker.

    • This topic was modified 4 years, 6 months ago by maintanosgr.
    • This topic was modified 4 years, 6 months ago by maintanosgr.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @maintanosgr

    I am sorry about the issue you are experiencing and I am happy to assist you with this.
    Can you please share the screenshot of the Performance>Database Cache, to check what you seed to Redis hostname:port / IP:port:
    Thanks!

    Thread Starter maintanosgr

    (@maintanosgr)

    Oh, I see.

    I thought I had to only set it globally. I had to set the settings for every single type of cache and now it seems all are working well. My omission because most systems I’ve seen just use a general configuration for redis. I guess this can help if you’re using a redis cluster.

    I no longer see double entries on both redis servers but only on the configured ones.

    You pointed me in the right direction, so thank you very much.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @maintanosgr

    Glad I could help and that your issue is resolved.
    Thank you!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘problem configuring redis’ is closed to new replies.