Products
GG网络技术分享 2025-11-13 03:20 1
shell
$ sudo apt-get update
$ sudo apt-get install redis-server

shell
$ sudo vi /etc/redis/redis.conf
- 在配置文件中找到并修改以下设置:
- maxmemory修改为所需的内存巨大细小,比方说 maxmemory 10G。
- save根据需要设置迅速照备份,比方说 save 900 1 表示每900秒至少许有一个键被修改时备份。
- requirepassRu果需要设置密码, 取消注释并修改为您的密码,比方说 requirepass your_redis_password。
shell
$ redis-cli
shell
auth your_redis_password
shell
set name Tom
shell
get name
shell
del name
shell
$ sudo vi /etc/redis/redis.conf
bind 行,使Redis监听全部可用的IP地址:
shell
shell
$ sudo systemctl status redis
ping 命令检查连接:
shell
ping
save 设置,Redis会在后台自动施行迅速照备份。Demand feedback