`
songbin0201
  • 浏览: 320232 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

redis资料收集

阅读更多
NOSQL数据库笔谈
http://sebug.net/paper/databases/nosql/Nosql.html

官方地址
http://code.google.com/p/redis/

Redis配置参数详解
daemonize:是否以后台daemon方式运行
pidfile:pid文件位置
port:监听的端口号
timeout:剔除超时的空闲连接 Close the connection after a client is idle for N seconds (0 to disable)
loglevel:log信息级别
logfile:log文件位置
databases:开启数据库的数量
save * *:保存快照的频率,第一个*表示多长时间,第三个*表示执行多少次写操作。在一定时间内执行一定数量的写操作时,自动保存快照。可设置多个条件。
rdbcompression:是否使用压缩
dbfilename:数据快照文件名(只是文件名,不包括目录)
dir:数据快照的保存目录(这个是目录)
appendonly:是否开启appendonlylog,开启的话每次写操作会记一条log,这会提高数据抗风险能力,但影响效率。
appendfsync:appendonlylog如何同步到磁盘(三个选项,分别是每次写都强制调用fsync、每秒启用一次fsync、不调用fsync等待系统自己同步)


下面是一个略做修改后的配置文件内容
daemonize yes
pidfile /usr/local/redis/var/redis.pid
port 6379
timeout 300
loglevel debug
logfile /usr/local/redis/var/redis.log
databases 16
save 900 1
save 300 10
save 60 10000
rdbcompression yes
dbfilename dump.rdb
dir /usr/local/redis/var/
appendonly no
appendfsync always
glueoutputbuf yes
shareobjects no
shareobjectspoolsize 1024


redis主从配置(master-slave)
启动主从服务,先启动主redis,再启动从 redis,因为从redis要依赖主redis
假设主服务监控6379端口,则设置从服务监控6380端口,需要新建redis.slave.conf文件,并修改配置
# Accept connections on the specified port, default is 6379
port 6380

################################# REPLICATION #################################

# Master-Slave replication. Use slaveof to make a Redis instance a copy of
# another Redis server. Note that the configuration is local to the slave
# so for example it is possible to configure the slave to save the DB with a
# different interval, or to listen to another port, and so on.
#
# slaveof localhost 6380
分享到:
评论
2 楼 songbin0201 2013-04-18  
freeman983 写道

timeout 不是请求超时时间,而是剔除空闲客户端的时间。


谢谢指出,当时水平有限,很多东西一边搜索一边猜测
1 楼 freeman983 2013-04-17  

timeout 不是请求超时时间,而是剔除空闲客户端的时间。

相关推荐

Global site tag (gtag.js) - Google Analytics