ServiceStack.Redis | .NET 's leading C # Redis Client | Performance Testing library
kandi X-RAY | ServiceStack.Redis Summary
kandi X-RAY | ServiceStack.Redis Summary
Follow @ServiceStack, view the docs, use StackOverflow or Customer Forums for support.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of ServiceStack.Redis
ServiceStack.Redis Key Features
ServiceStack.Redis Examples and Code Snippets
Community Discussions
Trending Discussions on ServiceStack.Redis
QUESTION
I am using the RedisMessageQueueClient
as can be seen here:
ANSWER
Answered 2021-Aug-28 at 08:37This is still the case where failed Error Responses are sent to the ReplyMq:
QUESTION
Context:
I'm trying to understand the motivation behind existence of WaitBeforeForcingMasterFailover
property (and the code associated with it) inside of ServiceStack.Redis.RedisSentinel
.
If I interpreted the code right - the meaning behind this property seems to cover cases like:
- We have a connection to a healthy sentinel that tells us that a master is at host X
- When we try to establish a connection to the master at host X - we fail due to some reason.
So the logic will be - if we continuously fail to create a connection to X for WaitBeforeForcingMasterFailover
period - initiate a force failover.
The failover does not need to reach a quorum and can elect a new master just with 1 sentinel available.
SENTINEL FAILOVER Force a failover as if the master was not reachable, and without asking for agreement to other Sentinels (however a new version of the configuration will be published so that the other Sentinels will update their configurations).
Source: https://redis.io/topics/sentinel#sentinel-api
The way it seems to me - this feature can be beneficial in some cases and troublesome in other cases.
For example in case of a network partition if a client is left connected to a minority of sentinels (they can't reach a quorum) and these sentinels point to a master that is no longer reachable - this force failover option will trigger a failover within reachable partition, thus potentially creating a split brain situation.
Coming from Java background I also haven't seen such features available in popular redis clients such as Jedis and Lettuce.
This got me wondering on the following questions:
Are there strong reasons for this feature to be enabled by default? (I understand that you can effectively disable it if you want to by setting a huge value in it). Do they really worth the risk of interfering with natural sentinels workflow and potentially introducing problems like the one I've mentioned before?
Will the library work fine with this option disabled? Are there are cases that I might have missed and turning this feature off will lead to problems even with some happy paths (no network partition, just regular failovers because of a deployment or a sudden node failure)?
ANSWER
Answered 2021-Apr-30 at 04:41It's a fallback that if RedisSentinel
is unable to establish a connection to a master client within 60s (default) it will instruct the connected sentinel to force a failover.
You can increase the wait time when configuring RedisSentinel
:
QUESTION
Description:
I'm curious what is the relationship between RedisSentinelWorker and RedisPubSubServer.
From what I've observed the library holds at most 1 active sentinel connection even if there are more sentinel hosts available. That sentinel connection is wrapped in RedisSentinelWorker, which wraps RedisPubSubServer under the hood.
What bothers me is that RedisSentinelWorker and RedisPubSubServer might actually represent connections to two different sentinels.
Here is why this is happening:
...ANSWER
Answered 2021-Apr-20 at 16:31RedisPubSubServer
provides a managed Pub/Sub Server for processing Redis Pub/Sub messages.
RedisSentinelWorker
uses RedisPubSubServer
to listen for sentinel messages, it was looking at connecting to any of the available active Sentinel Hosts for Sentinel message events but I can see how it would be more intuitive to only look at the sentinel host the worker is currently configured with so I've changed the behavior in this commit which will be available in the next v5.11 release.
QUESTION
The problem:
It is not obvious how to correctly authenticate with:
- sentinels
- redis instances themselves
when using the ServiceStack.Redis solution.
According to the docs a proper way to provide a password for redis/sentinel is to set it via URLs in the following manner:
...ANSWER
Answered 2021-Apr-20 at 15:12You can use a RedisSentinel HostFilter to customize the connection string for the individual hosts the sentinel connects to, e.g:
QUESTION
I'm using ServiceStack.Redis v5.10.4 and trying to set the TTL using the following code:
Note: mClientsManager = IRedisClientsManager ttl = TimeSpan?
...ANSWER
Answered 2021-Mar-03 at 18:11I've just fixed this typed API in this commit. This change is available from the latest v5.10.5 that's now available on MyGet.
Alternatively you can explicitly change the TTL for a key using this async API:
QUESTION
I'm attempting to use ServiceStack.Redis to connect to a cloud based Redis instance using SSL Certificates. The ServiceStack documentation provides information on how to connect to an Azure based Redis using SSL, but has no information or examples on how to connect to a non Azure Redis instance.
I've got a pem, crt, and key file but nothing I do with them seems to actually pass them across to the service. I've set ssl=true&sslprotocols=tls12 in the connectionstring which seems like the first step, but beyond that I'm not sure what I should be doing to correctly pass across the certificate for verification
EDIT: Current Code
...ANSWER
Answered 2021-Jan-15 at 01:20ServiceStack.Redis uses .NET's SslStream to establish its SSL connection where you can configure its RemoteCertificateValidationCallback to validate whether to accept the specified certificate for authentication:
QUESTION
I'm using ServiceStack.Redis
in my application, I have a get method that goes to redis (cache) to get some information, but if redis is disconnected, I call the repository to get from the real database
ANSWER
Answered 2021-Jan-13 at 13:51You can adjust the AutoRetry Timeout with:
QUESTION
I created a Visual Studio (Community 2019) project with C# using ServiceStack.Redis
. Since it is C#, I use Windows 10 (there is a Redis version for Windows but it is really old and as I know, it is unofficial so I am afraid that might be the problem).
Here is an excerpt from my code:
ANSWER
Answered 2020-Jul-07 at 06:58I assume that your are using .NET Framework. This error is known for ServiceStack.Redis
and is tracked on GitHub. It occurs because you use libraries that depend on different versions of System.Runtime.CompilerServices.Unsafe
. These transitive dependencies need to be resolved and consolidated to end up with one assembly in your output folder. You will end up with the latest of these versions. Consequently, if one of the libraries depends on a specific version that is older, it will not be found.
The bug that causes this issue is fixed in System.Runtime.CompilerServices.Unsafe
4.6.0
. Use binding redirects, to load the specific version of the assembly that you need. Insert this snippet into all of your app.config
files.
QUESTION
Let's say I'm building a cards game (I'm using an analogy as I can't disclose the original project details). Consider the following structure:
...ANSWER
Answered 2020-Jul-16 at 10:50Create a redis set for each card dealer.
For example,
"dealer_1_set" : ["91,"A1"]
"dealer_2_set" : ["A2,"A3"]
"dealer_3_set" : ["B9,"B10","36"]
For each card rejected by John, maintainn a redis set for him.
"cards_rejected_by_john_set" : ["91","A3","36"]
Now to calculate the available cards from dealer 1 and dealer 2 for John
use redis command
SINTER dealer_1_set dealer_2_set ... (add more dealer sets if you want)
You get new set, say temp_set ["91","A1","A2,"A3"]
Then use redis command
SDIFF temp_set cards_rejected_by_john_set
Then you get ["A1", "A2"] , which is the result.
The above operations should be pretty fast. But to make the above actions atomic, you'll need to write a Lua script.
QUESTION
I am testing out the Redis "full duplex" communication as shown here, and reading the docs, I thought that the PooledRedisClientManager
as well as RedisManagerPool
have a pool of clients, and thus being able to process several MQ messages in parallel.
However, in the test project, found here on Github, it seems to me that this is not the case, or I am missing something. The solution consists of:
- EventPublisher: .NET Core WinForms application for publishing Hello DTOs to the MQ
- EventConsumer: .NET Core WinFOrms application that has Service impl for handling Hello DTOs
I added a Thread.Sleep inside the HelloService Any(Hello req)
and when I from the EventPublisher send several Hello DTOs quickly, I was expecting them to be handled concurrently in the EventConsumer, as I thought the pool of clients would be used. This, however, doesn't seem to be the case.
The HelloResponse
s are handled one after the other, on the same thread it seems. Please take a look at this short video:
Here, I fire off three Hello DTOs to the MQ in quick succession, and in the Output window in VS, you can see that the three DTOs are handled one after each other.
I did not find a setting in PooledRedisClientManager
nor RedisManagerPool
where I could specify the pool size.
ANSWER
Answered 2020-May-03 at 23:33I thought that the PooledRedisClientManager as well as RedisManagerPool have a pool of clients
This statement is true.
and thus being able to process several MQ messages in parallel.
This is an invalid conclusion that's meaningless without context. The Pooled Redis Client Managers do not do any execution themselves, i.e. they only manage a pool of redis clients meaning when a client is retrieved from the pool:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ServiceStack.Redis
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page