此篇博客是从刚学习redis开始,对自己使用过的命令进行整理,会持续更新。
//更新于2018/5/7
注意:Windows的Redis启动服务默认加载的配置文件是redis.windows-service.conf
启动redis服务器:redis-server.exe redis.windows.conf
启动客户端:redis-cli -h host -p port -a password
( redis-cli -h 172.16.239.10 -p 6379 -a wxh)
查看当前redis有没有设置密码: config get requirepass
输入密码: auth password (auth wxh)
查看所有的key :keys *
redis默认有16个数据库,选取某个数据库:select number (select 1)
hash存值取值命令:存:hmset key name "ww" sex "girl"
取:hgetall key
订阅:subscribe channel (subscribe wxh)
发布:publish channel message (publish wxh fightingfighting)