• Stars
    star
    112
  • Rank 312,240 (Top 7 %)
  • Language
    Python
  • License
    MIT License
  • Created about 4 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Source code and examples for Redis University RU101 Introduction to Redis Data Structures

Redis University RU101: Introduction to Redis Data Structures

Introduction

This repo contains the sample data and Python code for RU101, Introduction to Redis Data Structures at Redis University.

Setup

Redis Stack is an easy to install bundle of Redis plus additional capabilities. You'll need to clone this repository to your machine, and setup Redis Stack and Python as described below. Read more about Redis Stack here.

Redis Stack

There are multiple ways that you can install Redis Stack, options include:

Python

This course requires Python 3. You should create and use a virtual environment when running the code and loading the sample data into Redis. You'll also need to set your PYTHONPATH environment variable:

$ git clone https://github.com/redislabs-training/ru101.git
$ cd ru101
$ export PYTHONPATH=`pwd`
$ python3 -m venv venv
$ . venv/bin/activate
$ pip install -r requirements.txt

Configuration

The data loader and sample code expect Redis to be running at localhost:6379 with no password set. This is the default, but if your Redis instance uses a different hostname, port, or has a password, you should set the appropriate environment variables:

$ export REDIS_HOST=myredishost
$ export REDIS_PORT=9999
$ export REDIS_PASSWORD=ssssh

Network Latency

Running the Redis server and the Python code on different machines introduces round trip network latency for each Redis command sent from Python to Redis. To keep the example code simple, some of the Python scripts for this course send each command to Redis separately.

To get the most performance from applications using Redis, we recommend the use of pipelining to send multiple commands to the server in a single round trip where possible. You should also ensure that the application code and Redis server are on hosts with minimal latency between them. These concepts are covered in more detail in the following programming language specific Redis University courses:

To get the best performance from the simple demo scripts for this course, you should run the code and the Redis server on the same local network or the same machine if possible.

Loading the Sample Data

To answer some of the homework and exam questions, and to run the sample code, you'll need to load the sample data into Redis. Skip this step if you chose to use a Cloud Redis Stack instance as you will have loaded the data as part of the database setup.

If you're running Redis Stack locally or via Docker, go ahead and load the data as follows:

$ cd redisu
$ python utils/dumpload.py load ru101/data/ru101.json

If the sample data was loaded correctly, you should see the following message:

total keys loaded: 14328

Using redis-cli

Some of the quiz, homework and exam questions for this course may require you to use the Redis command line interface to execute commands. Start redis-cli from the command line as follows:

$ redis-cli
127.0.0.1:6379>

You can then enter Redis commands, for example to see how many keys are in the database use dbsize:

127.0.0.1:6379> dbsize
(integer) 14328
127.0.0.1:6379>

If you prefer a more graphical user interface, try RedisInsight, a free tool for exploring and interacting with Redis that includes an embedded redis-cli.

Running the Code

To run the example code, cd to the directory containing the script you wish to run, and pass the script name to the python command.

Example:

$ cd redisu/ru101/uc01-faceted-search
$ python search.py

Need Help or Have Questions?

If you need help, have questions, or want to chat about all things Redis, please join us on the Redis University Discord Server.

Subscribe to our YouTube Channel / Follow us on Twitch

We'd love for you to check out our YouTube channel, and subscribe if you want to see more Redis videos! We also stream regularly on our Twitch.tv channel - follow us to be notified when we're live.

More Repositories

1

ru102py

The example project for Redis University's RU102PY course.
Python
73
star
2

ru102js

Source code for the RU102JS Redis for JavaScript Developers Course
JavaScript
55
star
3

ru102j

Source code for the RU102J Redis for Java Developers Course
Java
37
star
4

ru202

Source code for the RU202 Redis Streams Course
HTML
37
star
5

exercises-scaling-redis

Shell
34
star
6

redis-sitesearch

Real-time search and indexing for any website
HTML
33
star
7

node-js-crash-course

The Sample Application for the Node.js Redis Crash Course.
JavaScript
33
star
8

ru102n

This is the course repository for Redis University RU102N, Redis for .NET Developers.
JavaScript
30
star
9

ru203

Example code for the Redis University course RU203: Querying, Indexing, and Full-text Search with RediSearch.
Python
19
star
10

keybase

Redis based knowledge base
HTML
16
star
11

ru330

RU330: Redis Security is a course at Redis University.
Dockerfile
15
star
12

redisfi

Python
6
star
13

ru204

This is the course repository for the Redis University RU204 Storing, Querying, and Indexing JSON at Speed course.
HTML
6
star
14

dockerized-redis-cluster

Simple Docker Compose to create an OSS cluster
Shell
5
star
15

training-geo-public

This repository provides some exercises around Redis commands that are related to geospatial.
HTML
5
star
16

redis-limiter

A simple rate limiter and benchmark using Redis Triggers and Functions
Python
4
star
17

hitc-new-in-redis-62

Example data and container for the What's New in Redis 6.2 Head in the Corner video.
JavaScript
4
star
18

ioredis-demos

Demo code using the ioredis client.
JavaScript
3
star
19

redis-sitesearch-frontend

Frontend code for redis-sitesearch.
JavaScript
2
star
20

ru402

This is the course repository for the Redis University RU404 Redis as a Vector Database
HTML
2
star
21

slides-as-code-setup

Setup scripts for the slides-as-code project
Shell
1
star
22

lms-course-backup-poc

HTML
1
star
23

ru301

Exercise files for RU301 - Running Redis at Scale.
1
star
24

dockerized-redis-oss-sentinel

Python
1
star
25

ru201

Source code for the RU201 RediSearch Course
JavaScript
1
star
26

discordia-bot

Sample code for "Writing a Discord Bot with Node.js, Redis, and the Illuminati". Video can be found at https://www.youtube.com/watch?v=NUGdJG1WUjU.
JavaScript
1
star