windows下的环境搭建配置redis.docx
- 文档编号:1608852
- 上传时间:2023-05-01
- 格式:DOCX
- 页数:48
- 大小:80.38KB
windows下的环境搭建配置redis.docx
《windows下的环境搭建配置redis.docx》由会员分享,可在线阅读,更多相关《windows下的环境搭建配置redis.docx(48页珍藏版)》请在冰点文库上搜索。
windows下的环境搭建配置redis
下载地址:
下载下来的包里有两个,
一个是32位的,一个是64位的。
根据自己的实情情况选择,我的是32bit,
把这个文件夹复制到其它地方,比如D:
\redis目录下。
打开一个cmd窗口 使用cd命令切换目录到d:
\redis 运行redis-server.exeredis.conf
如果想方便的话,可以把redis的路径加到系统的环境变量里,这样就省得再输路径了,后面的那个redis.conf可以省略,如果省略,会启用默认的。
输入之后,会显示如下界面:
这时候别启一个cmd窗口,原来的不要关闭,不然就无法访问服务端了
切换到redis目录下运行redis-cli.exe-h127.0.0.1-p6379出现下图:
这时候,就已经完成配置了,现在说下它的的redis.conf配置文件。
[plain] viewplaincopy
1.001
2.# Redis configuration file example
3.002
4.
5.003
6.# Note on units:
when memory size is needed, it is possible to specifiy
7.004
8.# it in the usual form of 1k 5GB 4M and so forth:
9.005
10.#
11.006
12.# 1k => 1000 bytes
13.007
14.# 1kb => 1024 bytes
15.008
16.# 1m => 1000000 bytes
17.009
18.# 1mb => 1024*1024 bytes
19.010
20.# 1g => 1000000000 bytes
21.011
22.# 1gb => 1024*1024*1024 bytes
23.012
24.#
25.013
26.# units are case insensitive so 1GB 1Gb 1gB are all the same.
27.014
28.
29.015
30.# By default Redis does not run as a daemon. Use 'yes' if you need it.
31.016
32.# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
33.017
34.daemonize no
35.018
36.Redis默认不是以守护进程的方式运行,可以通过该配置项修改,使用yes启用守护进程
37.019
38.
39.020
40.# When running daemonized, Redis writes a pid file in /var/run/redis.pid by
41.021
42.# default. You can specify a custom pid file location here.
43.022
44.pidfile /var/run/redis.pid
45.023
46.当Redis以守护进程方式运行时,Redis默认会把pid写入/var/run/redis.pid文件,可以通过pidfile指定
47.024
48.# Accept connections on the specified port, default is 6379.
49.025
50.# If port 0 is specified Redis will not listen on a TCP socket.
51.026
52.port 6379
53.027
54.指定Redis监听端口,默认端口为6379
55.028
56.# If you want you can bind a single interface, if the bind option is not
57.029
58.# specified all the interfaces will listen for incoming connections.
59.030
60.#
61.031
62.# bind 127.0.0.1
63.032
64.绑定的主机地址
65.033
66.# Specify the path for the unix socket that will be used to listen for
67.034
68.# incoming connections. There is no default, so Redis will not listen
69.035
70.# on a unix socket when not specified.
71.036
72.#
73.037
74.# unixsocket /tmp/redis.sock
75.038
76.# unixsocketperm 755
77.039
78.
79.040
80.# Close the connection after a client is idle for N seconds (0 to disable)
81.041
82.timeout 0
83.042
84.当 客户端闲置多长时间后关闭连接,如果指定为0,表示关闭该功能
85.043
86.# Set server verbosity to 'debug'
87.044
88.# it can be one of:
89.045
90.# debug (a lot of information, useful for development/testing)
91.046
92.# verbose (many rarely useful info, but not a mess like the debug level)
93.047
94.# notice (moderately verbose, what you want in production probably)
95.048
96.# warning (only very important / critical messages are logged)
97.049
98.loglevel verbose
99.050
100.指定日志记录级别,Redis总共支持四个级别:
debug、verbose、notice、warning,默认为verbose
101.051
102.# Specify the log file name. Also 'stdout' can be used to force
103.052
104.# Redis to log on the standard output. Note that if you use standard
105.053
106.# output for logging but daemonize, logs will be sent to /dev/null
107.054
108.logfile stdout
109.055
110.日志记录方式,默认为标准输出,如果配置Redis为守护进程方式运行,而这里又配置为日志记录方式为标准输出,则日志将会发送给/dev/null
111.056
112.# To enable logging to the system logger, just set 'syslog-enabled' to yes,
113.057
114.# and optionally update the other syslog parameters to suit your needs.
115.058
116.# syslog-enabled no
117.059
118.
119.060
120.# Specify the syslog identity.
121.061
122.# syslog-ident redis
123.062
124.
125.063
126.# Specify the syslog facility. Must be USER or between LOCAL0-LOCAL7.
127.064
128.# syslog-facility local0
129.065
130.
131.066
132.# Set the number of databases. The default database is DB 0, you can select
133.067
134.# a different one on a per-connection basis using SELECT
135.068
136.# dbid is a number between 0 and 'databases'-1
137.069
138.databases 16
139.070
140.设置数据库的数量,默认数据库为0,可以使用SELECT
141.071
142.################################ SNAPSHOTTING #################################
143.072
144.#
145.073
146.# Save the DB on disk:
147.074
148.#
149.075
150.# save
151.076
152.#
153.077
154.# Will save the DB if both the given number of seconds and the given
155.078
156.# number of write operations against the DB occurred.
157.079
158.#
159.080
160.# In the example below the behaviour will be to save:
161.081
162.# after 900 sec (15 min) if at least 1 key changed
163.082
164.# after 300 sec (5 min) if at least 10 keys changed
165.083
166.# after 60 sec if at least 10000 keys changed
167.084
168.#
169.085
170.# Note:
you can disable saving at all commenting all the "save" lines.
171.086
172.
173.087
174.save 900 1
175.088
176.save 300 10
177.089
178.save 60 10000
179.090
180.分别表示900秒(15分钟)内有1个更改,300秒(5分钟)内有10个更改以及60秒内有10000个更改。
181.091
182.指定在多长时间内,有多少次更新操作,就将数据同步到数据文件,可以多个条件配合
183.092
184.# Compress string objects using LZF when dump .rdb databases?
185.093
186.# For default that's set to 'yes' as it's almost always a win.
187.094
188.# If you want to save some CPU in the saving child set it to 'no' but
189.095
190.# the dataset will likely be bigger if you have compressible values or keys.
191.096
192.rdbcompression yes
193.097
194.指定存储至本地数据库时是否压缩数据,默认为yes,Redis采用LZF压缩,如果为了节省CPU时间,可以关闭该选项,但会导致数据库文件变的巨大
195.098
196.# The filename where to dump the DB
197.099
198.dbfilename dump.rdb
199.100
200.指定本地数据库文件名,默认值为dump.rdb
201.101
202.# The working directory.
203.102
204.#
205.103
206.# The DB will be written inside this directory, with the filename specified
207.104
208.# above using the 'dbfilename' configuration directive.
209.105
210.#
211.106
212.# Also the Append Only File will be created inside this directory.
213.107
214.#
215.108
216.# Note that you must specify a directory here, not a file name.
217.109
218.dir ./
219.110
220.指定本地数据库存放目录
221.111
222.################################# REPLICATION #################################
223.112
224.
225.113
226.# Master-Slave replication. Use slaveof to make a Redis instance a copy of
227.114
228.# another Redis server. Note that the configuration is local to the slave
229.115
230.# so for example it is possible to configure the slave to save the DB with a
231.116
232.# different interval, or to listen to another port, and so on.
233.117
234.#
235.118
236.# slaveof
237.119
238.slaveof
239.120
240.# If the master is password protected (using the "requirepass" configuration
241.121
242.# directive below) it is possible to tell the slave to authenticate before
243.122
244.# starting the replication synchronization process, otherwise the master will
245.123
246.# refuse the slave request.
247.124
248.#
249.125
250.# masterauth
251.126
252.masterauth
253.127
254.# When a slave lost the connection with the master, or when the replication
255.128
256.# is still in progress, the slave can act in two different ways:
257.129
258.#
259.130
260.# 1) if slave-serve-stale-data is set to 'yes' (the default) the slave will
261.131
262.# still reply to client requests, possibly with out of data data, or the
263.132
264.# data set may just be empty if this is the first synchronization.
265.133
266.#
267.134
268.# 2) if slave-serve-stale data is set to 'no' the slave will reply with
269.135
270.# an error "SYNC with master in progress" to all the kind of commands
271.136
272.# but to INFO and SLAVEOF.
273.137
274.#
275.138
276.slave-serve-stale-data yes
277.139
278.
279.140
280.# Slaves send PINGs to server in a predefined interval. It's possible to change
281.141
282.# this interval with the repl_ping_slave_period option. The default value is 10
283.142
284.# seconds.
285.143
286.#
287.144
288.# repl-ping-slave-period 10
289.145
290.
291.146
292.# The following option sets a timeout for both Bulk transfer I/O timeout and
293.147
294.# master data or ping response timeout. The default value is 60 seconds.
295.148
296.#
297.149
298.# It is important to make sure that this value is greater than the value
299.150
300.# specified for repl-ping-slave-period otherwise a timeout will be detected
301.151
302.# every time there is low traffic between the master and the slave.
303.152
304.#
305.153
306.# repl-timeout 60
307.154
308.
309.155
310.################################## SECURITY ###################################
311.156
312.
313.157
314.# Require clients to issue AUTH
315.158
316.# commands. This might be useful in environments i
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- windows 环境 搭建 配置 redis