-
Redis
windows
测试
redis
持久化功能
还需要在
redis
根目录增加一个<
/p>
redis
的配置文件
< br>,文件具体内容有:
1.
# Redis configuration file
example
2.
3.
#
By default Redis does not run as a daemon. Use
'yes' if you need it.
4.
# Note that
Redis will write a pid file in /var/run/ when
daem
onized.
5.
daemonize no
6.
7.
# When run as
a daemon, Redis write a pid file in /var/run/ by
default.
8.
# You can
specify a custom pid file location
here.
9.
pidfile /
var
/run/
10.
11.
#
Accept connections on the specified port, default
is 6379
12.
p
ort
6379
13.
14.
#
If you want you can bind a single interface, if
the bind option is not
15.
#
specified all the interfaces will listen for
connections.
16.
#
17.
#
bind 127.0.0.1
18.
19.
#
Close the connection after a client is idle for N
seconds (0 to disabl
e)
20.
t
imeout
300
21.
22.
#
Set server verbosity to 'debug'
23.
#
it can be one of:
24.
#
debug (a lot of information, useful for
development/testing)
25.
#
notice (moderately verbose, what you want in
production probably)
26.
#
warning (only very important / critical messages
are logged)
27.
l
oglevel debug
28.
29.
#
Specify the log file name. Also 'stdout' can be
used to force
30.
#
the demon to log on the
standard output. Note that if you use
standard
31.
#
output for logging but
daemonize, logs will be sent to
/dev/null
32.
l
ogfile stdout
33.
34.
#
Set the number of databases. The default database
is DB 0, you can sel
ect
35.
#
a different one on a per-connection basis using
SELECT
36.
#
dbid is a number between 0 and
'databases'-1
37.
d
atabases
16
38.
39.
#
###########################
#### SNAPSHOTTING ########################
#########
40.
#
41.
#
Save the DB on
disk:
42.
#
43.
#
save
44.
#
45.
#
Will save the DB if both
the given number of seconds and the
given
46.
#
number of write
operations against the DB occurred.
47.
#
48.
#
In the example below the behaviour will be to
save:
49.
#
after 900 sec (15 min)
if at least 1 key changed
50.
#
after 300 sec (5 min) if at least 10 keys
changed
51.
#
after 60 sec if at least
10000 keys changed
52.
s
ave
900
1
53.
s
ave
300
10
54.
s
ave
60
10000
55.
56.
#
Compress string objects using LZF when dump .rdb
databases?
57.
#
For default that's set to
'yes' as it's almost always a win.
58.
#
If you want to save some CPU in the saving child
set it to 'no' but
59.
#
the dataset will likely be bigger if you have
compressible values or k
eys.
60.
r
dbcompression yes
61.
62.
#
The filename where to dump the DB
63.
d
bfilename
64.
65.
#
For default save/load DB in/from the working
directory
66.
#
Note that you must specify
a directory not a file name.
67.
d
ir ./
68.
69.
#
#
############################### REPLICATION ######
###################
########
70.
71.
#
Master-Slave replication. Use slaveof to make a
Redis instance a copy
of
72.
#
another Redis server. Note that the configuration
is local to the sla
ve
73.
#
so for example it is possible to configure the
slave to save the DB wi
th a
74.
#
different interval, or to listen to another port,
and so on.
75.
#
76.
#
slaveof
77.
78.
#
If the master is password
protected (using the
ation
79.
#
directive below) it is possible to tell the slave
to authenticate bef
ore
80.
#
starting the replication synchronization process,
otherwise the maste
r will
81.
#
refuse the slave request.
82.
#
83.
#
masterauth
84.
85.
#
#
################################ SECURITY ########
###################
########
86.
87.
#
Require clients to issue AUTH
88.
#
commands. This might be useful in environments in
which you do not tr
ust
89.
#
others with access to the host running redis-
server.
90.
#
91.
#
This should stay commented
out for backward compatibility and
because
most
92.
#
people do not need auth (e.g. they run their own
servers).
93.
#
94.
#
requirepass
foobared
95.
96.
#
###########################
####### LIMITS ############################
########
97.
98.
#
Set the max number of
connected clients at the same time. By default
t
here
99.
#
is no limit, and it's up to the number of file
descriptors the Redis
p
rocess
100.
# is able to
open. The special value '0' means no
limts.
101.
102.
103.
104.
105.
106.
107.
108.
109.
110.
le.
111.
112.
mands
113.
114.
115.
116.
117.
118.
119.
120.
121.
122.
123.
124.
125.
126.
127.
# Once the
limit is reached Redis will close all the new
connecti
# an error 'max number of
clients reached'.
#
# maxclients
128
# Don't use
more memory than the specified amount of
bytes.
# When the memory
limit is reached Redis will try to remove keys
# EXPIRE set. It will try to start
freeing keys that are going to
# in
little time and preserve keys with a longer time
to live.
# Redis will also
try to remove objects from free lists if
possib
#
# If all
this fails, Redis will start to reply with errors
to com
# that will use more memory, like
SET, LPUSH, and so on, and will
# to
reply to most read-only commands like
GET.
#
# WARNING: maxmemory can be a good idea
mainly if you want to use
# 'state'
server or cache, not as a real DB. When Redis is
used a
# database the memory usage will
grow over the weeks, it will be
# it is
going to use too much memory in the long run, and
you'll
# to upgrade. With maxmemory
after the limit is reached you'll st
#
errors for write operations, and this may even
lead to DB incon
#
# maxmemory
############################## APPEND
ONLY MODE ################
# By default Redis asynchronously dumps
the dataset on disk. If y
ons
sending
with an
expire
continue
Redis as
a
s a real
obvious if
have
the time
art to
get
sistency.
###############
ou can live
128.
129.
130.
131.
132.
133.
ry.
134.
135.
136.
137.
138.
139.
140.
141.
142.
ppend
143.
144.
145.
146.
147.
148.
149.
150.
151.
152.
153.
154.
# with the
idea that the latest records will be lost if
something
# happens this is the
preferred way to run Redis. If instead you
# about your data and don't want to
that a single record can get
# enable
the append only mode: when this mode is enabled
Redis wi
# every write operation
received in the file . Thi
# be read on
startup in order to rebuild the full dataset in
memo
#
# Note that
you can have both the async dumps and the append
only
# like (you have to comment the
# Still if append only mode is enabled
Redis will load the data f
# log file at
startup ignoring the file.
#
# The name of
the append only file is
#
# IMPORTANT:
Check the BGREWRITEAOF to check how to rewrite the
a
# log file in background when it gets
too big.
appendonly yes
# The fsync() call tells the Operating
System to actually write d
# instead to
wait for more data in the output buffer. Some OS
wil
# data on disk, some other OS will
just try to do it ASAP.
#
# Redis
supports three different modes:
#
# no: don't
fsync, just let the OS flush the data when it
wants.
# always: fsync after every
write to the append only log . Slow,
like a crash
care a
lot
lost you
should
ll append
s file will
file
if you
e the
dumps).
rom the
ata on disk
l
really flush
Faster.
Safest.
155.
156.
157.
158.
159.
160.
161.
162.
163.
164.
165.
166.
167.
168.
169.
170.
171.
172.
173.
174.
ommon
175.
176.
177.
178.
179.
180.
181.
# everysec:
fsync only if one second passed since the last
fsync.
#
# The
default is
# understand if you can
relax this to
# or to
# it
want, for better performances (but if you can live
with the
# some data loss consider the
default persistence mode that's sn
appendfsync always
#
appendfsync everysec
#
appendfsync no
###############################
ADVANCED CONFIG ################
# Glue small output buffers together in
order to send small repli
# single TCP
packet. Uses a bit more CPU but most of the times
it
# in terms of number of queries per
second. Use 'yes' if unsure.
glueoutputbuf yes
# Use object sharing. Can save a lot of
memory if you have many c
# string in
your dataset, but performs lookups against the
share
# pool so it uses more CPU and can
be a bit slower. Usually it's
#
idea.
#
# When object sharing is enabled
(shareobjects yes) you can use
# shareobjectspoolsize to control the
size of the pool used in or
# object
sharing. A bigger pool size will lead to better
sharing
Compromise.
p to you to
every
second
buffer
when
idea of
apshotting).
###############
es in a
is a
win
d objects
a good
der to
try
capabilities.
-
-
-
-
-
-
-
-
-
上一篇:英语情景交际专项训练
下一篇:“It”作形式主语和形式宾语的用法详解