suse11安装测试redis
suse11 安装测试redis
一,下载安装redis 最新源码包
wget http://redis.googlecode.com/files/redis-2.6.13.tar.gz
--2013-05-12 18:09:57-- http://redis.googlecode.com/files/redis-2.6.13.tar.gz
Resolving redis.googlecode.com... 173.194.72.82, 2404:6800:4008:c00::52
Connecting to redis.googlecode.com|173.194.72.82|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 994331 (971K) [application/x-gzip]
Saving to: `redis-2.6.13.tar.gz'
100%[======================================================================================>] 994,331 3.26M/s in 0.3s
2013-05-12 18:09:57 (3.26 MB/s) - `redis-2.6.13.tar.gz' saved [994331/994331]
SLES11-108:~/nosql # tar zxvf redis-2.6.13.tar.gz
SLES11-108:~/nosql # cd redis-2.6.13/
make
CC sentinel.o
LINK redis-server
INSTALL redis-sentinel
CC redis-cli.o
LINK redis-cli
CC redis-benchmark.o
LINK redis-benchmark
CC redis-check-dump.o
LINK redis-check-dump
CC redis-check-aof.o
LINK redis-check-aof
Hint: To run 'make test' is a good idea ;)
SLES11-108:~/nosql/redis-2.6.13/src # cp redis-server /usr/local/bin/
SLES11-108:~/nosql/redis-2.6.13/src # cp redis-cli /usr/local/bin/
SLES11-108:~/nosql/redis-2.6.13/src # cp ../redis.conf /etc/
SLES11-108:~/nosql/redis-2.6.13/src #
daemonize yesSLES11-108:/etc # cat /etc/redis.conf |grep -Ev "^#|^$"
pidfile /var/run/redis.pid
port 6379
timeout 0
tcp-keepalive 0
loglevel notice
logfile stdout
databases 16
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir ./
slave-serve-stale-data yes
slave-read-only yes
repl-disable-tcp-nodelay no
slave-priority 100
appendonly no
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-entries 512
list-max-ziplist-value 64
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
aof-rewrite-incremental-fsync yes
二,启动redis
SLES11-108:/etc # ps -ef |grep redis
root 23801 1 0 18:16 ? 00:00:00 redis-server /etc/redis.conf
root 23805 21983 0 18:17 pts/0 00:00:00 grep redis
SLES11-108:/etc # netstat -tplun |grep 6379
tcp 0 0 0.0.0.0:6379 0.0.0.0:* LISTEN 23801/redis-server
SLES11-108:/etc #
三,测试redis (测试list类型数据)
SLES11-108:~ # redis-cli
redis 127.0.0.1:6379>
redis 127.0.0.1:6379> help set #查看帮助参数,在命令的前面加help
SET key value
summary: Set the string value of a key
since: 1.0.0
group: string
redis 127.0.0.1:6379> help @set #如果要查看一个类型的全部命令 加@
SADD key member [member ...]
summary: Add one or more members to a set
since: 1.0.0
SCARD key
summary: Get the number of members in a set
since: 1.0.0
SDIFF key [key ...]
summary: Subtract multiple sets
since: 1.0.0
...
后续省略
redis 127.0.0.1:6379> lpush test a b c #该命令会创建该键及与其关联的List,之后在将参数中的values从左到右依次插入。
(integer) 3
redis 127.0.0.1:6379> lrange test 0 -1 #取链表中的全部元素,其中0表示第一个元素,-1表示最后一个元素。
1) "c"
2) "b"
3) "a"
redis 127.0.0.1:6379> lpushx test1 d #库中没有该键值,显示为0
(integer) 0
redis 127.0.0.1:6379> lpushx test d # 库中有该键值,并且把刚刚加的d 添加进去了
(integer) 4
redis 127.0.0.1:6379> lrange test1
(error) ERR wrong number of arguments for 'lrange' command
redis 127.0.0.1:6379> lrange test1 0 -1
(empty list or set)
redis 127.0.0.1:6379> lrange test 0 -1
3) "b"
4) "a"
一,下载安装redis 最新源码包
wget http://redis.googlecode.com/files/redis-2.6.13.tar.gz
--2013-05-12 18:09:57-- http://redis.googlecode.com/files/redis-2.6.13.tar.gz
Resolving redis.googlecode.com... 173.194.72.82, 2404:6800:4008:c00::52
Connecting to redis.googlecode.com|173.194.72.82|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 994331 (971K) [application/x-gzip]
Saving to: `redis-2.6.13.tar.gz'
100%[======================================================================================>] 994,331 3.26M/s in 0.3s
2013-05-12 18:09:57 (3.26 MB/s) - `redis-2.6.13.tar.gz' saved [994331/994331]
SLES11-108:~/nosql # tar zxvf redis-2.6.13.tar.gz
SLES11-108:~/nosql # cd redis-2.6.13/
make
CC sentinel.o
LINK redis-server
INSTALL redis-sentinel
CC redis-cli.o
LINK redis-cli
CC redis-benchmark.o
LINK redis-benchmark
CC redis-check-dump.o
LINK redis-check-dump
CC redis-check-aof.o
LINK redis-check-aof
Hint: To run 'make test' is a good idea ;)
SLES11-108:~/nosql/redis-2.6.13/src # cp redis-server /usr/local/bin/
SLES11-108:~/nosql/redis-2.6.13/src # cp redis-cli /usr/local/bin/
SLES11-108:~/nosql/redis-2.6.13/src # cp ../redis.conf /etc/
SLES11-108:~/nosql/redis-2.6.13/src #
daemonize yesSLES11-108:/etc # cat /etc/redis.conf |grep -Ev "^#|^$"
pidfile /var/run/redis.pid
port 6379
timeout 0
tcp-keepalive 0
loglevel notice
logfile stdout
databases 16
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir ./
slave-serve-stale-data yes
slave-read-only yes
repl-disable-tcp-nodelay no
slave-priority 100
appendonly no
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-entries 512
list-max-ziplist-value 64
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
aof-rewrite-incremental-fsync yes
二,启动redis
SLES11-108:/etc # ps -ef |grep redis
root 23801 1 0 18:16 ? 00:00:00 redis-server /etc/redis.conf
root 23805 21983 0 18:17 pts/0 00:00:00 grep redis
SLES11-108:/etc # netstat -tplun |grep 6379
tcp 0 0 0.0.0.0:6379 0.0.0.0:* LISTEN 23801/redis-server
SLES11-108:/etc #
三,测试redis (测试list类型数据)
SLES11-108:~ # redis-cli
redis 127.0.0.1:6379>
redis 127.0.0.1:6379> help set #查看帮助参数,在命令的前面加help
SET key value
summary: Set the string value of a key
since: 1.0.0
group: string
redis 127.0.0.1:6379> help @set #如果要查看一个类型的全部命令 加@
SADD key member [member ...]
summary: Add one or more members to a set
since: 1.0.0
SCARD key
summary: Get the number of members in a set
since: 1.0.0
SDIFF key [key ...]
summary: Subtract multiple sets
since: 1.0.0
...
后续省略
redis 127.0.0.1:6379> lpush test a b c #该命令会创建该键及与其关联的List,之后在将参数中的values从左到右依次插入。
(integer) 3
redis 127.0.0.1:6379> lrange test 0 -1 #取链表中的全部元素,其中0表示第一个元素,-1表示最后一个元素。
1) "c"
2) "b"
3) "a"
redis 127.0.0.1:6379> lpushx test1 d #库中没有该键值,显示为0
(integer) 0
redis 127.0.0.1:6379> lpushx test d # 库中有该键值,并且把刚刚加的d 添加进去了
(integer) 4
redis 127.0.0.1:6379> lrange test1
(error) ERR wrong number of arguments for 'lrange' command
redis 127.0.0.1:6379> lrange test1 0 -1
(empty list or set)
redis 127.0.0.1:6379> lrange test 0 -1
1) "d"
2) "c"3) "b"
4) "a"
redis 127.0.0.1:6379>
原文:http://lang71225090.blog.51cto.com/1231257/1410434
所有发生在我们身上的事件都是一个经过仔细包装的礼物。只要我们愿意面对它有时候有点丑恶的包装,带着耐心和勇气一点一点的拆开包装的话,我们会惊喜的看到里面珍藏的礼物。
----遇见未知的自己