ITeye博客

Redis review

jd2bs · 2013-05-14 11:04 · 企业架构 · Markdown

$ ./redis-server redis.conf

  1. redis.conf: daemonize yes port 6379 bind 127.0.0.1 #snapshot save config save 900 1 //900秒内至少有1个key被改变 save 300 10 //300秒内至少有10个key被改变 save 60 10000 //60秒内至少有10000个key被改变

slaveof

maxclients 128

vm-enabled no

#aof config appendonly yes

appendfsync everysec

可用数据库数 这就是所谓的"redis也可以分库:)" 用select index命令指定库

默认值为16,默认数据库为0,数据库范围在0-(database-1)之间

databases 16

2)save as hash structure to dec the memory use http://blog.nosqlfan.com/html/3379.html?ref=rediszt

if all save as string, that's use redis as memcached :)

  1. redis usage place: a:cache b:get newest N c:get Top N d: Counter e: Unique use set http://blog.nosqlfan.com/html/2235.html?ref=rediszt

4)some tips http://www.iteye.com/topic/1124999 1.Master最好不要做任何持久化工作,包括内存快照和AOF日志文件,特别是不要启用内存快照做持久化。 2.如果数据比较关键,某个Slave开启AOF备份数据,策略为每秒同步一次。 3.为了主从复制的速度和连接的稳定性,Slave和Master最好在同一个局域网内。 4.尽量避免在压力较大的主库上增加从库 5.为了Master的稳定性,主从复制不要用图状结构,用单向链表结构更稳定,即主从关系为:Master<--Slave1<--Slave2<--Slave3.......,这样的结构也方便解决单点故障问题,实现Slave对Master的替换,也即,如果Master挂了,可以立马启用Slave1做Master,其他不变。

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。