Add load-on-startup configuration parameter.
This commit is contained in:
@@ -37,6 +37,16 @@ background save operation to a specific file. This operation also doesn't
|
||||
modify the fields above.
|
||||
|
||||
|
||||
Additional Redis Configuration Parameters
|
||||
-----------------------------------------
|
||||
|
||||
load-on-startup
|
||||
Provides the ability to disable auto-loading of RDB/AOF files on startup,
|
||||
even if they exist. This is useful on slaves that would immediately need
|
||||
to replicate from masters anyway.
|
||||
|
||||
|
||||
|
||||
New/Modified Redis Commands
|
||||
---------------------------
|
||||
|
||||
|
||||
@@ -130,6 +130,9 @@ dbfilename dump.rdb
|
||||
# specified, this is the same as dbfilename.
|
||||
syncdbfilename sync.rdb
|
||||
|
||||
# Determine if redis should load rdb or aof when available on startup
|
||||
load-on-startup yes
|
||||
|
||||
# The working directory.
|
||||
#
|
||||
# The DB will be written inside this directory, with the filename specified
|
||||
|
||||
@@ -256,6 +256,10 @@ void loadServerConfigFromString(char *config) {
|
||||
if ((server.daemonize = yesnotoi(argv[1])) == -1) {
|
||||
err = "argument must be 'yes' or 'no'"; goto loaderr;
|
||||
}
|
||||
} else if (!strcasecmp(argv[0],"load-on-startup") && argc == 2) {
|
||||
if ((server.load_on_startup = yesnotoi(argv[1])) == -1) {
|
||||
err = "argument must be 'yes' or 'no'"; goto loaderr;
|
||||
}
|
||||
} else if (!strcasecmp(argv[0],"conditional-sync") && argc == 2) {
|
||||
if ((server.conditional_sync = yesnotoi(argv[1])) == -1) {
|
||||
err = "argument must be 'yes' or 'no'"; goto loaderr;
|
||||
|
||||
+3
-1
@@ -1102,6 +1102,7 @@ void initServerConfig() {
|
||||
server.syslog_ident = zstrdup("redis");
|
||||
server.syslog_facility = LOG_LOCAL0;
|
||||
server.daemonize = 0;
|
||||
server.load_on_startup = 1;
|
||||
server.conditional_sync = 1;
|
||||
server.aof_state = REDIS_AOF_OFF;
|
||||
server.aof_fsync = AOF_FSYNC_EVERYSEC;
|
||||
@@ -2636,7 +2637,8 @@ int main(int argc, char **argv) {
|
||||
#ifdef __linux__
|
||||
linuxOvercommitMemoryWarning();
|
||||
#endif
|
||||
loadDataFromDisk();
|
||||
if (server.load_on_startup)
|
||||
loadDataFromDisk();
|
||||
if (server.ipfd > 0)
|
||||
redisLog(REDIS_NOTICE,"The server is now ready to accept connections on port %d", server.port);
|
||||
if (server.sofd > 0)
|
||||
|
||||
@@ -568,6 +568,7 @@ struct redisServer {
|
||||
size_t client_max_querybuf_len; /* Limit for client query buffer length */
|
||||
int dbnum; /* Total number of configured DBs */
|
||||
int daemonize; /* True if running as a daemon */
|
||||
int load_on_startup; /* True if server should load AOF/RDB on startup */
|
||||
int conditional_sync; /* Conditional synchronziation support */
|
||||
clientBufferLimitsConfig client_obuf_limits[REDIS_CLIENT_LIMIT_NUM_CLASSES];
|
||||
/* AOF persistence */
|
||||
|
||||
Reference in New Issue
Block a user