Database Migration
Lenses 5 to 6 Migration Guide
Overview
This guide covers the migration process from Lenses 5 to Lenses 6. The migration path depends on your current database setup.
Prerequisites
Before starting the migration:
Important: Always test the migration process in a staging environment before applying to production.
Migration Scenarios
Scenario 1: PostgreSQL In-Place Upgrade
If you're already using PostgreSQL with Lenses 5, you can perform an in-place upgrade.
Advantages: Simpler process, data remains in place
Downtime: 15-30 minutes typically
Step-by-Step Process
Deploy & Start Lenses Agent
Instruction on how to Deploy & Start Lenses Agent can be found under:
Via HelmDeploying an Agent
Via Docker Deploying an Agent
Via Archive Deploying an Agent
Scenario 2: H2 to PostgreSQL Migration
For users with H2 embedded database, migration to PostgreSQL is required.
{% hint style="danger" %}
Critical: H2 embedded database is not supported in Lenses 6. Migration to PostgreSQL is mandatory. {% endhint %}
Migration Options
{% tabs %} {% tab title="Option A: Export/Import" %}
Export/Import Method (Recommended)
Best for: Small to medium installations (<100GB data)
1. Prepare PostgreSQL
sql
2. Export H2 Data
bash
3. Transform H2 to PostgreSQL
python
4. Import to PostgreSQL
bash
{% endtab %}
{% tab title="Option B: Migration Tool" %}
Automated Migration Tool
Best for: Large installations, minimal downtime required
Setup Migration Environment
yaml
Migration Configuration
yaml
Run Migration
bash
{% endtab %}
{% tab title="Option C: Script" %}
Comprehensive Migration Script
Best for: Full control, custom requirements
bash
{% endtab %} {% endtabs %}
Post-Migration Steps
1. Configuration Update
Update your Lenses 6 configuration to use PostgreSQL:
hocon
2. Validation Checklist
{% hint style="info" %} Complete all validation steps before considering the migration successful. {% endhint %}
Data Validation
Functional Validation
Performance Validation
3. Monitoring
Set up monitoring for the new installation:
yaml
Rollback Procedure
{% hint style="danger" %} Important: Keep Lenses 5 installation intact until migration is fully validated. {% endhint %}
PostgreSQL Users
bash
H2 Migration Rollback
bash
Troubleshooting
Common Issues
{% tabs %} {% tab title="Connection Issues" %} Problem: Cannot connect to PostgreSQL
bash
Solution: Ensure PostgreSQL is configured to accept connections:
bash
{% endtab %}
{% tab title="Migration Errors" %} Problem: Data type incompatibilities
sql
Problem: Foreign key violations
sql
{% endtab %}
{% tab title="Performance Issues" %} Problem: Slow queries after migration
sql
{% endtab %} {% endtabs %}
Support
{% hint style="warning" %} If you encounter issues not covered in this guide, please contact Lenses support with:
Migration logs
Error messages
Lenses version numbers (source and target)
Database versions {% endhint %}
Related Documentation
\
Last updated
Was this helpful?

