HomeAssistant家庭自动化-安装-安装redis实现缓存处理
HomeAssistant家庭自动化-安装-安装redis实现缓存处理
说明:
- 介绍如何在搭建redis服务器
- 环境:ubuntu20.04
步骤:
- apt安装
sudo apt update && sudo apt install redis-server -y
- ubuntu下配置启动使用systemd方式启动
- 修改
sudo vim /etc/redis/redis.conf
- 修改后如下:
. . .
# If you run Redis from upstart or systemd, Redis can interact with your
# supervision tree. Options:
# supervised no - no supervision interaction
# supervised upstart - signal upstart by putting Redis into SIGSTOP mode
# supervised systemd - signal systemd by writing READY=1 to $NOTIFY_SOCKET
# supervised auto - detect upstart or systemd method based on
# UPSTART_JOB or NOTIFY_SOCKET environment variables
# Note: these supervision methods only signal "process is ready."
# They do not enable continuous liveness pings back to your supervisor.
supervised systemd
. . .
- 重启服务
sudo systemctl restart redis.service
- 检查状态
sudo systemctl status redis
- 取消服务
sudo systemctl disable redis
- 激活服务
sudo systemctl enable redis
- 测试
redis-cli
- 效果如下:
redis-cli
127.0.0.1:6379> ping
PONG
127.0.0.1:6379> set test "it's working"
OK
127.0.0.1:6379> get test
"it's working"
127.0.0.1:6379>
获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号