Welcome! This is the course repository for the Redis University Course RU102N: Redis for .NET Developers.
To take this course you'll need the following.
- The .NET 7 SDK.
- Clone this git repository from GitHub.
- Get a Redis Stack instance running locally or in the cloud.
There are instructions for each step below.
Throughout the course we've provided code examples written in C#. Writing and running these examples will be invaluable for those trying to learn how to use Redis from the .NET ecosystem. In order to run all these examples, you'll simply need the .NET 7 SDK.
Installation of the .NET 7 SDK is pretty self explanatory on Windows and MacOS. All you need to do is to grab the SDK installer from the downloads page and run it.
There are two ways to get a copy of the git repository on your machine.
If you have the Git command line tools installed, open your command line or terminal and clone the repository like so:
git clone https://github.com/redislabs-training/ru102n
Now, change to the directory containing the course files:
cd ru102n
The remainder of these instructions assume that you are in the ru102n
directory.
Your next step is to proceed to "Redis Setup".
If you don't have the command line tools for Git, you can download the zip file from the GitHub repository.
After the zip file has downloaded, simply unzip it to wherever you want to use the files from, and change directories into that folder with the command cd ru102n
.
The remainder of these instructions assume that you are in the ru102n
directory.
This course requires an instance of Redis Stack - an extension of Redis with loads of really neat features we'll be exploring later in this course. Redis Stack is free and available under the Redis Source Available License (RSAL). There are a variety of ways to get up and running with it. Browse the options below and see which one works best for you.
This option doesn't require you to run Redis locally. We provide a free tier for Redis Cloud which will be perfectly sufficient for the purposes of this course. And of course, once the course is over you're totally welcome to flush all the data from this course out and use the database in your own personal projects.
Let's get up and running with Redis Cloud:
- Navigate to the signup page on redis.com.
- Complete the signup form and click the "Get Started" button. Note that you can sign up with your Google or GitHub account.
- When you receive the activation email from Redis, open it and click "Activate Account".
- You'll be taken to the dashboard, and a New Subscription dialog appears:
- Select your preferred cloud provider and a preferred region (preferably one close to you!). This is where we'll host your free Redis instance.
- Click the "Let's start free" button.
- Your new free database will be created, you should see something like this:
- Click on "Redis-free-db" to drill down into the details for your instance.
- There are several things you should take a note of here that will be relevant for connecting to Redis from .NET:
- Host name
- Port
- User name - this will be
default
, which means we won't actually need it to connect. - Password
- Your host name and port can be found in the "General" section (see example below where the host name is
redis-15676.c10.us-east-1-3.ec2.cloud.redislabs.com
and the port is15676
).
- Scroll down to the "Security" section.
- Click the "Copy" button next to "Default user password" to copy the Redis password into the clipboard. Paste this somewhere for safekeeping. Alternatively, click the eye icon to show the password:
- If you see a green check mark next to the "Redis-free-db" title, your database is ready to use!
If you want to run Redis locally, this is the easiest way to go about it. First make sure that you've installed Docker.
This course uses the Redis Stack Docker container. You can download and start it with the course Docker Compose as follows:
docker-compose up -d
You can check the status of the container with the following command:
docker ps
You should see an output that looks something like the following:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS
NAMES
2dc2a8044876 redis/redis-stack:latest "/entrypoint.sh" 3 seconds ago Up 1 second 0.0.0.0:6379->6379/tcp, 0.0.0.0:8001->8001/tcp redisu-ru102n
Leave this container running for now. When you want to stop it, use this command:
docker-compose down
Redis Stack can be installed using popular package managers for both macOS and Linux. Follow the instructions on redis.io to install and start Redis Stack.
RedisInsight is a graphical interface allowing you to interact with data and configure Redis instances.
The preferred way to run RedisInsight is as a desktop application. If you're using a Redis instance in the cloud, you'll need to install the RedisInsight desktop application. If you chose the Docker or local install of Redis Stack option for your Redis instance, you can either install the RedisInsight desktop application or choose run it as a web application with no further software installation required (see option 2 below).
To use the desktop application, first download and install it using the instructions on the RedisInsight download page.
Once you have installed RedisInsight, start it up and agree to the terms and conditions of use.
Finally, configure RedisInsight to connect to your Redis Instance... Click the "ADD REDIS DATABASE" button and fill out the new database form with the following values.
If your Redis instance is in the cloud:
- Host: The host name for your cloud database
- Port: The port number for your cloud database
- Database Alias: RU102N
- Username: default
- Password: The password for your cloud database
- Select Logical Database: [leave unchecked]
- Use TLS: [leave unchecked]
If you are using Docker or you have installed Redis Stack locally:
- Host: localhost
- Port: 6379
- Database Alias: RU102N
- Username: [leave blank]
- Password: [leave blank]
- Select Logical Database: [leave unchecked]
- Use TLS: [leave unchecked]
Then click the "Add Redis Database" button to connect to your Redis instance. You should see "RU102N" in the list of Redis databases, and can click on it to open the Browser view.
If you see an error while trying to connect to Redis, ensure that your Redis instance is running (make sure the Docker container is up or your locally installed Redis Stack is running) and try again.
Your next step is to load the sample data...
If you used the Docker or local install of Redis Stack options to get your Redis instance, you can choose to use RedisInsight as a web application with no further software to install. If you're using a Redis instance in the cloud, this option is not currently available to you and you should download and install RedisInsight instead.
First, ensure that the Docker container or your local Redis Stack installation is running.
Now, point your browser at http://localhost:8001/
and you should see the RedisInsight terms and conditions:
Accept the terms and click "Submit". RedisInsight will automatically connect to the local Redis Stack instance and display the key browser:
You're now ready to take the course! If you haven't already, sign up here to access the course materials.
If you need help or want to chat about all things Redis, Join us on Discord and pop into the course channel!