Deploying ColumnStore
Introduction
MariaDB ColumnStore is a powerful open-source columnar storage engine designed for massively parallel distributed data processing. Built for analytical workloads and data warehousing, ColumnStore excels at business intelligence queries, often delivering 100x faster performance than traditional row-based databases. Deploying ColumnStore on Klutch.sh provides scalable infrastructure for your analytics with persistent storage and automated deployments.
Prerequisites
- A Klutch.sh account
- A GitHub account with a repository for your ColumnStore project
- Basic knowledge of Docker and columnar databases
Installation and Setup
Create Your Dockerfile
Create a Dockerfile in your project root directory:
FROM mariadb/columnstore:latest
# Set environment variables for ColumnStore configurationENV MARIADB_ROOT_PASSWORD=rootpasswordENV MARIADB_DATABASE=analyticsENV MARIADB_USER=csuserENV MARIADB_PASSWORD=cspassword
# Expose the MariaDB/ColumnStore portEXPOSE 3306Push to GitHub
Commit your Dockerfile to your GitHub repository:
git add Dockerfilegit commit -m "Add ColumnStore Dockerfile"git push origin mainDeploying to Klutch.sh
-
Log in to Klutch.sh
Navigate to klutch.sh/app and sign in to your account.
-
Create a New Project
Go to Create Project and give your project a name (e.g., “ColumnStore Analytics”).
-
Create a New App
Navigate to Create App and configure your deployment.
-
Select Your Repository
- Choose GitHub as your Git source
- Select the repository containing your Dockerfile
- Choose the branch to deploy (usually
main)
-
Configure Traffic Type
- Traffic Type: Select TCP (ColumnStore requires TCP for database connections)
- Internal Port: Set to
3306(the default MariaDB/ColumnStore port)
-
Set Environment Variables
Configure your ColumnStore settings:
MARIADB_ROOT_PASSWORD: Strong password for the root userMARIADB_DATABASE: Database name (e.g.,analytics)MARIADB_USER: Application database usernameMARIADB_PASSWORD: Strong password for the database user
-
Attach a Persistent Volume
- In the Volumes section, click “Add Volume”
- Mount Path:
/var/lib/mysql(where ColumnStore stores database files) - Size: Choose based on your data volume (e.g., 20GB, 50GB)
-
Deploy
Click “Create” to deploy. Klutch.sh will automatically detect your Dockerfile, build the image, and start your ColumnStore database.
-
Access Your Database
Connect to your ColumnStore database using port 8000:
******example-app.klutch.sh:8000/analytics
Connecting to ColumnStore
Once deployed, connect from your applications using the following examples:
Node.js (mysql2):
const mysql = require('mysql2/promise');
const connection = await mysql.createConnection({ host: 'example-app.klutch.sh', port: 8000, user: 'csuser', password: 'cspassword', database: 'analytics'});
// Run analytical queriesconst [rows] = await connection.execute( 'SELECT category, SUM(amount) as total FROM sales GROUP BY category');Python (mysql-connector):
import mysql.connector
conn = mysql.connector.connect( host="example-app.klutch.sh", port=8000, user="csuser", ******, database="analytics")
cursor = conn.cursor()cursor.execute("SELECT * FROM sales WHERE date >= '2024-01-01'")rows = cursor.fetchall()Production Best Practices
- Security: Use strong, unique passwords for all database users
- Backups: Implement regular backup strategy using
mysqldumpormariabackup - Monitoring: Track query performance, disk usage, and resource utilization
- Optimization: Create appropriate indexes and use column projection in queries
- Storage: Monitor disk space growth and adjust volume size as needed