Troubleshooting
Server Issues
Section titled “Server Issues”Port Already in Use
Section titled “Port Already in Use”Problem: Server fails to start because port 54321 is already in use.
Symptoms:
Error: listen tcp :54321: bind: address already in use
Solutions:
# Option 1: Kill existing processpkill harudb
# Option 2: Find and kill specific processps aux | grep harudbkill -9 <process_id>
# Option 3: Use different port./harudb --port 54322
# Option 4: Check what's using the portnetstat -tlnp | grep 54321lsof -i :54321
Server Won’t Start
Section titled “Server Won’t Start”Problem: HaruDB server fails to start.
Symptoms:
Error: failed to start server
Solutions:
# Check if binary is executablechmod +x harudb
# Check data directory permissionschmod 755 data/
# Check if data directory existsmkdir -p data
# Check disk spacedf -h
# Check system resourcesfree -htop
Permission Denied
Section titled “Permission Denied”Problem: Permission errors when starting server or accessing data.
Symptoms:
Error: permission denied
Solutions:
# Fix binary permissionschmod +x harudb
# Fix data directory permissionschmod 755 data/chmod 644 data/*.harudb
# Check ownershipls -la harudbls -la data/
# Fix ownership if neededsudo chown $USER:$USER harudbsudo chown -R $USER:$USER data/
Connection Issues
Section titled “Connection Issues”Connection Refused
Section titled “Connection Refused”Problem: Cannot connect to HaruDB server.
Symptoms:
telnet: connect to address 127.0.0.1: Connection refused
Solutions:
# Check if server is runningps aux | grep harudb
# Check if server is listening on portnetstat -tlnp | grep 54321
# Start server if not running./harudb --data-dir ./data
# Check firewall settingssudo ufw statussudo iptables -L
# Test connectiontelnet localhost 54321nc localhost 54321
TLS Connection Issues
Section titled “TLS Connection Issues”Problem: TLS connections fail.
Symptoms:
Error: TLS handshake failed
Solutions:
# Check TLS configuration./harudb --data-dir ./data --tls --help
# Verify TLS certificatesopenssl x509 -in cert.pem -text -noout
# Test TLS connectionopenssl s_client -connect localhost:54321
# Check TLS version compatibility./harudb --data-dir ./data --tls --tls-min-version 1.2
Timeout Issues
Section titled “Timeout Issues”Problem: Connections timeout or hang.
Symptoms:
Connection timeout
Solutions:
# Check network connectivityping localhost
# Check server loadtophtop
# Check for deadlocksps aux | grep harudb
# Restart serverpkill harudb./harudb --data-dir ./data
Data Issues
Section titled “Data Issues”WAL File Corruption
Section titled “WAL File Corruption”Problem: Write-Ahead Log file is corrupted.
Symptoms:
Error: WAL file corruptedError: failed to replay WAL
Solutions:
# Option 1: Remove WAL file (data loss warning!)rm data/wal.log
# Option 2: Backup WAL file firstcp data/wal.log data/wal.log.backuprm data/wal.log
# Option 3: Check WAL file integrityfile data/wal.loghexdump -C data/wal.log | head
# Option 4: Restore from backupRESTORE FROM ./backups/latest_backup.db
Data File Corruption
Section titled “Data File Corruption”Problem: Database files are corrupted.
Symptoms:
Error: invalid JSON formatError: table file corrupted
Solutions:
# Check file integrityfile data/*.harudb
# Check JSON validitypython3 -m json.tool data/users.harudb
# Backup corrupted filescp data/users.harudb data/users.harudb.backup
# Restore from backupRESTORE FROM ./backups/latest_backup.db
# Recreate table if necessaryDROP TABLE users;CREATE TABLE users (id, name, email);
Missing Data
Section titled “Missing Data”Problem: Data appears to be missing or incomplete.
Symptoms:
Table users not foundNo data returned from queries
Solutions:
-- Check if table existsSELECT * FROM users;
-- List all tables-- (HaruDB doesn't have SHOW TABLES, check data directory)-- ls data/*.harudb
-- Check data directory-- ls -la data/
-- Restore from backupRESTORE FROM ./backups/latest_backup.db
Performance Issues
Section titled “Performance Issues”Slow Queries
Section titled “Slow Queries”Problem: Queries are running slowly.
Symptoms:
Queries take a long time to completeHigh CPU usage during queries
Solutions:
-- Create indexes on frequently queried columnsCREATE INDEX ON users (email);CREATE INDEX ON products (category);
-- Use specific columns instead of SELECT *SELECT name, email FROM users WHERE age > 25;
-- Use appropriate WHERE conditionsSELECT * FROM users WHERE email = 'alice@example.com';
-- Check if indexes are being used-- (Queries with equality conditions use indexes)
High Memory Usage
Section titled “High Memory Usage”Problem: HaruDB is using too much memory.
Symptoms:
High memory usage in top/htopSystem running out of memory
Solutions:
# Check memory usagefree -htop -p $(pgrep harudb)
# Check for memory leaksps aux | grep harudb
# Restart serverpkill harudb./harudb --data-dir ./data
# Monitor memory usagewatch -n 1 'ps aux | grep harudb'
Disk Space Issues
Section titled “Disk Space Issues”Problem: Running out of disk space.
Symptoms:
Error: no space left on device
Solutions:
# Check disk usagedf -h
# Check data directory sizedu -sh data/
# Clean up old backupsfind ./backups -name "*.db" -mtime +30 -delete
# Clean up WAL files (if safe)rm data/wal.log
# Move data to larger diskmv data/ /path/to/larger/disk/./harudb --data-dir /path/to/larger/disk/data
Authentication Issues
Section titled “Authentication Issues”Login Failed
Section titled “Login Failed”Problem: Cannot login to HaruDB.
Symptoms:
Error: invalid credentialsError: user not found
Solutions:
-- Check username and passwordLOGIN admin admin123
-- Verify user existsLIST USERS
-- Check user permissions-- (Only admin users can list users)
-- Reset to default admin-- (If all users are locked out, restart server)
Permission Denied
Section titled “Permission Denied”Problem: User doesn’t have permission for operation.
Symptoms:
Error: insufficient permissionsError: access denied
Solutions:
-- Check current user role-- (Admin users have full access)-- (Standard users cannot manage users)-- (Readonly users can only read data)
-- Login as adminLOGIN admin admin123
-- Create user with appropriate roleCREATE USER username password ADMINCREATE USER username password USERCREATE USER username password READONLY
Transaction Issues
Section titled “Transaction Issues”Transaction Deadlock
Section titled “Transaction Deadlock”Problem: Transactions are deadlocked.
Symptoms:
Transaction hangsHigh CPU usage
Solutions:
-- Rollback current transactionROLLBACK;
-- Check for long-running transactions-- (HaruDB doesn't have transaction monitoring yet)
-- Restart server if necessary-- pkill harudb-- ./harudb --data-dir ./data
Transaction Rollback Issues
Section titled “Transaction Rollback Issues”Problem: Transaction rollback fails.
Symptoms:
Error: rollback failedError: transaction not found
Solutions:
-- Check if transaction is active-- (HaruDB doesn't have transaction status yet)
-- Try to commit insteadCOMMIT;
-- Start new transactionBEGIN TRANSACTION;
-- Use savepoints for partial rollbacksSAVEPOINT sp1;-- ... operations ...ROLLBACK TO SAVEPOINT sp1;
Backup and Restore Issues
Section titled “Backup and Restore Issues”Backup Failed
Section titled “Backup Failed”Problem: Backup operation fails.
Symptoms:
Error: backup failedError: insufficient permissions
Solutions:
-- Check admin permissionsLOGIN admin admin123
-- Check disk space-- df -h
-- Check backup directory permissions-- ls -la ./backups/
-- Create backup directory-- mkdir -p ./backups
-- Try different backup locationBACKUP TO ./backup.db DESCRIPTION "Test backup"
Restore Failed
Section titled “Restore Failed”Problem: Restore operation fails.
Symptoms:
Error: restore failedError: invalid backup file
Solutions:
-- Check backup file exists-- ls -la ./backups/backup.db
-- Check backup file integrity-- file ./backups/backup.db
-- Check admin permissionsLOGIN admin admin123
-- Try different backup fileRESTORE FROM ./backups/other_backup.db
System Issues
Section titled “System Issues”Process Not Responding
Section titled “Process Not Responding”Problem: HaruDB process is not responding.
Symptoms:
Process appears hungNo response to commands
Solutions:
# Check process statusps aux | grep harudb
# Check if process is responsivekill -0 $(pgrep harudb)
# Force kill if necessarykill -9 $(pgrep harudb)
# Restart server./harudb --data-dir ./data
System Resource Exhaustion
Section titled “System Resource Exhaustion”Problem: System resources are exhausted.
Symptoms:
System slow or unresponsiveHigh CPU/memory usage
Solutions:
# Check system resourcestophtopfree -hdf -h
# Check for resource limitsulimit -a
# Increase limits if neededulimit -n 65536ulimit -u 32768
# Restart serverpkill harudb./harudb --data-dir ./data
Debugging Tools
Section titled “Debugging Tools”Log Analysis
Section titled “Log Analysis”# Check system logsjournalctl -u harudbtail -f /var/log/syslog
# Check HaruDB logs (if available)tail -f data/harudb.log
# Check WAL filehexdump -C data/wal.log | head
Process Monitoring
Section titled “Process Monitoring”# Monitor HaruDB processwatch -n 1 'ps aux | grep harudb'
# Monitor system resourceshtopiotopnethogs
# Monitor network connectionsnetstat -tlnp | grep 54321ss -tlnp | grep 54321
Data Validation
Section titled “Data Validation”# Check data directoryls -la data/
# Validate JSON filespython3 -m json.tool data/users.harudb
# Check file permissionsls -la data/*.harudb
# Check disk usagedu -sh data/
Getting Help
Section titled “Getting Help”Error Reporting
Section titled “Error Reporting”When reporting issues, include:
- HaruDB version:
./harudb --version
- System information:
uname -a
- Error messages: Complete error output
- Steps to reproduce: Detailed reproduction steps
- Log files: Relevant log entries
Community Support
Section titled “Community Support”- GitHub Issues: Report bugs and feature requests
- Documentation: Check this troubleshooting guide
- Examples: Review example scripts and configurations
Emergency Recovery
Section titled “Emergency Recovery”# Complete system recoverypkill harudbrm -rf data/mkdir data./harudb --data-dir ./dataLOGIN admin admin123RESTORE FROM ./backups/latest_backup.db
For more information about HaruDB’s features, see the Quick Start Guide and SQL Operations Guide.