You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+14-40Lines changed: 14 additions & 40 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,21 +8,15 @@ Spotted an error in a text segment, image or video transcript? Please [report a
8
8
9
9
## Environment Setup
10
10
11
-
To get the most from this course and follow along with the sample code, you'll need to have access to a Redis 7 server and have Python 3 installed.
11
+
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.
12
12
13
13
### Prerequisites
14
14
15
15
In order to run the sample code, you will need:
16
16
17
17
*[Python 3](https://www.python.org/downloads/).
18
18
* Ability to run the `pip` command for Python 3.
19
-
* Access to a local or remote installation of [Redis](https://redis.io/download) version 6.2 or newer (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](https://redis.io/docs/getting-started/) to install Redis using a package manager.
20
-
21
-
If you're using Windows, check out the following resources for help with running Redis:
22
-
23
-
*[Video - Installing Redis on Windows 10](https://www.youtube.com/watch?v=_nFwPTHOMIY)
24
-
*[Redis Blog - Running Redis on Windows 10](https://redis.com/blog/redis-on-windows-10/)
25
-
*[Microsoft - Windows Subsystem for Linux Installation Guide for Windows 10](https://docs.microsoft.com/en-us/windows/wsl/install-win10)
19
+
* Access to a local or remote installation of [Redis Stack](https://redis.io/docs/getting-started/install-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](https://redis.io/docs/getting-started/install-stack/) to install Redis Stack using a package manager.
26
20
27
21
### Setup
28
22
@@ -38,9 +32,9 @@ pip install -r requirements.txt
38
32
39
33
**Note:** Ensure you activate your virtual environment in each new shell/terminal session before running any of the sample code.
40
34
41
-
#### Starting Redis (Docker)
35
+
#### Starting Redis Stack (Docker)
42
36
43
-
If you're using Docker to Run Redis, start it like this:
37
+
If you're using Docker to Run Redis Stack, start it like this:
44
38
45
39
```bash
46
40
docker-compose up -d
@@ -60,54 +54,32 @@ When you are done with the container, you can shut it down like this:
60
54
docker-compose down
61
55
```
62
56
63
-
Redis 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`.
64
-
65
-
#### Starting Redis (when installed by a Package Manager)
66
-
67
-
If you installed Redis using a package manager, start the Redis server if it isn't already running. For example, if you installed Redis with the Homebrew package manager for macOS you'd start it like this:
68
-
69
-
```bash
70
-
brew services start redis
71
-
```
72
-
73
-
You can now run `redis-cli` to connect to Redis as follows:
74
-
75
-
```bash
76
-
docker exec -it redis_ru202 redis-cli
77
-
```
78
-
79
-
Type `quit` to exit `redis-cli` back to your shell.
80
-
81
-
When you are done with Redis, you can optionally turn off the server. For example if Redis was installed with the Homebrew package manager for macOS you'd stop the server like this:
82
-
83
-
```bash
84
-
brew services stop redis
85
-
```
57
+
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`.
86
58
87
59
### Configuration
88
60
89
-
By default, the code will assume that Redis is available on `localhost` at port `6379`. If your Redis 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 on `myredishostname` port `6380`:
61
+
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`:
90
62
91
63
```bash
92
64
export REDIS_HOST=myredishostname
93
65
export REDIS_PORT=6380
94
66
```
95
67
96
-
If your Redis instance requires a password to connect, also set the `REDIS_PASSWORD` environment variable:
68
+
If your Redis Stack instance requires a password to connect, also set the `REDIS_PASSWORD` environment variable:
97
69
98
70
```bash
99
71
export REDIS_PASSWORD=secret123
100
72
```
101
73
102
-
If you are using Redis 6 or 7 and need to supply a user name when connecting, you should set the `REDIS_USER` environment variable:
74
+
If you need to supply a user name when connecting, you should set the `REDIS_USER` environment variable:
103
75
104
76
```bash
105
77
export REDIS_USER=student
106
78
```
107
79
108
-
### Test Your Connection to Redis
80
+
### Test Your Connection to Redis Stack
109
81
110
-
To test your Redis connection and Python environment, run:
82
+
To test your Redis Stack connection and Python environment, run:
111
83
112
84
```bash
113
85
python test_connection.py
@@ -117,15 +89,17 @@ If this command outputs `True`, then you are setup and ready to run the example
117
89
118
90
### Running the Example Code
119
91
120
-
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. You'll also need to set the environment variables `REDIS_HOST`, `REDIS_PORT` and optionally `REDIS_USER` and `REDIS_PASSWORD` if your Redis instance is not running on `localhost:6379`.
92
+
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`.
121
93
122
94
### Optional (but recommended!): RedisInsight
123
95
124
96
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.
125
97
126
98
You don't need to install or use RedisInsight to be successful with this course, but we'd recommend you give it a try.
127
99
128
-
[Download RedisInsight here](https://redis.com/redis-enterprise/redis-insight/) (it's free!). Once installed, add a new Redis database and supply the hostname, port and optionally password for the Redis instance that you're using for this course (this will usually be `localhost`, `6379` and no password).
100
+
[Download RedisInsight here](https://redis.com/redis-enterprise/redis-insight/) (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).
101
+
102
+
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.
0 commit comments