tar zxvf redis-3.2.5.tar.gz
sudo mv -r redis-3.2.3/* /usr/local/redis进入redis目录cd /usr/local/redis/
sudo make
sudo make test
redis-server
redis-cli
pingset 'a' '123'
bind 127.0.0.1
port 6379
daemonize no|yes
dbfilename dump.rdb
dir的默认值为 ./, 表示当前目录推荐改为: dir /var/lib/redis
sudo cp /usr/local/redis/redis.conf /etc/redis/
sudo redis-server /etc/redis/redis.conf
ps ajx|grep redissudo kill -9 redis的进程id
set key value
SETEX key seconds value
MSET key value [key value ...]
GET key
MGET key [key ...]
INCR key
DECR key
DECRBY key decrement
APPEND key value
STRLEN key
KSYS pattern
EXIST key [key ...]
TYPE key
DEL key [key ...]
EXPIRE key seconds
TTL key
HSET key field value
HMSET key field value [field value ...]
HGET key field
HMGET key field [field ...]
HGETAll key
HKEYS key
HLEN key
HVALS key
HEXISTS key field
HDEL key field [field ...]
HSTRLEN key field
LPUSH key value [value ...]
RPUSH key value [value ...]
LINSERT key BEFORE|AFTER PIVOT value
LSET key index value
LPOP key
RPOP key
LRANGE key start stop
LTPIM key start stop
LLEN key
LINDEX key index
SADD key member [member ...]
SMEMBERS key
SCARD key
SINTER key [key ...]
SDIFF key [key ...]
SUNION key [key ...]
SISMEMBER key member
sorted set, 有序集合
元素为string类型
元素具有唯一性, 不重复
每个元素都会关联一个double类型的score, 表示权重, 通过权重将元素从小到大排序
元素的score可以相同
设置 :
ZADD key score member [score member ...]
获取 :
ZRANGE key start stop
ZCARD key
ZCOUNT key min max
ZSCORE key member
其他 :
SUBSCRIBE 频道名称 [频道名称 ... ]
UNSUBSCRIBE 频道名称 [频道名称 ... ]
PUBLISH 频道 消息
bind 192.168.1.10
bind 192.168.1.11 slaveof 192.168.1.10 6379
set hello world
get hello