在Ubuntu上配置Redis内存,可按以下步骤操作:
sudo apt update和sudo apt install redis-server安装。sudo nano /etc/redis/redis.conf命令编辑配置文件。# maxmemory <bytes>行,取消注释并设置内存大小,如maxmemory 2gb。maxmemory-policy,如allkeys-lru,表示内存满时淘汰最近最少使用的键。sudo systemctl restart redis使配置生效。redis-cli连接Redis,使用CONFIG GET maxmemory命令查看设置是否生效。