0°

Redis安装配置

Redis安装配置
Redis是一个开源、支持网络、基于内存、键值对存储数据库,使用ANSI C编写。其开发由VMware主持。根据月度排行网站DB-Engines.com的数据显示,Redis是最流行的键值对存储数据库。
官网:http://redis.io/

下载解压

#wget http://redis.googlecode.com/files/redis-2.6.14.tar.gz
#tar zxvf redis-2.6.14.tar.gz

安装

#cd redis-2.6.14
#make PREFIX=/usr/local/redis install	//指定路径并安装

配置

//建立conf与var目录

#mkdir -p /usr/local/redis/conf
#mkdir -p /usr/local/redis/var

//创建redis.conf配置文件

#vi /usr/local/redis/conf/redis.conf

//redis.conf文件内容如下

daemonize yes
pidfile /var/run/redis.pid
port 6379
bind 127.0.0.1
timeout 120
tcp-keepalive 0
loglevel warning
logfile /usr/local/redis/var/redis.log
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 /usr/local/redis/var/
slave-serve-stale-data yes
slave-read-only yes
repl-disable-tcp-nodelay no
slave-priority 100
maxclients 1024
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

#/usr/local/redis/bin/redis-server /usr/local/redis/conf/redis.conf

检查是否启动

#ps -ef | grep redis

验证Redis

#telnet 127.0.0.1 6379

Trying 127.0.0.1…
Connected to localhost (127.0.0.1).
Escape character is ‘^]’.
set name test
+OK
get name
$4
test
quit
+OK
Connection closed by foreign host.

关闭Redis

#/usr/local/redis/bin/redis-cli -h 127.0.0.1 -p 6379 shutdown

参考:
http://dngood.blog.51cto.com/446195/925481

「点点赞赏,手留余香」

    还没有人赞赏,快来当第一个赞赏的人吧!
0 条回复 A 作者 M 管理员
    所有的伟大,都源于一个勇敢的开始!
欢迎您,新朋友,感谢参与互动!欢迎您 {{author}},您在本站有{{commentsCount}}条评论