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
4005fef1
Commit
4005fef1
authored
Apr 02, 2010
by
antirez
Browse files
Now PUBLISH commands are replicated to slaves
parent
8bca8773
Changes
2
Hide whitespace changes
Inline
Side-by-side
redis.c
View file @
4005fef1
...
...
@@ -111,6 +111,7 @@
config file and the server is using more than maxmemory bytes of memory.
In short this commands are denied on low memory conditions. */
#define REDIS_CMD_DENYOOM 4
#define REDIS_CMD_FORCE_REPLICATION 8
/* Force replication even if dirty is 0 */
/* Object types */
#define REDIS_STRING 0
...
...
@@ -829,7 +830,7 @@ static struct redisCommand cmdTable[] = {
{
"unsubscribe"
,
unsubscribeCommand
,
-
1
,
REDIS_CMD_INLINE
,
NULL
,
0
,
0
,
0
},
{
"psubscribe"
,
psubscribeCommand
,
-
2
,
REDIS_CMD_INLINE
,
NULL
,
0
,
0
,
0
},
{
"punsubscribe"
,
punsubscribeCommand
,
-
1
,
REDIS_CMD_INLINE
,
NULL
,
0
,
0
,
0
},
{
"publish"
,
publishCommand
,
3
,
REDIS_CMD_BULK
,
NULL
,
0
,
0
,
0
},
{
"publish"
,
publishCommand
,
3
,
REDIS_CMD_BULK
|
REDIS_CMD_FORCE_REPLICATION
,
NULL
,
0
,
0
,
0
},
{
NULL
,
NULL
,
0
,
0
,
NULL
,
0
,
0
,
0
}
};
...
...
@@ -2120,9 +2121,12 @@ static void call(redisClient *c, struct redisCommand *cmd) {
dirty
=
server
.
dirty
;
cmd
->
proc
(
c
);
if
(
server
.
appendonly
&&
server
.
dirty
-
dirty
)
dirty
=
server
.
dirty
-
dirty
;
if
(
server
.
appendonly
&&
dirty
)
feedAppendOnlyFile
(
cmd
,
c
->
db
->
id
,
c
->
argv
,
c
->
argc
);
if
(
server
.
dirty
-
dirty
&&
listLength
(
server
.
slaves
))
if
((
dirty
||
cmd
->
flags
&
REDIS_CMD_FORCE_REPLICATION
)
&&
listLength
(
server
.
slaves
))
replicationFeedSlaves
(
server
.
slaves
,
c
->
db
->
id
,
c
->
argv
,
c
->
argc
);
if
(
listLength
(
server
.
monitors
))
replicationFeedSlaves
(
server
.
monitors
,
c
->
db
->
id
,
c
->
argv
,
c
->
argc
);
...
...
redis.conf
View file @
4005fef1
...
...
@@ -133,7 +133,7 @@ dir ./
# happens this is the preferred way to run Redis. If instead you care a lot
# about your data and don't want to that a single record can get lost you should
# enable the append only mode: when this mode is enabled Redis will append
# every write operation received in the file appendonly.
log
. This file will
# every write operation received in the file appendonly.
aof
. This file will
# be read on startup in order to rebuild the full dataset in memory.
#
# Note that you can have both the async dumps and the append only file if you
...
...
@@ -141,7 +141,7 @@ dir ./
# Still if append only mode is enabled Redis will load the data from the
# log file at startup ignoring the dump.rdb file.
#
# The name of the append only file is "appendonly.
log
"
# The name of the append only file is "appendonly.
aof
"
#
# IMPORTANT: Check the BGREWRITEAOF to check how to rewrite the append
# log file in background when it gets too big.
...
...
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