Step 1
First let’s create and configure the primary instance. We’ll start with a few configuration changes in its primary.conf configuration file.
Now open the primary.conf file with your favorite text editor and set the following configuration directives:
Finally, let’s start the primary instance:
Step 2
Next, let’s prepare the configuration file for the replica:
And let’s start the replica:
Step 3
Open two terminal tabs and use them to start connections to the primary and replica instances:
Authenticate on both tabs by running the command AUTH followed by your password:
On the second (replica) tab run the MONITOR command which will allow you to see every command executed against that instance.
Go back to the first (primary) tab and execute any write command, for example
In the second tab you should see that the command was already sent to the replica:
Step 4
Keep the instances running, or at least their configuration files around. We’ll need them for the next exercise.