mirror of
https://github.com/fluencelabs/redis
synced 2025-06-13 17:21:20 +00:00
run_id added to INFO output.
The Run ID is a field that identifies a single execution of the Redis server. It can be useful for many purposes as it makes easy to detect if the instance we are talking about is the same, or if it is a different one or was rebooted. An application of run_id will be in the partial synchronization of replication, where a slave may request a partial sync from a given offset only if it is talking with the same master. Another application is in failover and monitoring scripts.
This commit is contained in:
@ -870,6 +870,8 @@ void createSharedObjects(void) {
|
||||
}
|
||||
|
||||
void initServerConfig() {
|
||||
getRandomHexChars(server.runid,REDIS_RUN_ID_SIZE);
|
||||
server.runid[REDIS_RUN_ID_SIZE] = '\0';
|
||||
server.arch_bits = (sizeof(long) == 8) ? 64 : 32;
|
||||
server.port = REDIS_SERVERPORT;
|
||||
server.bindaddr = NULL;
|
||||
@ -1585,6 +1587,7 @@ sds genRedisInfoString(char *section) {
|
||||
"multiplexing_api:%s\r\n"
|
||||
"gcc_version:%d.%d.%d\r\n"
|
||||
"process_id:%ld\r\n"
|
||||
"run_id:%s\r\n"
|
||||
"tcp_port:%d\r\n"
|
||||
"uptime_in_seconds:%ld\r\n"
|
||||
"uptime_in_days:%ld\r\n"
|
||||
@ -1600,6 +1603,7 @@ sds genRedisInfoString(char *section) {
|
||||
0,0,0,
|
||||
#endif
|
||||
(long) getpid(),
|
||||
server.runid,
|
||||
server.port,
|
||||
uptime,
|
||||
uptime/(3600*24),
|
||||
|
Reference in New Issue
Block a user