I was wondering whether it is possible to have a single Redis server instance having multiple active persistence policies.
What I'm trying to achieve is to have AOF on a set of keys and absolutely nothing on all other keys.
Is this doable? Or is having 2 Redis server instances listening on different sockets the only way?
Is this doable?
Nope.
Or is having 2 redis-server instances listening on different sockets the only way?
Yep.
Related
I'm adding Redis support to an open-source project written in Go. The goal is to support all Redis topologies: server, cluster, sentinel.
I browsed Go clients listed in redis.io/clients, and it seems that github.com/go-redis/redis project is a viable option.
My main concern is the NewSentinelClient() method accepts a single sentinel address.
According to the Guidelines for Redis clients (redis.io/topics/sentinel-clients#guidelines-for-redis-clients-with-support-for-redis-sentinel), "the client should iterate the list of Sentinel addresses. "
How can SentinelClient iterate through the rest of sentinel instances, if it only has one sentinel address?
Do I miss something?
On the same topic, could someone recommend another Go Redis client that might be suitable for this scenario?
Use NewFailoverClient if you have multiple sentinels.
rdb := redis.NewFailoverClient(&redis.FailoverOptions{
MasterName: "mymaster",
SentinelAddrs: []string{
"sentinel_1:26379",
"sentinel_2:26379",
"sentinel_3:26379",
},
})
I have a Redis database (no cluster, no replica).
How can i configure it to be read only? (so client can not modify it)
I do not want to set up a replication or cluster.
Thanks in advance
There is no such configuration for Redis master. Only replicas can be configured as read-only. If you have control over the Redis client library used by your clients, you can change it to expose only read methods to the clients.
Is it possible to build one master (port 6378) + two slave (read only port: 6379, 6380) "cluster" on one machine and increase the performances (especially reading) and do not use any proxy? Can the site or code connect to master instance and read data from read-only nodes? Or if I use 3 instances of Redis I have to use proxy anyway?
Edit: Seems like slave nodes don't have any data, they try to redirect to master instance, but it is not correct way, am I right?
Definitely. You can code the paths in your app so writes and reads go to different servers. Depending on the programming language that you're using and the Redis client, this may be easier or harder to achieve.
Edit: that said, I'm unsure how you're running a cluster with a single master - the minimum should be 3.
You need to send a READONLY command after connecting to the slave before you could execute any read commands.
A READONLY command only affects during the current socket session which means you need this command for every TCP connection.
I'm using Redis as a caching system on the client windows endpoint. I want to use two simultaneous caching streams where one is lru enabled and the other is disabled.
How do I run two different configs on the same instance?
Ended up using two instances with aof
OK so talked to people at Redis. It's not possible as all the configuration is global for the instance.
So the only solution is to have two different instances
I set up twemproxy (nutcracker) with 2 redis servers as backends including slaves, sentinel and failover.
As soon as I add another redis server some of the keys are not able to be read, probably due to twemproxy redirecting to another redis.
How do I add another redis instance without breaking the consistency?
I want to use the setup as a consistent and very fast database.
Here are my settings:
redis_cluster:
auto_eject_hosts: false
distribution: ketama
hash: fnv1a_32
listen: 127.0.0.1:6379
preconnect: true
redis: true
servers:
- 127.0.0.1:7004:1 redis_1
- 127.0.0.1:7005:1 redis_2
I want to keep sharding a job of the server and be able to add instances. Do I need to use another setup?
Twemproxy can't do that. You can use Redis Cluster, or if you want to use Twemproxy you have to use a technique called presharding. Which is, start directly with, like, 32 or 64 instances or alike, even if them all run in the same host to start. Then start moving instances from one box to another in order to scale to multiple actual servers. The word to the right of the instances configured inside Twemproxy "redis_1" are used in order to hash, so that you can change IP address when you move instances, and still the hashing will be the same for that server.
Redis Cluster is release candidate 2 at this point. While it needs more testing and deployments to be battle tested as Redis is, it is already a viable product, so you may want to test it as well.