Skip to content

Quick Start

Before you begin, ensure you have:

  • Linux or macOS system
  • Docker (optional, for containerized deployment)
  • Telnet or netcat for basic connection testing
Section titled “Option 1: Native Installation (Recommended)”
Terminal window
# Install HaruDB
curl -sSL https://raw.githubusercontent.com/Hareesh108/haruDB/main/scripts/install-harudb.sh | bash
# Verify installation
harudb --version
Terminal window
# Pull the latest image
docker pull hareesh108/harudb:latest
# Run the container
docker run -p 54321:54321 hareesh108/harudb:latest
Terminal window
# Basic startup
./harudb --data-dir ./data
# With TLS encryption
./harudb --data-dir ./data --tls
# Custom port
./harudb --data-dir ./data --port 54322
# Port conflict detection
./harudb --data-dir ./data
# If port is in use: ⚠️ Port 54321 is already in use by: <process>
# Please stop the other service or use a different port
Terminal window
# Run with volume mounting for persistence
docker run -p 54321:54321 -v $(pwd)/data:/app/data hareesh108/harudb:latest
# Run in background
docker run -d -p 54321:54321 --name harudb hareesh108/harudb:latest
Terminal window
telnet localhost 54321
Terminal window
nc localhost 54321
Terminal window
haru-cli

You should see:

Welcome to HaruDB v0.0.5 🎉
Type 'exit' to quit.
haruDB>
-- Login with default admin credentials
LOGIN admin admin123
-- Change the default password immediately!
CHANGE PASSWORD admin123 MySecurePassword123!
CREATE TABLE users (id, name, email, age);
INSERT INTO users VALUES (1, 'Alice', 'alice@example.com', '25');
INSERT INTO users VALUES (2, 'Bob', 'bob@example.com', '30');
INSERT INTO users VALUES (3, 'Charlie', 'charlie@example.com', '35');
-- Select all users
SELECT * FROM users;
-- Select specific columns
SELECT name, email FROM users;
-- Count records
SELECT COUNT(*) FROM users;
CREATE INDEX ON users (email);
-- Equality filter (uses index)
SELECT * FROM users WHERE email = 'alice@example.com';
-- Comparison operators
SELECT * FROM users WHERE age > 30;
-- Pattern matching
SELECT * FROM users WHERE name LIKE 'A%';
-- Complex conditions
SELECT * FROM users WHERE age > 25 AND name LIKE 'A%';
-- Update by row index
UPDATE users SET age = '26' ROW 0;
-- Update multiple columns
UPDATE users SET name = 'Alice Updated', email = 'alice.updated@example.com' ROW 0;
-- Delete by row index
DELETE FROM users ROW 2;
-- Begin a transaction
BEGIN TRANSACTION;
-- Make multiple changes
INSERT INTO users VALUES (4, 'David', 'david@example.com', '28');
UPDATE users SET age = '27' ROW 0;
-- Commit the transaction
COMMIT;
-- Or rollback if needed
BEGIN TRANSACTION;
INSERT INTO users VALUES (5, 'Eve', 'eve@example.com', '32');
ROLLBACK; -- This will undo the insert
-- Drop the table
DROP TABLE users;

Here’s a complete session demonstrating HaruDB’s capabilities:

-- Create tables
CREATE TABLE products (id, name, price, category);
CREATE TABLE orders (id, product_id, quantity, total);
-- Insert sample data
INSERT INTO products VALUES (1, 'Laptop', '999.99', 'Electronics');
INSERT INTO products VALUES (2, 'Mouse', '29.99', 'Electronics');
INSERT INTO products VALUES (3, 'Desk', '199.99', 'Furniture');
-- Create indexes
CREATE INDEX ON products (category);
CREATE INDEX ON products (name);
-- Query with WHERE clauses
SELECT * FROM products WHERE category = 'Electronics';
SELECT * FROM products WHERE price > 100;
-- Complex query
SELECT * FROM products WHERE category = 'Electronics' AND price < 50;
-- Transaction example
BEGIN TRANSACTION;
INSERT INTO orders VALUES (1, 1, 2, '1999.98');
INSERT INTO orders VALUES (2, 2, 1, '29.99');
COMMIT;
-- Verify transaction
SELECT * FROM orders;
-- Clean up
DROP TABLE products;
DROP TABLE orders;

Now that you’ve completed the quick start:

  1. Explore SQL Operations - Learn about advanced SQL features
  2. Understand Transactions - Dive into ACID compliance
  3. Optimize Performance - Learn about indexes and query optimization
  4. Secure Your Database - Set up authentication and user management
  5. Backup Your Data - Learn about backup and restore

Port already in use:

Terminal window
# Kill existing process
pkill harudb
# Or use a different port
./harudb --port 54322

Permission denied:

Terminal window
# Make binary executable
chmod +x harudb

Connection refused:

Terminal window
# Check if server is running
ps aux | grep harudb
# Check port availability
netstat -tlnp | grep 54321

For more troubleshooting help, see the Troubleshooting Guide.