Skip to content

Commit 39787b4

Browse files
committed
Merge branch 'main' into preview-rc-rdi
2 parents 668028a + c548123 commit 39787b4

File tree

552 files changed

+47844
-1542
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

552 files changed

+47844
-1542
lines changed

assets/css/index.css

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,4 +1073,25 @@ a[href*="#no-click"], img[src*="#no-click"] {
10731073

10741074
.dd-item .highlight:hover {
10751075
color: #5961ff;
1076+
}
1077+
1078+
.copy-button {
1079+
background-color: #eee;
1080+
border: none;
1081+
padding: 4px;
1082+
cursor: pointer;
1083+
border-radius: 4px;
1084+
display: flex;
1085+
align-items: center;
1086+
justify-content: center;
1087+
}
1088+
1089+
.copy-button svg {
1090+
width: 16px;
1091+
height: 16px;
1092+
fill: #333;
1093+
}
1094+
1095+
.copy-button:hover {
1096+
background-color: #ddd;
10761097
}

config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ rdi_redis_gears_version = "1.2.6"
5555
rdi_debezium_server_version = "2.3.0.Final"
5656
rdi_db_types = "cassandra|mysql|oracle|postgresql|sqlserver"
5757
rdi_cli_latest = "latest"
58-
rdi_current_version = "v1.6.7"
58+
rdi_current_version = "1.8.0"
5959

6060
[params.clientsConfig]
6161
"Python"={quickstartSlug="redis-py"}

content/develop/_index.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,44 @@
22
title: Develop with Redis
33
description: Learn how to develop with Redis
44
linkTitle: Develop
5+
hideListLinks: true
6+
hideTOC: true
57
---
8+
9+
Get a Redis server running in minutes with a free trial of
10+
[Redis Cloud]({{< relref "/operate/rc" >}}), or install
11+
[Redis Open Source]({{< relref "/operate/oss_and_stack" >}}) locally
12+
on your machine. Then, explore Redis with your favorite
13+
[programming language]({{< relref "/develop/clients" >}})
14+
or analyze and manage your database with our
15+
[UI tools]({{< relref "/develop/tools" >}}):
16+
17+
| | Get started | Document search | Vector search |
18+
|:----- | :-----: | :-----: | :-----:|
19+
| [Python]({{< relref "/develop/clients/redis-py" >}}) | [See Python examples]({{< relref "/develop/clients/redis-py/connect" >}}) | [See Python examples]({{< relref "/develop/clients/redis-py/queryjson" >}}) | [See Python examples]({{< relref "/develop/clients/redis-py/vecsearch" >}}) |
20+
| [C#/.NET]({{< relref "/develop/clients/dotnet" >}}) | [See C# examples]({{< relref "/develop/clients/dotnet/connect" >}}) | [See C# examples]({{< relref "/develop/clients/dotnet/queryjson" >}}) | [See C# examples]({{< relref "/develop/clients/dotnet/vecsearch" >}}) |
21+
| [Node.js]({{< relref "/develop/clients/nodejs" >}}) | [See JS examples]({{< relref "/develop/clients/nodejs/connect" >}}) | [See JS examples]({{< relref "/develop/clients/nodejs/queryjson" >}}) | [See JS examples]({{< relref "/develop/clients/nodejs/vecsearch" >}}) |
22+
| [Java]({{< relref "/develop/clients/jedis" >}}) | [See Java examples]({{< relref "/develop/clients/jedis/connect" >}}) | [See Java examples]({{< relref "/develop/clients/jedis/queryjson" >}}) | [See Java examples]({{< relref "/develop/clients/jedis/vecsearch" >}}) |
23+
| [Go]({{< relref "/develop/clients/go" >}}) | [See Go examples]({{< relref "/develop/clients/go/connect" >}}) | [See Go examples]({{< relref "/develop/clients/go/queryjson" >}}) | [See Go examples]({{< relref "/develop/clients/go/vecsearch" >}}) |
24+
| [PHP]({{< relref "/develop/clients/php" >}}) | [See PHP examples]({{< relref "/develop/clients/php/connect" >}}) | [See PHP examples]({{< relref "/develop/clients/php/queryjson" >}}) | [See PHP examples]({{< relref "/develop/clients/php/vecsearch" >}}) |
25+
26+
<div class="flex flex-col gap-5">
27+
<div class="flex items-start">
28+
{{< image filename="develop/tools/insight/images/Browser.png" class="w-[300px] mr-4" >}}
29+
<div>
30+
<h3><a href='{{< relref "/develop/tools/insight">}}'>Redis Insight</a></h3>
31+
<p>Visual client tool for creating, managing, and analyzing Redis databases.</p>
32+
</div>
33+
</div>
34+
<div class="flex items-start">
35+
{{< image filename="images/dev/connect/vscode/vscode-cli.png" class="w-[300px] mr-4" >}}
36+
<div>
37+
<h3><a href='{{< relref "/develop/tools/redis-for-vscode" >}}'>Redis for VS Code</a></h3>
38+
<p>Visual client tool for creating, managing, and analyzing Redis databases.</p>
39+
</div>
40+
</div>
41+
</div>
42+
43+
| {{< image filename="images/icon_logo/icon-developers-32-midnight.png" >}} </br>[**Quick start**]({{< relref "/develop/get-started" >}}) | {{< image filename="images/icon_logo/icon-data-structures-32-midnight.png" >}} </br>[**Data types**]({{< relref "/develop/data-types" >}}) | {{< image filename="images/icon_logo/icon-text-search-32-midnight.png" >}} </br>[**Query engine**]({{< relref "/develop/interact/search-and-query" >}}) |
44+
|---|---|---|
45+
| [Vector database]({{< relref "/develop/get-started/vector-database" >}})</br>[Document store]({{< relref "/develop/get-started/document-database" >}})</br>[Data structure store]({{< relref "/develop/get-started/data-store" >}})</br>[RAG with Redis]({{< relref "/develop/get-started/rag" >}})</br>[GenAI]({{< relref "/develop/get-started/redis-in-ai" >}}) | [String]({{< relref "/develop/data-types/strings" >}})</br>[JSON]({{< relref "/develop/data-types/json" >}})</br>[Hash]({{< relref "/develop/data-types/hashes" >}})</br>[Vector set]({{< relref "/develop/data-types/vector-sets" >}})</br>[Probabilistic types]({{< relref "/develop/data-types/probabilistic" >}}) | [Get started]({{< relref "/develop/interact/search-and-query" >}})</br>[Schema field types]({{< relref "/develop/interact/search-and-query/basic-constructs/field-and-type-options" >}})</br>[Indexing]({{< relref "/develop/interact/search-and-query/indexing" >}})</br>[Querying]({{< relref "/develop/interact/search-and-query/query" >}})</br>[Use cases]({{< relref "/develop/interact/search-and-query/query-use-cases" >}})
File renamed without changes.
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
categories:
3+
- docs
4+
- develop
5+
- stack
6+
- oss
7+
- rs
8+
- rc
9+
- oss
10+
- kubernetes
11+
- clients
12+
description: Get your `go-redis` app ready for production
13+
linkTitle: Production usage
14+
title: Production usage
15+
weight: 6
16+
---
17+
18+
This guide offers recommendations to get the best reliability and
19+
performance in your production environment.
20+
21+
## Checklist
22+
23+
Each item in the checklist below links to the section
24+
for a recommendation. Use the checklist icons to record your
25+
progress in implementing the recommendations.
26+
27+
{{< checklist "goprodlist" >}}
28+
{{< checklist-item "#health-checks" >}}Health checks{{< /checklist-item >}}
29+
{{< checklist-item "#error-handling" >}}Error handling{{< /checklist-item >}}
30+
{{< checklist-item "#monitor-performance-and-errors">}}Monitor performance and errors{{< /checklist-item >}}
31+
{{< /checklist >}}
32+
33+
## Recommendations
34+
35+
The sections below offer recommendations for your production environment. Some
36+
of them may not apply to your particular use case.
37+
38+
### Health checks
39+
40+
If your code doesn't access the Redis server continuously then it
41+
might be useful to make a "health check" periodically (perhaps once
42+
every few seconds). You can do this using a simple
43+
[`PING`]({{< relref "/commands/ping" >}}) command:
44+
45+
```go
46+
err := rdb.Ping(ctx).Err()
47+
48+
if err != nil {
49+
// Report failed health check.
50+
}
51+
```
52+
53+
Health checks help to detect problems as soon as possible without
54+
waiting for a user to report them.
55+
56+
### Error handling
57+
58+
The `Result()` method of a command returns both the command result
59+
and an error value. Although you are mainly interested in the result,
60+
you should also always check that the error value is `nil` before
61+
proceeding. Errors can be returned for failed connections, network
62+
problems, and invalid command parameters, among other things.
63+
64+
### Monitor performance and errors
65+
66+
`go-redis` supports [OpenTelemetry](https://opentelemetry.io/). This lets
67+
you trace command execution and monitor your server's performance.
68+
You can use this information to detect problems before they are reported
69+
by users. See [Observability]({{< relref "/develop/clients/go#observability" >}})
70+
for more information.
Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
---
2+
categories:
3+
- docs
4+
- develop
5+
- stack
6+
- oss
7+
- rs
8+
- rc
9+
- oss
10+
- kubernetes
11+
- clients
12+
description: Learn how to authenticate to an Azure Managed Redis (AMR) database
13+
linkTitle: Connect to AMR
14+
title: Connect to Azure Managed Redis
15+
weight: 2
16+
---
17+
18+
The [`redis-authx-entraid`](https://github.com/redis/jvm-redis-authx-entraid) package
19+
lets you authenticate your app to
20+
[Azure Managed Redis (AMR)](https://azure.microsoft.com/en-us/products/managed-redis)
21+
using [Microsoft Entra ID](https://learn.microsoft.com/en-us/entra/identity/).
22+
You can authenticate using a system-assigned or user-assigned
23+
[managed identity](https://learn.microsoft.com/en-us/entra/identity/managed-identities-azure-resources/overview)
24+
or a [service principal](https://learn.microsoft.com/en-us/entra/identity-platform/app-objects-and-service-principals),
25+
letting `redis-authx-entraid` fetch and renew the authentication tokens for you automatically.
26+
27+
See
28+
[Use Microsoft Entra for cache authentication](https://learn.microsoft.com/en-us/azure/azure-cache-for-redis/cache-azure-active-directory-for-authentication)
29+
in the Microsoft docs to learn how to configure Azure to use Entra ID authentication.
30+
31+
## Install
32+
33+
Install [`jedis`]({{< relref "/develop/clients/jedis" >}}) first,
34+
if you have not already done so.
35+
36+
If you are using Maven, add
37+
the following dependency to your `pom.xml` file:
38+
39+
```xml
40+
<dependency>
41+
<groupId>redis.clients.authentication</groupId>
42+
<artifactId>redis-authx-entraid</artifactId>
43+
<version>0.1.1-beta1</version>
44+
</dependency>
45+
```
46+
47+
If you are using Gradle, add the following dependency to your
48+
`build.gradle` file:
49+
50+
```bash
51+
implementation 'redis.clients.authentication:redis-authx-entraid:0.1.1-beta1'
52+
```
53+
54+
## Create a `TokenAuthConfig` instance
55+
56+
The `TokenAuthConfig` class contains the authentication details that you
57+
must supply when you connect to Redis. Chain the methods of the
58+
`EntraIDTokenAuthConfigBuilder` class together (starting with the `builder()`
59+
method) to include the details you need, as shown in the following example:
60+
61+
```java
62+
TokenAuthConfig authConfig = EntraIDTokenAuthConfigBuilder.builder()
63+
.secret("<secret>")
64+
.authority("<authority>")
65+
// Other options...
66+
.build();
67+
```
68+
69+
Some of the details you can supply are common to different use cases:
70+
71+
- `secret()`: A string containing the [authentication secret](https://learn.microsoft.com/en-us/purview/sit-defn-azure-ad-client-secret).
72+
- `authority()`: A string containing the [authority](https://learn.microsoft.com/en-us/entra/identity-platform/msal-client-application-configuration#authority)
73+
URL.
74+
- `scopes()`: A set of strings defining the [scopes](https://learn.microsoft.com/en-us/entra/identity-platform/scopes-oidc)
75+
you want to apply. Configure your client application to acquire a Microsoft Entra token for scope, `https://redis.azure.com/.default` or `acca5fbb-b7e4-4009-81f1-37e38fd66d78/.default` (as detailed at [Microsoft Entra ID for authentication](https://learn.microsoft.com/en-us/azure/azure-cache-for-redis/managed-redis/managed-redis-entra-for-authentication#microsoft-entra-client-workflow))
76+
with the
77+
[Microsoft Authentication Library (MSAL)](https://learn.microsoft.com/en-us/entra/identity-platform/msal-overview)
78+
79+
(See [Advanced configuration options](#advanced-configuration-options) below
80+
to learn more about the options for controlling token request retry and timeout
81+
behavior.)
82+
83+
You can also add configuration to authenticate with a [service principal](#serv-principal)
84+
or a [managed identity](#mgd-identity) as described in the sections below.
85+
86+
### Configuration for a service principal {#serv-principal}
87+
88+
Add `clientId()` to the `EntraIDTokenAuthConfigBuilder` chain to specify
89+
authentication via a service principal, passing the ID token string as
90+
a parameter. (See the
91+
[Microsoft EntraID docs](https://learn.microsoft.com/en-us/entra/identity-platform/app-objects-and-service-principals)
92+
for more information about service principals.)
93+
94+
```java
95+
TokenAuthConfig authConfig = EntraIDTokenAuthConfigBuilder.builder()
96+
.clientId("<CLIENT-ID>")
97+
// ...
98+
.build();
99+
```
100+
101+
### Configuration for a managed identity {#mgd-identity}
102+
103+
You can also authenticate to AMR using a managed identity (see the
104+
[Microsoft documentation](https://learn.microsoft.com/en-us/entra/identity/managed-identities-azure-resources/overview) to learn more about managed identities).
105+
106+
For a system assigned managed identity, simply add the `systemAssignedManagedIdentity()`
107+
method to the `EntraIDTokenAuthConfigBuilder` chain:
108+
109+
```java
110+
TokenAuthConfig authConfig = EntraIDTokenAuthConfigBuilder.builder()
111+
.systemAssignedManagedIdentity()
112+
// ...
113+
.build();
114+
```
115+
116+
For a user assigned managed identity, add `userAssignedManagedIdentity()`. This
117+
requires a member of the `UserManagedIdentityType` enum (to select a
118+
`CLIENT_ID`, `OBJECT_ID`, or `RESOURCE_ID`) as well as the `id` string itself:
119+
120+
```java
121+
TokenAuthConfig authConfig = EntraIDTokenAuthConfigBuilder.builder()
122+
.userAssignedManagedIdentity(
123+
UserManagedIdentityType.CLIENT_ID,
124+
"<ID>"
125+
)
126+
// ...
127+
.build();
128+
129+
```
130+
131+
## Connect using `DefaultJedisClientConfig`
132+
133+
When you have created your `TokenAuthConfig` instance, you are ready to
134+
connect to AMR.
135+
The example below shows how to include the `TokenAuthConfig` details in a
136+
`JedisClientConfig` instance and use it with the `UnifiedJedis` connection.
137+
The connection uses
138+
[Transport Layer Security (TLS)](https://en.wikipedia.org/wiki/Transport_Layer_Security),
139+
which is recommended and enabled by default for managed identities. See
140+
[Connect to your production Redis with TLS]({{< relref "/develop/clients/jedis/connect#connect-to-your-production-redis-with-tls" >}}) for more information about
141+
TLS connections, including the implementation of the `createSslSocketFactory()`
142+
method used in the example.
143+
144+
```java
145+
TokenAuthConfig authConfig = EntraIDTokenAuthConfigBuilder.builder()
146+
// Chain of options...
147+
.build();
148+
149+
SSLSocketFactory sslFactory = createSslSocketFactory(
150+
"./truststore.jks",
151+
"secret!", // Use the password you specified for `keytool`
152+
"./redis-user-keystore.p12",
153+
"secret!" // Use the password you specified for `openssl`
154+
);
155+
156+
JedisClientConfig config = DefaultJedisClientConfig.builder()
157+
// Include the `TokenAuthConfig` details.
158+
.authXManager(new AuthXManager(authConfig))
159+
.ssl(true).sslSocketFactory(sslFactory)
160+
.build();
161+
162+
UnifiedJedis jedis = new UnifiedJedis(
163+
new HostAndPort("<host>", <port>),
164+
config
165+
);
166+
167+
// Test the connection.
168+
System.out.println(String.format("Database size is %d", jedis.dbSize()));
169+
```
170+
171+
## Advanced configuration options
172+
173+
The `TokenAuthConfig` class has several other options that you can
174+
set with the `EntraIDTokenAuthConfigBuilder.builder()`. These give you
175+
more precise control over the way the token is renewed:
176+
177+
```java
178+
TokenAuthConfig authConfig = EntraIDTokenAuthConfigBuilder.builder()
179+
.expirationRefreshRatio(0.75)
180+
.lowerRefreshBoundMillis(100)
181+
.tokenRequestExecTimeoutInMs(100)
182+
.maxAttemptsToRetry(10)
183+
.delayInMsToRetry()
184+
// ...
185+
.build();
186+
```
187+
188+
These options are explained below:
189+
190+
- `expirationRefreshRatio`: a `float` value representing the fraction
191+
of a token's lifetime that should elapse before attempting to
192+
refresh it. For example, a value of 0.75 means that you want to
193+
refresh the token after 75% of its lifetime has passed.
194+
- `lowerRefreshBoundMillis`: the minimum amount of the token's lifetime
195+
(in milliseconds) remaining before attempting to refresh, regardless
196+
of the `expirationRefreshRatio` value. Set this to zero if you want
197+
the refresh time to depend only on `expirationRefreshRatio`.
198+
- `tokenRequestExecTimeoutInMs`: the maximum time (in milliseconds) to
199+
wait for a token request to receive a response. A timeout occurs if this limit is exceeded.
200+
- `maxAttemptsToRetry`: the maximum number of times to retry a token
201+
request before aborting.
202+
- `delayInMsToRetry`: the time (in milliseconds) to wait before
203+
retrying a token request after a failed attempt. This provides a mechanism to request throttling to prevent an excessive number of token requests.

0 commit comments

Comments
 (0)