Giter VIP home page Giter VIP logo

ru202's Introduction

RU202 Redis Streams

This repository contains the source code for the RU202 Redis Streams Course at Redis University.

Reporting Errata

Spotted an error in a text segment, image or video transcript? Please report an issue. We also welcome pull requests with your suggestions. The files for each text segment, image, non-graded quiz question and video transcript can be found in the courseware folder in this repository.

Environment Setup

To get the most from this course and follow along with the sample code, you'll need to have access to a Redis Stack 7 server and have Python 3 installed.

Prerequisites

In order to run the sample code, you will need:

  • Python 3.
  • Ability to run the pip command for Python 3.
  • Access to a local or remote installation of Redis Stack. (local preferred). We've provided a Docker Compose file to make this easy for you. If you don't want to use Docker, follow the instructions here to install Redis Stack using a package manager.

Setup

Execute these commands in your shell to clone the repository, create a Python virtual environment and install the depdendencies:

git clone https://github.com/redislabs-training/ru202.git
cd ru202
python3 -m venv env
. env/bin/activate
pip install -r requirements.txt

Note: Ensure you activate your virtual environment in each new shell/terminal session before running any of the sample code.

Starting Redis Stack (Docker)

If you're using Docker to Run Redis Stack, start it like this:

docker-compose up -d

You can now run redis-cli to connect to Redis as follows:

docker exec -it redis_ru202 redis-cli

Type quit to exit redis-cli back to your shell.

When you are done with the container, you can shut it down like this:

docker-compose down

Redis Stack will persist your data to an append only file in the redisdata folder, so it will be there the next time you start the container. To erase it, use rm -rf redisdata.

Configuration

By default, the code will assume that Redis Stack is available on localhost at port 6379. If your Redis Stack instance is running elsewhere, you will need to set the REDIS_HOST and/or REDIS_PORT environment variables. For example, here's how to configure these to connect to Redis Stack on myredishostname port 6380:

export REDIS_HOST=myredishostname
export REDIS_PORT=6380

If your Redis Stack instance requires a password to connect, also set the REDIS_PASSWORD environment variable:

export REDIS_PASSWORD=secret123

If you need to supply a user name when connecting, you should set the REDIS_USER environment variable:

export REDIS_USER=student

Test Your Connection to Redis Stack

To test your Redis Stack connection and Python environment, run:

python test_connection.py

If this command outputs True, then you are setup and ready to run the example code as described in the course materials.

Running the Example Code

Throughout the course, you will be asked to run the example code for the various exercises. Some of these require you to open multiple shell/terminal sessions. Don't forget to start your Python virtual environment in each new shell session. If your Redis Stack instance is not running on localhost:6379 then you'll also need to set the environment variables REDIS_HOST, REDIS_PORT and optionally REDIS_USER and REDIS_PASSWORD.

Optional (but recommended!): RedisInsight

RedisInsight is a graphical management tool for Redis. It allows you to view and edit data in Redis, and contains specialized views for looking at the contents of Redis Streams.

You don't need to install or use RedisInsight to be successful with this course, but we'd recommend you give it a try.

Download RedisInsight here (it's free!). Once installed, add a new Redis database and supply the hostname, port and optionally username and password for the Redis instance that you're using for this course (this will usually be localhost, 6379 and no username or password).

If you're using the Docker Compose file provided with this course, you can also try out a limited version of RedisInsight in your browser by visiting http://localhost:8081 - this version can only connect to the Redis Stack instance in the Docker container. Use the Desktop version of RedisInsight to manage connections to multiple remote and/or local Redis instances.

Questions?

If you have questions about this repository, you can chat with our teaching assistants 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 and check out our events schedule on the Redis Developer site.

ru202's People

Contributors

amincheloh avatar narayanadithya avatar simonprickett avatar suzeshardlow avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ru202's Issues

Move week 4 exercises to use millisecond precision timestamps.

Move week 4 exercises to use millisecond precision timestamps, so that RedisInsight renders the dates correctly. Currently it shows all the dates as 01/01/1970 because the IDs provided are second based timestamps. This will also need updates to the text sections in week 4 of the course.

Add docker-compose file to provide a Redis instance for this course.

Add adocker-compose.yml file that uses the Redis Docker container (https://hub.docker.com/_/redis), and configure Redis in that container to persist data to a folder named "redisdata".

This is part of our participation in Hacktoberfest 2021. Learn how to complete this issue here: https://developer.redis.com/hacktoberfest/

Need help or want to talk to us? Join us on Discord where we have a dedicated Hacktoberfest channel: https://discord.gg/ueQwKUh5Z3

Activate virtual environment command incorrect in README

Hi RedisU Team. Can you please change the following line in the README file under the Setup section from
. env/bin/activate to . env/Scripts/activate
I think the file structure of the repo may have been changed after the README was last updated

Add information about `LIMIT` clause with approximate trimming in `XADD` and `XTRIM`.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.