Redis Note0:命令

Redis Note0:命令

0. 官网

1. 常用命令

# 查看redis状态 sudo systemctl status redis-server # 验证端口6379上所有接口上的redis是否正在侦听 ss -an | grep 6379 ps -ef | grep redis ps axu | grep redis # 重启服务 sudo systemctl restart redis-server # 使用redis-cli # redis-cli -h <REDIS_IP_ADDRESS> ping redis-cli -h 127.0.0.1 ping redis-cli -h 192.168.92.145 ping redis-cli -h 192.168.92.145 -p 6379 # 关闭redis,在redis服务窗口下(通过redis-cli连接服务器后执行shutdown命令) shutdown # 启动redis-server,后台线程 redis-server /etc/redis/redis.conf

2. 查询Redis版本

root@redis:~# redis-server --version root@redis:~# redis-server -v Redis server v=6.2.6 sha=00000000:0 malloc=jemalloc-5.1.0 bits=64 build=9c9e426e2f96cc51