Vagrant will handle Virtual Machines for the cluster. The script uses Ubuntu Xenial 64-bit image.
- Vagrant installed on host machine
- Generated SSH keys on host machine
ssh-keygen
In Vagrantfile set variables:
- CLUSTER_SIZE - number of VMs to create (default 4)
- SSH_PRIVATE_KEY - path to host SSH private key (default ~/.ssh/id_rsa)
- SSH_PUBLIC_KEY - path to host SSH public key (default ~/.ssh/id_rsa.pub)
Each VM will be configured in following way:
- hostname set to node{i}, e.g. node1
- private network IP address set to 10.240.0.2{i}, e.g. 10.240.0.21
where {i} is subsequent number of VM from 1 to CLUSTER_SIZE
To start VMs execute command:
vagrant up
To start specific VMs provide their names to the command:
vagrant up node1 node2
To get a status of VMs run:
vagrant status
This command will return similar output:
Current machine states:
node1 running (virtualbox)
node2 running (virtualbox)
node3 running (virtualbox)
node4 running (virtualbox)
This environment represents multiple VMs. The VMs are all listed above with their current state.
For more information about a specific VM, run `vagrant status NAME`.
To connect to a running VM via SSH run:
vagrant ssh node1
To tear down Virtual Machines run:
vagrant destroy
To destroy specific VMs provide their names to the command:
vagrant destroy node1 node2
For more Vagrant commands visit Vagrant Docs Command-Line Interface