When you are interested in new technology it is critical to have a low cost environment readily available where you can learn and try things out. The best thing is to have it available right on your laptop and carry it in your backpack with you. HPE Vertica 8.0.0 was recently released and I wanted to play with some of the new features so I decided to set up a single-node Vertica cluster right on my MacBook Pro. I was successful and have a fully functional single-node Vertica cluster now.
Let me take you through the process if you want to have one for yourself.
If you want to have Vertica on your MacBook you should think about the following aspects:
- What kind of virtualization solution are you going to use?
- Which OS you will run as the guest in your VM?
- How do I install Vertica and build the Vertica database?
- How can I connect to my Vertica database?
- What do I need to keep my Vertica database healthy?
When I am going through the topics listed above I will tell you about the available options and will tell you what I did in my setup. This will enable you to choose your path yourself.
- if you have no preferences on any software you can just follow the instructions and have functional Vertica at the end;
- If you want to use specific software you can replace the one I use with the one you like. I assume that you already know how to use it and will be proficient enough to deal with any consequences.
Which virtualization solution to use?
There are a lot of options here. The big question to answer first is container vs VM. A lot of people are very excited about Docker. I have seen Vertica running in Docker, but as you probably already know Docker will force a number of limitations on you. The biggest one is saving your data. Docker is perfect to run stateless applications. However, a database will be the opposite of that. Any database is about having state, saving it in a reliable manner and having it available after reboot. Running stateful applications in a container is hard. If you are not a Docker expert and your focus is learning Vertica I will strongly advise to stick with traditional VM solution.
There are several virtualization options available for Mac. The most known are: Parallels Desktop, VMWare Fusion and Virtualbox. If you have one of those then use what you have already. I used VirtualBox for my setup, because I do not own a license for the commercial ones and VirtualBox is free. I run VirtualBox 5.1.8 (used VirtualBox-5.1.8-111374-OSX.dmg). VirtualBox download page is here.
Visit VirtualBox download page and click the link titled “OS X hosts″ in the “VirtualBox binaries” section. At the time I am writing this post, it is in the “VirtualBox 5.1.8 platform packages” subsection. VirtualBox install is very straight forward so I am not going to list steps here. All you need to do is open the .dmg file and run the installer. If you need instructions then Google is your friend.
Which OS should I use?
We have to choose one of the OSes supported by Vertica. Vertica 8.0 supports a long list of major Linux distributions. For a complete list refer to the Supported Operating Systems and Operating System Versions documentation page. For my install I have chosen Ubuntu 14.04 LTS. I had no special reasons. It just happens to be the distribution I work with most of the time right now.
On this step you need to to start VirtualBox, create VM and install Ubuntu Server as the guest OS. I am going to omit those steps. If you need instructions then you can find a lot of good blog posts on the Internet. Search for “Ubuntu on Mac Using VirtualBox”.
Note: The majority of posts will guide you into installing Ubuntu Desktop. I used Ubuntu Server 14.04 LTS in my install. If you want to match OS with what I have then search for ubuntu-14.04.4-server-amd64.iso
Installing Vertica and Building a Vertica Database
Detailed instructions for this step can be found in my previous post Installing a Single-Node HPE Vertica 8 Cluster on Ubuntu 14.04. Follow instructions and you will be fine.
Connecting to the Vertica Database
There are multiple methods to connect to Vertica database.
- Connect from admintools. When you are in the Main Menu of admintools you can select the “Connect to Database” menu item. If you are not authenticated yet you will be prompted for the dbadmin password, which you specified during the database creation.
- Connect using vsql from the terminal. The installer configures the user dbadmin so it will know how to find Vertica utilities. You can su to the dbadmin user and run vsql. You will be prompted for the dbadmin password, which you specified during the database creation.
- You also can connect to Vertica using the JDBC driver. Installation will place the current JDBC driver to /opt/vertica/java and will create a symbolic link vertica-jdbc.jar to the current version of the driver.
The Vertica JDBC URL to the database we just created will be:jdbc:vertica://127.0.0.1:5433/testdb
Note: If you want to connect to the Vertica database from outside of VM you can:
- stop your VM;
- go to VM “Settings”, select “Network” configuration and change the setting of the VM network adapter to “Bridged Adapter”;
- start VM;
- run ifconfig in VM terminal to determine IP;
- connect to your VM using VM IP in JDBC URL or by specifying it in connection options of any 3rd party tool.
Keeping the Vertica Database Healthy
One of the most important habits to develop when working with databases is to stop them gracefully. Databases love a clean shutdown. This will ensure that you do not have corruptions or data loss. Vertica is not an exception. To keep your database healthy do not forget to gracefully stop it before shutting down Ubuntu.
Stopping the Vertica Database
During install you learned about admintools. To stop database start admintools. “Main Menu” has “Stop Database” item. Select it and follow the prompts.
Starting the Vertica Database
By default, Vertica is not going to start the database when you start the VM. This is done to give more control to the administrator in multi-node installations. It is not that relevant for single-node clusters so I will show you how to change it to autostart below.
To start database manually start admintools. “Main Menu” has “Start Database” item. Select it and follow prompts.
Configuring Vertica to start the Database Automatically on Boot
Vertica is making the node start decisions based on the Restart Policy. If you want to autostart the single-node Vertica database on boot you need to make changes to the Restart Policy.
Start admintools and go to the “Configuration Menu”. Select “Set Restart Policy”, select correct database and choose “Always” policy. On the next VM reboot Vertica database will autostart, but only in the case of a clean shutdown.
Summary
At this point we have a fully functional single-node Vertica cluster running on the Ubuntu Server.
We can do the following things:
- we can work within VM on the Vertica database itself;
- we can connect to the Vertica database using any tool installed on VM;
- we can connect to the Vertica database from any computer on the network when we have registered the VM on the local network with help of the “Bridged Adapter” configuration option.
We are done and endless Vertica learning opportunities are waiting for us right on top of our laps.