I recently ran into this and @jsierles helped me with an answer. Maybe this will help others too.
There is actually not a lot of configuration to do to configure geo distributed Redis in a Rails app:
- Setup Redis cache in your Rails app as usually.
fly redis update and make sure you enable the read regions you need.
You don’t have to set anything to writable. You will always be using the nearest Redis available automatically. These instances are not writeable, but they will accept writes and forward them to the primary.
Thanks for the post! What do you think would need to change with the CLI or the docs to make this obvious?
Honestly, I think this is a very good and clear document. Not reading it properly is 100% on me.
I was thrown off by two things:
In the blog post Last Mile Redis · Fly it says “[…] Which gets us to the an interesting config option:
replica-read-only . This setting defaults to
yes , and does what you’d expect. But check this out:” and so on … which kinda let me to believe that I have to turn off
replica-read-only myself because the default is
For geo distributed Postgres different edges receive different values for
DATABASE_URL – and I somehow assumed that the behaviour for Redis would be similar.
I’m not sure how or even if you can improve the documentation or those blog posts. Maybe in the section “traffic routing” in the Redis document, you could add a “This means, other than with Postgres, your Redis URL will always be the same on all edges and your app will still magically talk to the correct Redis.” if you wanted to make it fool proof for people like me.