Linux下安装
]# wget http://download.redis.io/releases/redis-2.8.17.tar.gz ]# tar xzf redis-2.8.17.tar.gz ]# cd redis-2.8.17 ]# make
启动redis服务
]# cd src
]# ./redis-server
上面这种启动 redis使用的是默认配置,也可以通过启动参数告诉redis使用指定配置
]# ./redis-server redis.config
连接redis
[root@localhost src]# ./redis-cli 127.0.0.1:6379>
redis配置
redis的配置文件位于Redis安装目录下,文件名为 redis.conf。
可以通过CONFIG命令查看或者设置配置项
实例:
127.0.0.1:6379> config get loglevel 1) "loglevel" 2) "notice"
使用 * 获取所有配置项
127.0.0.1:6379> config get * 1) "dbfilename" 2) "dump.rdb" 3) "requirepass" 4) "" 5) "masterauth" 6) "" 7) "unixsocket" 8) "" 9) "logfile" 10) "" 11) "pidfile" 12) "/var/run/redis.pid" 13) "maxmemory" 14) "0" 15) "maxmemory-samples" 16) "3" 17) "timeout" 18) "0" 19) "tcp-keepalive" 20) "0" 21) "auto-aof-rewrite-percentage" 22) "100" 23) "auto-aof-rewrite-min-size" 24) "67108864" 25) "hash-max-ziplist-entries" 26) "512" 27) "hash-max-ziplist-value" 28) "64" 29) "list-max-ziplist-entries" 30) "512" 31) "list-max-ziplist-value" 32) "64" 33) "set-max-intset-entries" 34) "512" 35) "zset-max-ziplist-entries" 36) "128" 37) "zset-max-ziplist-value" 38) "64" 39) "hll-sparse-max-bytes" 40) "3000" 41) "lua-time-limit" 42) "5000" 43) "slowlog-log-slower-than" 44) "10000" 45) "latency-monitor-threshold" 46) "0" 47) "slowlog-max-len" 48) "128" 49) "port" 50) "6379" 51) "tcp-backlog" 52) "511" 53) "databases" 54) "16" 55) "repl-ping-slave-period" 56) "10" 57) "repl-timeout" 58) "60" 59) "repl-backlog-size" 60) "1048576" 61) "repl-backlog-ttl" 62) "3600" 63) "maxclients" 64) "10000" 65) "watchdog-period" 66) "0" 67) "slave-priority" 68) "100" 69) "min-slaves-to-write" 70) "0" 71) "min-slaves-max-lag" 72) "10" 73) "hz" 74) "10" 75) "no-appendfsync-on-rewrite" 76) "no" 77) "slave-serve-stale-data" 78) "yes" 79) "slave-read-only" 80) "yes" 81) "stop-writes-on-bgsave-error" 82) "yes" 83) "daemonize" 84) "no" 85) "rdbcompression" 86) "yes" 87) "rdbchecksum" 88) "yes" 89) "activerehashing" 90) "yes" 91) "repl-disable-tcp-nodelay" 92) "no" 93) "aof-rewrite-incremental-fsync" 94) "yes" 95) "aof-load-truncated" 96) "yes" 97) "appendonly" 98) "no" 99) "dir" 100) "/home/lxg/redis/redis-2.8.17/src" 101) "maxmemory-policy" 102) "volatile-lru" 103) "appendfsync" 104) "everysec" 105) "save" 106) "3600 1 300 100 60 10000" 107) "loglevel" 108) "notice" 109) "client-output-buffer-limit" 110) "normal 0 0 0 slave 268435456 67108864 60 pubsub 33554432 8388608 60" 111) "unixsocketperm" 112) "0" 113) "slaveof" 114) "" 115) "notify-keyspace-events" 116) "" 117) "bind" 118) ""