REPLCONF clarification

Stage #eh4

I noticed that we send the port that the replica is listening on but I was wondering how that is useful to the master if we dont have the host of the replica.

Hi @shreyasganesh0, you can retrieve the host and port of clients or replicas this way:

async def client_req_resp(self, reader, writer) -> None:
    client_host, client_port = writer.get_extra_info('peername')

Thanks but I more meant it as a question about why the replica sends the port number over in the replconf message

To be honest, I wasn’t entirely sure, so here’s what I did to find out:

  1. Searched for “listening-port” in the redis repo. It’s saved as slave_listening_port.

  1. Then searched for “slave_listening_port”. Turns out it’s mainly used for logging purposes:

Ah that makes sense you live and you learn thanks for looking it up!

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.