cd /usr/local/src
wgethttp://redis.googlecode.com/files/redis-2.2.10.tar.gz
cdredis-2.2.10
makeprefix=指定安装路径,也可以是默认
默认配置文件在当前目录下 cp redis.conf 也可以直接使用下面配置文档命令说明:
redis-serverredis服务器的daemon启动程序
redis-cliredis命令行操作工具,也可以只用telnet来操作
例:
redis-cli-hlocalhost-p6379monitor监控连接及读写操作
redis-cli -h localhost -p 6379 info 监控服务的统计信息redis-benchmark redis性能测试工具,主要测试redis在系统下的读写性能
例:
redis-benchmark-hlocalhost-p6379-c1000-n100000
1000个并发 100000个请求 检测 本地 端口 6378 redis性能/etc/redis.conf
daemonizeyes
port6379
#bind 绑定IPtimeout 300
#日志级别debugverbosenoticewarning
loglevel debuglogfile /var/log/redis.log
databases16
#快照保存策略
save36001
save180010
save60010000
rdbcompressionyes
#数据库文件名
dbfilenamedump.rdb
#数据库目录
dir/var/redisdb/
#设置主从
#slaveof<masterip><masterport>
#masterauth<master-password>
slave-serve-stale-datayes
#requirepassfoobared
#Commandrenaming.
#rename-commandCONFIG""
#运行最大的连接,默认不限制
#maxclients128
#使用最大内存
maxmemory1GB
#maxmemory-policyvolatile-lru
#maxmemory-samples3
#是否开启aof
appendonlyno
#磁盘同步策略alwayseverysecno
appendfsynceverysec
no-appendfsync-on-rewrite nohash-max-zipmap-entries 512
hash-max-zipmap-value64
list-max-ziplist-entries512
list-max-ziplist-value64
set-max-intset-entries512
activerehashingyes
数据备份及还原:1、数据备份目前只能备份dump.rdb 这个文件,做定期的copy,
2、数据恢复是直接把备份文件覆盖到当前。
3、建议采用slave+AOF 方式进行备份,AOF方式的效率不是很高,但是数据性最完整的。数据库重启后会自动按照AOF日志重建数据库。