diff --git a/src/config.c b/src/config.c index 2a692ac8fa..1298819a98 100644 --- a/src/config.c +++ b/src/config.c @@ -3100,6 +3100,7 @@ standardConfig static_configs[] = { /* SDS Configs */ createSDSConfig("primaryauth", "masterauth", MODIFIABLE_CONFIG | SENSITIVE_CONFIG, EMPTY_STRING_IS_NULL, server.primary_auth, NULL, NULL, NULL), createSDSConfig("requirepass", NULL, MODIFIABLE_CONFIG | SENSITIVE_CONFIG, EMPTY_STRING_IS_NULL, server.requirepass, NULL, NULL, updateRequirePass), + createSDSConfig("availability-zone", NULL, MODIFIABLE_CONFIG, 0, server.sdsAvailabilityZone, "", NULL, NULL), /* Enum Configs */ createEnumConfig("supervised", NULL, IMMUTABLE_CONFIG, supervised_mode_enum, server.supervised_mode, SUPERVISED_NONE, NULL, NULL), diff --git a/src/server.c b/src/server.c index fe522b3e5d..b6e64d1ba5 100644 --- a/src/server.c +++ b/src/server.c @@ -5381,7 +5381,8 @@ sds genValkeyInfoString(dict *section_dict, int all_sections, int everything) { "lru_clock:%u\r\n", server.lruclock, "executable:%s\r\n", server.executable ? server.executable : "", "config_file:%s\r\n", server.configfile ? server.configfile : "", - "io_threads_active:%i\r\n", server.io_threads_active)); + "io_threads_active:%i\r\n", server.io_threads_active, + "availability_zone:%s\r\n", server.sdsAvailabilityZone)); /* clang-format on */ /* Conditional properties */ diff --git a/src/server.h b/src/server.h index a12f091ba9..8e360ed8e4 100644 --- a/src/server.h +++ b/src/server.h @@ -2121,6 +2121,7 @@ struct valkeyServer { is down, doesn't affect pubsub global. */ long reply_buffer_peak_reset_time; /* The amount of time (in milliseconds) to wait between reply buffer peak resets */ int reply_buffer_resizing_enabled; /* Is reply buffer resizing enabled (1 by default) */ + sds sdsAvailabilityZone; /* When run in a cloud environment we can configure the availability zone it is running in */ /* Local environment */ char *locale_collate; }; diff --git a/valkey.conf b/valkey.conf index 05301d1bee..4593a49349 100644 --- a/valkey.conf +++ b/valkey.conf @@ -2319,3 +2319,9 @@ jemalloc-bg-thread yes # to suppress # # ignore-warnings ARM64-COW-BUG + +# Inform Valkey of the availability zone if running in a cloud environment. Currently +# this is only exposed via the info command for clients to use, but in the future we +# we may also use this when making decisions for replication. +# +# availability-zone "us-east-1a" \ No newline at end of file