Redis官网文档
http://redis.cn/commands.html
1.下载 [root@bepsin-itop01 ]# wget http://download.redis.io/releases/redis-4.0.10.tar.gz 2.解压安装 [root@bepsin-itop01 ]# tar xvf redis-4.0.10.tar.gz 3.编译安装 [root@bepsin-itop01 ]# make [root@bepsin-itop01 ]# make install 4.修改配置 [root@bepsin-itop01 redis-4.0.10]# vim /usr/local/redis-4.0.10/redis.conf daemonize yes logfile "/usr/local/redis-4.0.10/redis.log" dir "/usr/local/redis-4.0.10/" requirepass cqmp #cqmp是密码 bind 10.8.1.6 启动: [root@chaoyang-test redis-4.0.10]# /usr/local/bin/redis-server /usr/local/redis-4.0.10/redis.conf & 5. 连接测试 [root@bepsin-itop01 redis-4.0.10]# redis-cli -h 127.0.0.1 -p 6379 -a 密码 Warning: Using a password with ‘-a‘ option on the command line interface may not be safe. 10.3.0.5:6379> get name (nil) 10.3.0.5:6379>
2. 图形工具下载
https://github.com/caoxinyu/RedisClient
127.0.0.1:6379> set name xiaohong //设置键值对 127.0.0.1:6379> get name //查询name值 127.0.0.1:6379> setex name 20 xiaohong //设置这个数值有效20秒 127.0.0.1:6379> ttl name //查看键值对有效时间,-1 无限时间, -2是过期无效了. 127.0.0.1:6379> mset id 1 name a age 100 //设置多个键值对 127.0.0.1:6379> mget id name age //获取多个键值 127.0.0.1:6379> incr age //数字增加1 127.0.0.1:6379> incrby age 10 //数字增加10 127.0.0.1:6379> decr age //减1 127.0.0.1:6379> decrby age 10 //减10 127.0.0.1:6379> append name bc //原来name数值是a,追加数值bc 变成abc 127.0.0.1:6379> strlen name //查看长度
原文:https://www.cnblogs.com/chaoyangxu/p/12192002.html