Database Clustering Tutorial 7 – Passwordless SSH

In this blog, we will be setting up passwordless SSH in our virtual machines.

In order for ClusterControl to work, it must be able to communicate seamlessly with all of the nodes in a cluster. Passwordless SSH will allow this to happen.  This blog will guide you through the process, but there is also a video that might be easier to follow for this complex process. Whichever floats your boat!



Before we begin, have all three of your virtual machines up and running, and, to make it things a little easier on you, change the backrounds of each so that you can easily distinguish between them.

Getting the IP Addresses

The first thing we need to do is get the IP addresses of all three virtual machines.

We will start with the machine that will be running ClusterControl. Our goal is to see if we can communicate with all of the other machines.

Open a terminal and run:




Look at the the second grouping (or second network card) and find the inet addr.

You will see a group of numbers which is the machine’s IP address.

Do this on all machines to get the IP address of each machine.

Setting up Passwordless SSH

Now, from the the ClusterControl machine, we need to run some commands to connect to all of the other machines.

The first command to run is:



Once you press ENTER and then press ENTER a couple more times for the questions it asks you, it will create some files inside of a hidden ssh folder.

To see these files in the hidden folder, run:



Inside of this, you will see two files.

The first file is id_rsa. This is a private key that you will keep on this machine.

The second file is id_rsa.pub. This file contains a public key that you will put on the other machines.

When you try to connect to the other machines, the computer will use these two keys to see if you have access.

Installing the Public Key

What we need to do now is put the public key (id_rsa.pub) on all three machines. The easiest way to do this is to run a command with the IP address of one of the other machines. The command is:



And then follow this with the IP address of one of the other machines

For example, one of my machines has an IP address of 10.71.34.104. So, in this case, I would run:



After you run this command, it will ask you to give the password of this other machine. Thankfully, all our machines have the same user and password, which is necessary for ClusterCuntrol. So, give the password and then press ENTER.

Now, repeat this process for the other two machines, including the machine you’re currently using that ClusterControl will be installed on. Yes, this machine will need to be able to connect to itself through SSH. It may seem a little weird to run the command using the IP address of the machine you’re currently using, but this is how it is done.

Verifying that the SSH works

To verify that it works, type:



Followed by the IP address of one of the other machines, and then run this as a command.

Once you run this, it will connect to this machine. 

Now, other than some out-put that will show up, it will look like nothing has changed. This is because the username is exactly the same for each machine. So, the username will not change even when we are connected to one of the other machines.

We can exit this by holding ctrl and pressing d.

Now do this for each virtual machine, including the one you are currently using.

If you can connect to each machine and each time it shows you some out-put but does not change the user name, then passwordless SSH is working and ready to go!

Conclusion

Now that we have all the communication set up, we can finally install ClusterControl.  I will be explaining this in the next blog!

Leave a Reply

Your email address will not be published. Required fields are marked *