redis安装与配置

Redis 安装与配置

Window 下安装

1. 下载地址:https://github.com/MSOpenTech/redis/releases

这里我们下载 Redis-x64-xxx.zip

  

2. 解压到指定目录: 

3. 打开命令行(cmd)跳转至解压路径,并运行安装命令,结果如图

C:Usersqizhuang>d:
D:>cd java
D:java>cd redis
D:java edis>redis-server.exe redis.windows.conf

4. 此cmd窗口不要关闭,表示redis服务正在运行;开启新的cmd窗口访问redis服务,如图

C:Usersqizhuang>redis-cli.exe -h 127.0.0.1 -p 6379

 Redis配置

   通过 CONFIG 命令查看或设置配置项,语法如下

  get语法:

redis 127.0.0.1:6379> CONFIG GET CONFIG_SETTING_NAME

  set语法

redis 127.0.0.1:6379> CONFIG SET CONFIG_SETTING_NAME NEW_CONFIG_VALUE

  示例

 配置日志级别

redis 127.0.0.1:6379> CONFIG SET loglevel "notice"
OK
redis 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) ""
 13) "maxmemory"
 14) "0"
 15) "maxmemory-samples"
 16) "5"
 17) "timeout"
 18) "0"
 19) "auto-aof-rewrite-percentage"
 20) "100"
 21) "auto-aof-rewrite-min-size"
 22) "67108864"
 23) "hash-max-ziplist-entries"
 24) "512"
 25) "hash-max-ziplist-value"
 26) "64"
 27) "list-max-ziplist-size"
 28) "-2"
 29) "list-compress-depth"
 30) "0"
 31) "set-max-intset-entries"
 32) "512"
 33) "zset-max-ziplist-entries"
 34) "128"
 35) "zset-max-ziplist-value"
 36) "64"
 37) "hll-sparse-max-bytes"
 38) "3000"
 39) "lua-time-limit"
 40) "5000"
 41) "slowlog-log-slower-than"
 42) "10000"
 43) "latency-monitor-threshold"
 44) "0"
 45) "slowlog-max-len"
 46) "128"
 47) "port"
 48) "6379"
 49) "tcp-backlog"
 50) "511"
 51) "databases"
 52) "16"
 53) "repl-ping-slave-period"
 54) "10"
 55) "repl-timeout"
 56) "60"
 57) "repl-backlog-size"
 58) "1048576"
 59) "repl-backlog-ttl"
 60) "3600"
 61) "maxclients"
 62) "10000"
 63) "watchdog-period"
 64) "0"
 65) "slave-priority"
 66) "100"
 67) "min-slaves-to-write"
 68) "0"
 69) "min-slaves-max-lag"
 70) "10"
 71) "hz"
 72) "10"
 73) "cluster-node-timeout"
 74) "15000"
 75) "cluster-migration-barrier"
 76) "1"
 77) "cluster-slave-validity-factor"
 78) "10"
 79) "repl-diskless-sync-delay"
 80) "5"
 81) "tcp-keepalive"
 82) "0"
 83) "cluster-require-full-coverage"
 84) "yes"
 85) "no-appendfsync-on-rewrite"
 86) "no"
 87) "slave-serve-stale-data"
 88) "yes"
 89) "slave-read-only"
 90) "yes"
 91) "stop-writes-on-bgsave-error"
 92) "yes"
 93) "daemonize"
 94) "no"
 95) "rdbcompression"
 96) "yes"
 97) "rdbchecksum"
 98) "yes"
 99) "activerehashing"
100) "yes"
101) "protected-mode"
102) "yes"
103) "repl-disable-tcp-nodelay"
104) "no"
105) "repl-diskless-sync"
106) "no"
107) "aof-rewrite-incremental-fsync"
108) "yes"
109) "aof-load-truncated"
110) "yes"
111) "maxmemory-policy"
112) "noeviction"
113) "loglevel"
114) "notice"
115) "supervised"
116) "no"
117) "appendfsync"
118) "everysec"
119) "appendonly"
120) "no"
121) "dir"
122) "D:\java\redis"
123) "save"
124) "jd 900 jd 300 jd 60"
125) "client-output-buffer-limit"
126) "normal 0 0 0 slave 268435456 67108864 60 pubsub 33554432 8388608 60"
127) "unixsocketperm"
128) "0"
129) "slaveof"
130) ""
131) "notify-keyspace-events"
132) ""
133) "bind"
134) "127.0.0.1"
原文地址:https://www.cnblogs.com/yelao/p/9447123.html