I'm using the StackExchange.Redis client and a static IConnectionMultiplexer as recommended to connect to the primary endpoint of an AWS ElastiCache server (2 nodes with failover).
ConnectionMultiplexer.Connect("someredis.clustercfg.use1.cache.amazonaws.com:6379");
When we failover (using the test "Failover Primary" option), writes via the connection permanently fail until we re-create the connection.
Is that expected?Is there a configuration option we're missing?
Related
Disclaimer, I'm new to redis and elasticache.
Referencing an answer in this stackoverflow here.
I have a basic AWS ElastiCache Redis cluster setup:
3 shards, 9 nodes
encryption at rest
However, when I try to connect to the Configuration endpoint I get READONLY You can't write against a read-only replica'.
If I change my connection string to a node endpoint, I connect successfully.
What am I missing here? Why isn't the configuration endpoint navigating me to a non READONLY node?
make sure you are copying the primary end point, replica is only read, Since Redis 2.6, replicas support a read-only mode that is enabled by default. This behavior is controlled by the replica-read-only option in the redis.conf file, and can be enabled and disabled at runtime using CONFIG SET.
Part of the installation of Liveswitch (a WebRTC application) is to connect the gateway and media server to a Redis cache (see the docs). We want to implement a high-availability architecture, in which two (load balanced) gateway servers and two media servers connect to Redis instances in an autofailover configuration.
I know that normally Redis Sentinel is the tool of choice for such an undertaking, but from my understanding for this to be working with the aforementioned gateway/media servers , the servers (which are the clients to Redis in this case) have to be able to communicate with Sentinel additional to their connection to the (Redis) cache to "find" the new master in the case of failover. I do not find any hint in Liveswitche's configuration that would allow for that.
The connection of Liveswitch to the Redis instance is configured in a json file using a connection string like the following (from the product documentation):
"ConnectionStrings": {
"Default": "postgresql://user:password#10.37.129.2:25061/postgres_server?sslmode=require&Server_Compatibility_Mode=Redshift",
"Cache": "redis://lxjis.redis.cache.windows.net:6380,password=2KfYkEQOCYH8sdfdsfdsfdsEdMV18nSvtE4FrMqnncAFZNsRc=,ssl=True,abortConnect=False",
}
Is there a way to install Redis instances with autofailover in a transparent way, i.e., so that the client application's connection to the cache is retained in the case of failover without relying on Sentinel to "report" the new master to the application?
I'm currently using connect-redis in my Sails.js project to leverage a locally-installed redis instance. In the future, I'd like to use a common redis instance for multiple server instances (behind a load balancer), so I've been looking at AWS Elasticache. I'm having trouble with the configuration, though.
sails-project\config\session.js:
adapter: 'connect-redis',
host: 'primary-endpoint.xxxxxx.ng.0001.apse1.cache.amazonaws.com',
port: 6379,
ttl: <redis session TTL in seconds>,
db: 0,
pass: <redis auth password>,
prefix: 'sess:',
What should the TTL value be? Should the pass attribute point to IAM somehow?
I tried creating a user in IAM with AmazonElastiCacheFullAccess permissions and putting its access key ID in the pass attribute, but I got this error in my server console (testing on my Windows box):
C:\repos\sails-project\node_modules\connect-redis\lib\connect-redis.js:83
throw err;
^
AbortError: Redis connection lost and command aborted. It might have been processed.
at RedisClient.flush_and_error (C:\repos\sails-project\node_modules\redis\index.js:362:23)
...
Any ideas on what to change?
I'm going to assume your "windows box" is outside of AWS.
For Elasticache you can't access it from outside AWS. See the Security Section here : https://aws.amazon.com/elasticache/faqs/#Can_I_access_Amazon_ElastiCache_from_outside_AWS
The most common use case is to have EC2 instances within a VPC access and consume the Elasticache service. Along with this the Elasticache Redis service doesn't employ authentication and only allows lock down via security groups.
If you need something that differentiates from this configuration then you should look at putting Redis on EC2 so that you have full control.
I am using redis(Redis 3.1) as session store for tomcat(Tomcat 7). To ensure high availability, there is a sentinel setup and two instances(master and slave) of redis server. The slave is configured as read-only. After running few tests and verifying the statistics, it's observerd there are no read requests sent to the slave. All the read requests are processed by the master alone.
Could you please let me know how I can make the slave serve the read requests?
You could use Redis based Tomcat Session Manager provided by Redisson. It allows to manage which type of node use for read operation (master, slave or both master and slave). Perfectly works in Sentinel/Cluster modes.
currently I have a redis instance, now I would make it more failure prove.
Is it possible to archive the following things?
I connect to redis with the service stack library, now I want that when the server is not available redis switch to the failover server automatically.
You should configure a Redis instance as a slave of your master instance, either using the slaveof command or more likely by adding a slaveof directive in the configuration file (something like 'slaveof 127.0.0.1 6380' ; look at the documentation for more info); then use Redis Sentinel to monitor the instances and promote the Slave as Master when the master fails.
Moreover you either have to use a Redis client that supports sentinel and handles the redirection when the slave is promoted to slave, or use a network configuration (like virtual IP) to make the redirection transparent for your application.