Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
1b677732
Commit
1b677732
authored
May 10, 2010
by
antirez
Browse files
CONFIG now can change appendfsync policy at run time
parent
a34e0a25
Changes
2
Hide whitespace changes
Inline
Side-by-side
redis.c
View file @
1b677732
...
...
@@ -1635,7 +1635,7 @@ static void initServerConfig() {
server
.
glueoutputbuf
=
1
;
server
.
daemonize
=
0
;
server
.
appendonly
=
0
;
server
.
appendfsync
=
APPENDFSYNC_
ALWAYS
;
server
.
appendfsync
=
APPENDFSYNC_
EVERYSEC
;
server
.
lastfsync
=
time
(
NULL
);
server
.
appendfd
=
-
1
;
server
.
appendseldb
=
-
1
;
/* Make sure the first time will not match */
...
...
@@ -9683,6 +9683,16 @@ static void configSetCommand(redisClient *c) {
server
.
masterauth
=
zstrdup
(
o
->
ptr
);
}
else
if
(
!
strcasecmp
(
c
->
argv
[
2
]
->
ptr
,
"maxmemory"
))
{
server
.
maxmemory
=
strtoll
(
o
->
ptr
,
NULL
,
10
);
}
else
if
(
!
strcasecmp
(
c
->
argv
[
2
]
->
ptr
,
"appendfsync"
))
{
if
(
!
strcasecmp
(
o
->
ptr
,
"no"
))
{
server
.
appendfsync
=
APPENDFSYNC_NO
;
}
else
if
(
!
strcasecmp
(
o
->
ptr
,
"everysec"
))
{
server
.
appendfsync
=
APPENDFSYNC_EVERYSEC
;
}
else
if
(
!
strcasecmp
(
o
->
ptr
,
"always"
))
{
server
.
appendfsync
=
APPENDFSYNC_ALWAYS
;
}
else
{
goto
badfmt
;
}
}
else
if
(
!
strcasecmp
(
c
->
argv
[
2
]
->
ptr
,
"save"
))
{
int
vlen
,
j
;
sds
*
v
=
sdssplitlen
(
o
->
ptr
,
sdslen
(
o
->
ptr
),
" "
,
1
,
&
vlen
);
...
...
@@ -9768,6 +9778,19 @@ static void configGetCommand(redisClient *c) {
addReplyBulkCString
(
c
,
buf
);
matches
++
;
}
if
(
stringmatch
(
pattern
,
"appendfsync"
,
0
))
{
char
*
policy
;
switch
(
server
.
appendfsync
)
{
case
APPENDFSYNC_NO
:
policy
=
"no"
;
break
;
case
APPENDFSYNC_EVERYSEC
:
policy
=
"everysec"
;
break
;
case
APPENDFSYNC_ALWAYS
:
policy
=
"always"
;
break
;
default:
policy
=
"unknown"
;
break
;
/* too harmless to panic */
}
addReplyBulkCString
(
c
,
"appendfsync"
);
addReplyBulkCString
(
c
,
policy
);
matches
++
;
}
if
(
stringmatch
(
pattern
,
"save"
,
0
))
{
sds
buf
=
sdsempty
();
int
j
;
...
...
redis.conf
View file @
1b677732
...
...
@@ -112,6 +112,10 @@ dir ./
#
# This should stay commented out for backward compatibility and because most
# people do not need auth (e.g. they run their own servers).
#
# Warning: since Redis is pretty fast an outside user can try up to
# 150k passwords per second against a good box. This means that you should
# use a very strong password otherwise it will be very easy to break.
#
# requirepass foobared
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment