Redis Stack搭建
參考
https://redis.io/docs/latest/operate/oss_and_stack/install/archive/install-stack/docker/
- 環(huán)境查看
系統(tǒng)環(huán)境
# cat /etc/redhat-release
Rocky Linux release 9.3 (Blue Onyx)
# uname -a
Linux Rocky9Milvus003075 5.14.0-362.18.1.el9_3.0.1.x86_64 #1 SMP PREEMPT_DYNAMIC Sun Feb 11 13:49:23 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
軟件環(huán)境
# docker version
Client: Docker Engine - Community
Version: 25.0.3
API version: 1.44
Go version: go1.21.6
Git commit: 4debf41
Built: Tue Feb 6 21:14:42 2024
OS/Arch: linux/amd64
Context: default
Server: Docker Engine - Community
Engine:
Version: 25.0.3
API version: 1.44 (minimum version 1.24)
Go version: go1.21.6
Git commit: f417435
Built: Tue Feb 6 21:13:06 2024
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.28
GitCommit: ae07eda36dd25f8a1b98dfbf587313b99c0190bb
runc:
Version: 1.1.12
GitCommit: v1.1.12-0-g51d5e94
docker-init:
Version: 0.19.0
GitCommit: de40ad0
# docker-compose version
Docker Compose version v2.23.3
- 設(shè)置docker-compose配置文件
# cat docker-compose.yml
version: "3.8"
services:
redis-stack:
image: redis/redis-stack:latest
container_name: redis-stack
ports:
- "6379:6379" # Redis 服務(wù)端口
- "8001:8001" # Redis Stack Web UI 端口
environment:
# 這里設(shè)置 Redis 連接密碼
- REDIS_ARGS=--requirepass qwer1234
volumes:
- /root/redis-stack/data:/data # Redis 數(shù)據(jù)持久化目錄需要使用絕對路徑否則不會持久化數(shù)據(jù)
restart: always
- 啟動
# docker-compose up -d
- 驗證數(shù)據(jù)是否持久化
# redis-cli -a qwer1234
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
127.0.0.1:6379> set a 1
127.0.0.1:6379> get a 1
127.0.0.1:6379> save
退出終端查看數(shù)據(jù)目錄是否生成數(shù)據(jù)文件
# ls data/
dump.rdb
重啟docker-compose驗證
# docker-compose down
# docker-compose up -d
查看數(shù)據(jù)
# redis-cli -a qwer1234
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
127.0.0.1:6379> get a
"1"
- 使用自帶webUI查看
訪問地址
http://ip:8001

查看值


浙公網(wǎng)安備 33010602011771號