Sometimes we want to test a new version of Vertica. In the past, the best way to do that was to use a Vertica Community Edition (CE) virtual machine. But starting with Vertica version 10.1, there is an easier way to achieve this.
There is an official Docker image for the latest Vertica CE version with a pre-installed VMart test database, which can be obtained and deployed even on a Windows-hosted laptop or workstation.
You simply need to install Docker on your laptop once, and you can deploy Vertica with just a single command. To install Docker with the Windows subsystem for Linux (WSL 2) please see this article:
After you have installed the Docker environment you are ready to deploy your first Vertica CE container on your host.
If you need to save the state of your database between you restarts of the Vertica CE container, you should create a dedicated directory for the persistent data of your database. In my example, I’ll use D:\temp for this purpose. (You can use a different location. But remember that the faster the performance of your disk where Vertica files are located, the faster your tests will run – although they won’t be as fast as production-performance.)
To deploy a complete Vertica database you should use only a single command on a command line processor (cmd.exe):
start docker container run -p 5433:5433 -v d:\temp\:/data vertica/vertica-ce:latest
Hit enter, and Docker will start a new window for the standard output of the working container. It will download a Docker image for Vertica CE on your laptop, create a new database, and then it will be ready. You will see a message:
“Vertica is now running”
In some cases, you may see a warning message that WSL 2 Containers may perform poorly due the file share process.
To see if Vertica is running, you can check the list of running containers:
C:\Users\admin>docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS
5cdde5813071 verticadocker/vertica-ce:latest "/bin/sh -c $ENTRYPO…" 4 hours ago Up 4 hours 0.0.0.0:5433->5433/tcp, :::5433->5433/tcp, 5444/tcp NAMES xenodochial_villani
Now you can download and install Vertica client libraries for Windows (https://www.vertica.com/download/vertica/client-drivers/) and connect to your database in the Docker container using this command:
C:\Users\admin>"c:\Program Files\Vertica Systems\VSQL64\vsql.exe" -U dbadmin Welcome to vsql, the Vertica Analytic Database interactive terminal. Type: \h or \? for help with vsql commands \g or terminate with semicolon to execute query \q to quit Warning: Console code page (866) differs from Windows code page (1251) 8-bit characters may not work correctly. See vsql reference page "Notes for Windows users" for details. dbadmin=> select version(); version ------------------------------------- Vertica Analytic Database v10.1.1-0 (1 row)
dbadmin=> \d List of tables Schema | Name | Kind | Owner | Comment --------------+-----------------------+-------+---------+--------- online_sales | call_center_dimension | table | dbadmin | online_sales | online_page_dimension | table | dbadmin | online_sales | online_sales_fact | table | dbadmin | public | customer_dimension | table | dbadmin | public | date_dimension | table | dbadmin | public | employee_dimension | table | dbadmin | public | inventory_fact | table | dbadmin | public | product_dimension | table | dbadmin | public | promotion_dimension | table | dbadmin | public | shipping_dimension | table | dbadmin | public | vendor_dimension | table | dbadmin | public | vmart_load_success | table | dbadmin | public | warehouse_dimension | table | dbadmin | store | store_dimension | table | dbadmin | store | store_orders_fact | table | dbadmin | store | store_sales_fact | table | dbadmin | (16 rows)
To stop your database in the container, you should find the container ID from docker container ls and then you can use commands to gracefully shutdown Vertica inside your container and delete an unused container:
docker container stop 5cdde5813071 docker container rm 5cdde5813071
In this case your database files will still be stored in your Windows directory (in my example this was D:\temp). And when you need to restart your Vertica database from these files, you should simply deploy a new container from the Docker image as you created it from scratch. The Vertica container startup script will find the Vertica files and bring the database back from them. Just wait for a line with:
“Vertica is now running”
Enjoy your data journey with fast and simple Vertica CE containers.