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
2d6eb689
Commit
2d6eb689
authored
Feb 07, 2014
by
antirez
Browse files
Sentinel: allow SHUTDOWN command in Sentinel mode.
parent
970de3e9
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/db.c
View file @
2d6eb689
...
@@ -605,11 +605,13 @@ void shutdownCommand(redisClient *c) {
...
@@ -605,11 +605,13 @@ void shutdownCommand(redisClient *c) {
return
;
return
;
}
}
}
}
/* SHUTDOWN
can be
called
even
while the server is
in "
loading
" state.
/*
When
SHUTDOWN
is
called while the server is loading
a dataset in
*
When this happens
we need to make sure no attempt is performed to save
*
memory
we need to make sure no attempt is performed to save
* the dataset on shutdown (otherwise it could overwrite the current DB
* the dataset on shutdown (otherwise it could overwrite the current DB
* with half-read data). */
* with half-read data).
if
(
server
.
loading
)
*
* Also when in Sentinel mode clear the SAVE flag and force NOSAVE. */
if
(
server
.
loading
||
server
.
sentinel_mode
)
flags
=
(
flags
&
~
REDIS_SHUTDOWN_SAVE
)
|
REDIS_SHUTDOWN_NOSAVE
;
flags
=
(
flags
&
~
REDIS_SHUTDOWN_SAVE
)
|
REDIS_SHUTDOWN_NOSAVE
;
if
(
prepareForShutdown
(
flags
)
==
REDIS_OK
)
exit
(
0
);
if
(
prepareForShutdown
(
flags
)
==
REDIS_OK
)
exit
(
0
);
addReplyError
(
c
,
"Errors trying to SHUTDOWN. Check logs."
);
addReplyError
(
c
,
"Errors trying to SHUTDOWN. Check logs."
);
...
...
src/redis.c
View file @
2d6eb689
...
@@ -2190,7 +2190,8 @@ int prepareForShutdown(int flags) {
...
@@ -2190,7 +2190,8 @@ int prepareForShutdown(int flags) {
}
}
/* Close the listening sockets. Apparently this allows faster restarts. */
/* Close the listening sockets. Apparently this allows faster restarts. */
closeListeningSockets
(
1
);
closeListeningSockets
(
1
);
redisLog
(
REDIS_WARNING
,
"Redis is now ready to exit, bye bye..."
);
redisLog
(
REDIS_WARNING
,
"%s is now ready to exit, bye bye..."
,
server
.
sentinel_mode
?
"Sentinel"
:
"Redis"
);
return
REDIS_OK
;
return
REDIS_OK
;
}
}
...
...
src/sentinel.c
View file @
2d6eb689
...
@@ -377,7 +377,8 @@ struct redisCommand sentinelcmds[] = {
...
@@ -377,7 +377,8 @@ struct redisCommand sentinelcmds[] = {
{
"unsubscribe"
,
unsubscribeCommand
,
-
1
,
""
,
0
,
NULL
,
0
,
0
,
0
,
0
,
0
},
{
"unsubscribe"
,
unsubscribeCommand
,
-
1
,
""
,
0
,
NULL
,
0
,
0
,
0
,
0
,
0
},
{
"psubscribe"
,
psubscribeCommand
,
-
2
,
""
,
0
,
NULL
,
0
,
0
,
0
,
0
,
0
},
{
"psubscribe"
,
psubscribeCommand
,
-
2
,
""
,
0
,
NULL
,
0
,
0
,
0
,
0
,
0
},
{
"punsubscribe"
,
punsubscribeCommand
,
-
1
,
""
,
0
,
NULL
,
0
,
0
,
0
,
0
,
0
},
{
"punsubscribe"
,
punsubscribeCommand
,
-
1
,
""
,
0
,
NULL
,
0
,
0
,
0
,
0
,
0
},
{
"info"
,
sentinelInfoCommand
,
-
1
,
""
,
0
,
NULL
,
0
,
0
,
0
,
0
,
0
}
{
"info"
,
sentinelInfoCommand
,
-
1
,
""
,
0
,
NULL
,
0
,
0
,
0
,
0
,
0
},
{
"shutdown"
,
shutdownCommand
,
-
1
,
""
,
0
,
NULL
,
0
,
0
,
0
,
0
,
0
}
};
};
/* This function overwrites a few normal Redis config default with Sentinel
/* This function overwrites a few normal Redis config default with Sentinel
...
...
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