multi-machine SSH

Now that your machines are up and running, you may want to SSH into them to make and test some changes. To do this, we can run the vagrant ssh command. This will give us an error, as shown in the following screenshot:

Here, we must specify a machine name, otherwise the ssh command won't know which machine we want to connect to. The names to supply are the ones we defined in the Vagrantfile, for example, lb1, web1, or web2. Let's now SSH into the load balancing machine by running the vagrant ssh lb1 command, as follows:

You can now manage each machine individually via SSH.

Let's complete the machine life cycle by halting and destroying the machines. We can halt all three machines by running the vagrant halt command, as shown in the following screenshot:

Next, if you wish to do so, you can destroy your machines to free up system memory. Run the vagrant destroy -f command. In our example, we are using the -f flag to force the machines' destruction; otherwise, we will be prompted for confirmation for each machine. Run the following command:

As you can see in the preceding screenshot, the command tells Vagrant to loop through each machine and destroy them.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.105.215