Connecting to server when running vagrant on macOS

Here is what I did on a new Mac OSX to get Aerospike server up and running.

1 - Install Vagrant Install | Vagrant | HashiCorp Developer MacOSX → vagrant.1.91.1.dmg Open .dmg, click on Vagrant.pkg and install via the popup window it opens.

Open a terminal shell. Check if vagrant is installed.

$ which vagrant /usr/local/bin/vagrant

2 - Download and install oracle virtualbox. Downloads – Oracle VM VirtualBox VirtualBox 5.1.12-11.dmg is downloaded when you click on OS X hosts hyperlink. Open .dmg and double click on VirtualBox.pkg. Follow the installation instructions in the popup window.
You can run the VirtualBox application from Applications folder.

3 - Create working directory and Download Aerospike image.

cd ~ $ mkdir aerospike-vm $ cd aerospike-vm/ $ vagrant init aerospike/centos-6.5 A Vagrantfile has been placed in this directory. You are now ready to vagrant up your first virtual environment! Please read the comments in the Vagrantfile as well as documentation on vagrantup.com for more information on using Vagrant. $vagrant up (Uses VirtualBox as the default box provider. Check startup messages to see which port on Mac is being forwarded to port 3000 that aerospike is listening on.) Actual output on my mac: Bringing machine ‘default’ up with ‘virtualbox’ provider… ==> default: Box ‘aerospike/centos-6.5’ could not be found. Attempting to find and install… default: Box Provider: virtualbox default: Box Version: >= 0 ==> default: Loading metadata for box ‘aerospike/centos-6.5’ default: URL: https://atlas.hashicorp.com/aerospike/centos-6.5 ==> default: Adding box ‘aerospike/centos-6.5’ (v3.10.1.1) for provider: virtualbox default: Downloading: https://atlas.hashicorp.com/aerospike/boxes/centos-6.5/versions/3.10.1.1/providers/virtualbox.box ==> default: Successfully added box ‘aerospike/centos-6.5’ (v3.10.1.1) for ‘virtualbox’! ==> default: Importing base box ‘aerospike/centos-6.5’… ==> default: Matching MAC address for NAT networking… ==> default: Checking if box ‘aerospike/centos-6.5’ is up to date… ==> default: Setting the name of the VM: aerospike-vm_default_1483493148894_93128 ==> default: Clearing any previously set network interfaces… ==> default: Found default DHCP server from initial VirtualBox install. Cleaning it up… ==> default: Preparing network interfaces based on configuration… default: Adapter 1: nat default: Adapter 2: hostonly ==> default: Forwarding ports… default: 3000 (guest) => 3000 (host) (adapter 1) default: 8081 (guest) => 8081 (host) (adapter 1) default: 22 (guest) => 2222 (host) (adapter 1) ==> default: Running ‘pre-boot’ VM customizations… ==> default: Booting VM… ==> default: Waiting for machine to boot. This may take a few minutes… default: SSH address: 127.0.0.1:2222 default: SSH username: vagrant default: SSH auth method: private key default: Warning: Remote connection disconnect. Retrying… ==> default: Machine booted and ready! ==> default: Checking for guest additions in VM… default: The guest additions on this VM do not match the installed version of default: VirtualBox! In most cases this is fine, but in rare cases it can default: prevent things such as shared folders from working properly. If you see default: shared folder errors, please make sure the guest additions within the default: virtual machine match the version of VirtualBox you have installed on default: your host and reload your VM. default: default: Guest Additions Version: 5.0.20 default: VirtualBox Version: 5.1 ==> default: Configuring and enabling network interfaces… ==> default: Mounting shared folders…

To find the ip address of the server do (in a terminal on your mac):

$vagrant ssh -c “ip addr”|grep ‘global eth1’ inet 172.28.128.3/24 brd 172.28.128.255 scope global eth1 Connection to 127.0.0.1 closed.

Now I can see the AMC dashboard on my browser in the Mac at: http://172.28.128.3:8081

I see an Aerospike server running with 2GB RAM and 5GB disk.

However, if you want to be inside the VM to do client side development, you can do:

$vagrant ssh

This will take you in the vm where you can install various clients and develop.

If you want your client to be on the Mac, then you will have to install client libraries on Mac and then connect to Aerospike Server on the vm.

Here is the prompt after I type vagrant ssh:

[vagrant@localhost ~]$ pwd /home/vagrant [vagrant@localhost ~]$ ls ClientInstall [vagrant@localhost ~]$ ls ClientInstall/ as_c_install.sh as_java_install.sh as_nodejs_install.sh as_python_install.sh [vagrant@localhost ~]$

Now you can do whatever modifications you want to the server and install and develop in the clients. When done,

$logout of the ssh and then do $vagrant halt