# Rust and Redis

**Category:** For developers | **Published:** 2026-02-25 | **Updated:** 2026-02-25

> **TL;DR:**
>
> Add the `redis` crate to your `Cargo.toml`, create a connection with `redis::Client::open()`, and use commands like `SET` and `GET` through the `Commands` trait to read and write data.

## What you'll learn

- How to install Rust and set up a project with Cargo
- How to add the redis-rs crate as a dependency
- How to connect to a Redis server from Rust
- How to run basic Redis commands (SET, GET, and more)

## What are the prerequisites for using Redis with Rust?

- [Rust](https://www.rust-lang.org/tools/install) (1.65 or later recommended)
- [Cargo](https://doc.rust-lang.org/cargo/) (included with Rust)
- A running Redis server (see the [Redis quick start](/tutorials/howtos/quick-start/) for setup instructions)

## Getting Started

The Rust community has built many [Redis client libraries](https://redis.io/docs/latest/integrate/). This tutorial uses [`redis-rs`](https://github.com/redis-rs/redis-rs), the most widely used Rust client for Redis. It exposes a general-purpose interface to Redis and also provides specific helpers for commonly used functionality.

## How do I install Rust?

If you don't already have Rust installed, use `rustup`:

```bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```

Then configure your current shell to include Cargo's bin directory:

```bash
source $HOME/.cargo/env
```

Verify the installation:

```bash
rustc --version
```

## How do I add the redis-rs crate to my Rust project?

Create a new project (or open an existing one) and add `redis` to your `Cargo.toml`:

```toml
[dependencies]
redis = "1"
```

## How do I connect to Redis and run commands?

Clone the example repository to get started quickly:

```bash
git clone https://github.com/redis-developer/rust-redis-101
```

Then run the application:

```bash
cargo run
```

## Next steps

- Explore the [redis-rs documentation](https://docs.rs/redis) for async support, connection pooling, and cluster mode
- Try the [Redis quick start tutorial](/tutorials/howtos/quick-start/) to learn core Redis concepts
