Akka.Persistence.Redis
1.5.29
Prefix Reserved
See the version list below for details.
dotnet add package Akka.Persistence.Redis --version 1.5.29
NuGet\Install-Package Akka.Persistence.Redis -Version 1.5.29
<PackageReference Include="Akka.Persistence.Redis" Version="1.5.29" />
paket add Akka.Persistence.Redis --version 1.5.29
#r "nuget: Akka.Persistence.Redis, 1.5.29"
// Install Akka.Persistence.Redis as a Cake Addin #addin nuget:?package=Akka.Persistence.Redis&version=1.5.29 // Install Akka.Persistence.Redis as a Cake Tool #tool nuget:?package=Akka.Persistence.Redis&version=1.5.29
Akka.Persistence.Redis
Akka Persistence Redis Plugin is a plugin for Akka persistence
that provides several components:
- a journal store and
- a snapshot store.
NOTE: in Akka.Persistence.Redis v1.4.16 we removed Akka.Persistence.Query support. Please read more about that decision and comment here: https://github.com/akkadotnet/Akka.Persistence.Redis/issues/126
This plugin stores data in a redis database and based on Stackexchange.Redis library.
Installation
From Nuget Package Manager
Install-Package Akka.Persistence.Redis
From .NET CLI
dotnet add package Akka.Persistence.Redis
Journal
To activate the journal plugin, add the following line to your HOCON config:
akka.persistence.journal.plugin = "akka.persistence.journal.redis"
This will run the journal with its default settings. The default settings can be changed with the configuration properties defined in your HOCON config:
akka.persistence.journal.redis {
# qualified type name of the Redis persistence journal actor
class = "Akka.Persistence.Redis.Journal.RedisJournal, Akka.Persistence.Redis"
# connection string, as described here: https://stackexchange.github.io/StackExchange.Redis/Configuration#basic-configuration-strings
configuration-string = ""
# Redis journals key prefixes. Leave it for default or change it to appropriate value. WARNING: don't change it on production instances.
key-prefix = ""
}
Configuration
configuration-string
- connection string, as described here: https://stackexchange.github.io/StackExchange.Redis/Configuration#basic-configuration-stringskey-prefix
- Redis journals key prefixes. Leave it for default or change it to customized value. WARNING: don't change this value after you've started persisting data in production.database
- Set the Redis default database to use. If you addeddefaultDatabase
to theconnection-strings
, you have to setdatabase
to the value ofdefaultDatabase
.use-database-number-from-connection-string
- determines redis database precedence when a user adds defaultDatabase to the connection-strings. For Redis Cluster, thedefaultDatabase
is 0! See below:
NOTE: Redis Standalone supports deploying multiple instances, but Redis cluster does not. The default database with Redis Cluster is always 0 - If you are deploying Redis Cluster, you don't need to add the defaultDatabase
to the connection-string
'! cluster-spec
Snapshot Store
To activate the snapshot plugin, add the following line to your HOCON config:
akka.persistence.snapshot-store.plugin = "akka.persistence.snapshot-store.redis"
This will run the snapshot-store with its default settings. The default settings can be changed with the configuration properties defined in your HOCON config:
akka.persistence.snapshot-store.redis {
# qualified type name of the Redis persistence journal actor
class = "Akka.Persistence.Redis.Snapshot.RedisSnapshotStore, Akka.Persistence.Redis"
# connection string, as described here: https://stackexchange.github.io/StackExchange.Redis/Configuration#basic-configuration-strings
configuration-string = ""
# Redis journals key prefixes. Leave it for default or change it to appropriate value. WARNING: don't change it on production instances.
key-prefix = ""
}
Configuration
configuration-string
- connection string, as described here: https://stackexchange.github.io/StackExchange.Redis/Configuration#basic-configuration-stringskey-prefix
- Redis journals key prefixes. Leave it for default or change it to appropriate value. WARNING: don't change it on production instances.
Security and Access Control
You can secure the Redis server Akka.Persistence.Redis connects to by leveraging Redis ACL and requiring users to use AUTH to connect to the Redis server.
- Redis ACL You can use Redis ACL to:
- Create users
- Set user passwords
- Limit the set of Redis commands a user can use
- Allow/disallow pub/sub channels
- Allow/disallow certain keys
- etc.
Redis SSL/TLS You can use redis-cli to enable SSL/TLS feature in Redis.
StackExchange.Redis Connection string To connect to ACL enabled Redis server, you will need to set the user and password option in the connection string: "myServer.net:6380,user=<username>,password=<password>"
All of these features are supported via StackExchange.Redis
, which Akka.Persistence.Redis uses internally, and you only need to customize your akka.persistence.journal.redis.configuration-string
and akka.persistence.snapshot-store.redis.configuration-string
values to customize it.
Enabling TLS
For instance, if you want to enable TLS on your Akka.Persistence.Redis instance:
akka.persistence.journal.redis.configuration-string = "contoso5.redis.cache.windows.net,ssl=true,password=..."
Or if you need to connect to multiple redis instances in a cluster:
akka.persistence.journal.redis.configuration-string = "contoso5.redis.cache.windows.net, contoso4.redis.cache.windows.net,ssl=true,password=..."
Enabling ACL
To connect to your redis instance with access control (ACL) support for Akka.Persistence.Redis, all you need to do is specify the user name and password in your connection string and this will restrict the StackExchange.Redis
client used internally by Akka.Persistence.Redis to whatever permissions you specified in your cluster:
akka.persistence.journal.redis.configuration-string = "contoso5.redis.cache.windows.net, contoso4.redis.cache.windows.net,user=akka-persistence,password=..."
Minimum command set
These are the minimum Redis commands that are needed by Akka.Persistence.Redis to work properly.
Redis Command | StackExchange.Redis Command |
---|---|
MULTI | Transaction |
EXEC | |
DISCARD | |
SET | String Set |
SETNX | |
SETEX | |
GET | String Get |
LLEN | List Length |
LRANGE | List Range |
RPUSH | List Right Push |
RPUSHX | |
LLEN | |
ZADD | Sorted Set Add |
ZREMRANGEBYSCORE | Delete Sorted Set by Score Range |
ZREVRANGEBYSCORE | Get Sorted Set by Score Range |
ZRANGEBYSCORE | |
WITHSCORES | |
LIMIT | |
SSCAN | Scan |
SMEMBERS | |
PUBSUB | Pub/Sub |
PING | |
UNSUBSCRIBE | |
SUBSCRIBE | |
PSUBSCRIBE | |
PUNSUBSCRIBE | |
PUBLISH | Pub/Sub Publish |
Serialization
Akka Persistence provided serializers wrap the user payload in an envelope containing all persistence-relevant information. Redis Journal uses provided Protobuf serializers for the wrapper types (e.g. IPersistentRepresentation
), then the payload will be serialized using the user configured serializer.
The payload will be serialized using Akka.NET's serialization bindings for your events and snapshot objects. By default, all object
s that do not have a specified serializer will use Newtonsoft.Json polymorphic serialization (your CLR types ←-> JSON.)
This is fine for testing and initial phases of your development (while you’re still figuring out things and the data will not need to stay persisted forever). However, once you move to production you should really pick a different serializer for your payloads.
We highly recommend creating schema-based serialization definitions using MsgPack, Google.Protobuf, or something similar and configuring serialization bindings for those in your configuration: https://getakka.net/articles/networking/serialization.html#usage
Serialization of snapshots and payloads of Persistent messages is configurable with Akka’s Serialization infrastructure. For example, if an application wants to serialize
- payloads of type
MyPayload
with a customMyPayloadSerializer
and - snapshots of type
MySnapshot
with a customMySnapshotSerializer
it must add
akka.actor {
serializers {
redis = "Akka.Serialization.YourOwnSerializer, YourOwnSerializer"
}
serialization-bindings {
"Akka.Persistence.Redis.Journal.JournalEntry, Akka.Persistence.Redis" = redis
"Akka.Persistence.Redis.Snapshot.SnapshotEntry, Akka.Persistence.Redis" = redis
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Akka (>= 1.5.29)
- Akka.Persistence (>= 1.5.29)
- Akka.Persistence.Query (>= 1.5.29)
- Akka.Streams (>= 1.5.29)
- StackExchange.Redis (>= 2.8.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Akka.Persistence.Redis:
Package | Downloads |
---|---|
Akka.Persistence.Redis.Hosting
Akka.NET Persistence journal and snapshot store backed by Redis. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.5.30 | 698 | 10/4/2024 |
1.5.29 | 410 | 10/2/2024 |
1.5.24 | 5,698 | 6/11/2024 |
1.5.13 | 10,496 | 10/6/2023 |
1.5.0 | 13,130 | 3/7/2023 |
1.4.35 | 11,074 | 3/24/2022 |
1.4.31 | 3,959 | 12/21/2021 |
1.4.25 | 16,749 | 9/9/2021 |
1.4.20 | 7,035 | 5/14/2021 |
1.4.17 | 3,354 | 3/17/2021 |
1.4.16 | 5,485 | 2/6/2021 |
1.4.4 | 28,355 | 4/15/2020 |
1.0.0 | 23,463 | 9/27/2017 |
1.0.0-beta1 | 957 | 9/11/2017 |
0.2.6-beta | 1,190 | 10/22/2016 |
0.2.5-beta | 892 | 10/16/2016 |
0.2.0-beta | 882 | 8/12/2016 |
0.1.0-beta | 1,214 | 7/21/2016 |
Upgraded to [Akka.NET 1.5.29](https://github.com/akkadotnet/akka.net/releases/tag/1.5.29)
Upgraded to [Akka.Hosting 1.5.29](https://github.com/akkadotnet/Akka.Hosting/releases/tag/1.5.29)
[Bump StackExchange.Redis to 2.8.0](https://github.com/akkadotnet/Akka.Persistence.Redis/pull/345)