I’m stuck on Replication Stage #3. I am using C++.
In previous stages, I have not encountered this error as I suppose the SO_REUSEADDR set to 1 solves the problem. But in this case, I get errors. See logs below:
Here are my logs:
[replication-2] client: Received bytes: "$11\r\nrole:master\r\n"
[replication-2] client: Received RESP value: "role:master"
[replication-2] Received "role:master"
[replication-2] Found role:master in response.
[replication-2] Test passed.
[replication-2] Terminating program
[replication-2] Program terminated successfully
[replication-3] Running tests for Replication > Stage #3: The INFO command on a replica
[replication-3] This failure most likely means that your server didn't use the SO_REUSEADDR socket option while starting the server in the previous stage. SO_REUSEADDR is required to reuse previous sockets which were bound on the same address. Try setting the SO_REUSEADDR flag when creating your TCP server.
[replication-3] Error starting TCP server: listen tcp :6379: bind: address already in use
[replication-3] Test failed