Skip to content

Multiple Databases

Gundahar Bravin edited this page Feb 18, 2026 · 1 revision

Multiple Databases

L.O.R.E. v1.1.0 introduced support for multiple database connections, allowing large grids to sync regions from up to 5 different Robust databases simultaneously.


🎯 Who Needs This?

✅ Use Multiple Databases If You Have:

  • Load-balanced grids where regions are sharded across multiple database servers for performance
  • Multi-server setups with different Robust databases on different physical machines
  • Migration scenarios where you need to sync from both old and new databases during transition
  • Testing environments where you want to combine production and test regions in one map

❌ You DON'T Need This If:

  • Your grid has all regions in a single Robust database (most grids)
  • You're just getting started with a small grid
  • Your database has fewer than 5,000 regions

For 90% of grids, the primary database alone is all you need!


🗄️ Understanding Database Sharding

Large OpenSim grids sometimes split their regions table across multiple databases for performance reasons:

Database 1 (db1.yourgrid.com)  →  Regions 1-500
Database 2 (db2.yourgrid.com)  →  Regions 501-1000  
Database 3 (db3.yourgrid.com)  →  Regions 1001-1500

Each database has its own regions table with a subset of your grid's regions. L.O.R.E. connects to ALL of them and merges the data into one unified map!


⚙️ Setup Guide

Step 1: Configure Primary Database

  1. Go to Settings → L.O.R.E. Map
  2. Scroll to OpenSimulator Database(s) section
  3. Fill in your Primary Database credentials (left column):
    • Database Host
    • Database Name
    • User
    • Password

This is required and works exactly like v1.0.x - your main Robust database.

Step 2: Enable Additional Databases

Look at the right column - you'll see Database 2, 3, 4, and 5.

  1. Check the box next to "Database 2"
  2. The fields will slide open
  3. Fill in the credentials for your second database
  4. Repeat for Database 3, 4, 5 as needed

Only enable the databases you actually have! Leave unused databases unchecked.

Step 3: Save Settings

Click Save Settings at the bottom of the page.

Step 4: Sync Regions

  1. Scroll to Region Sync section
  2. Click Sync Regions Now
  3. Watch the progress bar - it will sync from ALL enabled databases
  4. Success message shows total regions synced

🎨 The Admin Interface

Primary Database (Left Column)

  • Always visible
  • Blue border indicates it's the main database
  • Required for L.O.R.E. to work

Additional Databases (Right Column)

  • Each has a checkbox toggle
  • Click checkbox → fields appear/hide
  • Compact layout saves space
  • Only shows what you need

Example Setup:

✓ Primary Database           ✓ Database 2
  Host: db1.grid.com            Host: db2.grid.com
  Name: robust                  Name: robust
  User: lore_user               User: lore_user
  Pass: ****                    Pass: ****

                              ☐ Database 3 (disabled)
                              
                              ☐ Database 4 (disabled)
                              
                              ☐ Database 5 (disabled)

🔄 How Sync Works

When you click Sync Regions Now, L.O.R.E.:

  1. Clears the WordPress wp_lore_regions table
  2. Connects to Primary Database → syncs regions in batches of 50
  3. Connects to Database 2 (if enabled) → syncs its regions
  4. Connects to Database 3 (if enabled) → syncs its regions
  5. Continues for all enabled databases
  6. Deduplicates by UUID - if same region appears in multiple databases, keeps the most recent

Result: One unified map with all regions from all databases!


📊 Progress & Status

Progress Bar Shows:

  • Total regions synced across ALL databases
  • Current batch number
  • Percentage complete

Success Message Shows:

✅ Synced 1,247 regions successfully!
   (from 3 database(s))

Error Handling:

If one database fails, sync continues with the others. Check the error message to see which database had issues.


⏰ Auto-Sync with Multiple Databases

Good news: Auto-sync works seamlessly with multiple databases!

  1. Enable Automatic Daily Sync checkbox
  2. Save settings
  3. Every day at 3:00 AM, L.O.R.E. syncs from ALL enabled databases
  4. Check WordPress error log to verify:
    L.O.R.E. Auto-Sync Primary: Synced 450 regions
    L.O.R.E. Auto-Sync DB2: Synced 400 regions
    L.O.R.E. Auto-Sync DB3: Synced 397 regions
    L.O.R.E. Auto-Sync: Total synced 1247 regions from 3 database(s)
    

🔐 Security Best Practices

Create Read-Only Users for Each Database

For Database 1:

CREATE USER 'lore_db1'@'%' IDENTIFIED BY 'secure_password_1';
GRANT SELECT ON robust.regions TO 'lore_db1'@'%';
FLUSH PRIVILEGES;

For Database 2:

CREATE USER 'lore_db2'@'%' IDENTIFIED BY 'secure_password_2';
GRANT SELECT ON robust2.regions TO 'lore_db2'@'%';
FLUSH PRIVILEGES;

Repeat for each database. Use different passwords for each!

Firewall Rules

If databases are on different servers:

  • Open port 3306 on each database server
  • Allow connections from your WordPress server IP only
  • Consider using SSH tunnels for extra security

❓ Troubleshooting

"Database 2 connection failed"

Cause: Database 2 credentials are wrong or server is unreachable.

Fix:

  1. Test credentials with phpMyAdmin or MySQL client
  2. Check firewall allows connections from WordPress server
  3. Verify bind-address in MySQL config allows remote connections
  4. Confirm Database 2 checkbox is actually checked

Only Some Regions Appear

Cause: One of your databases didn't sync.

Fix:

  1. Check success message - does it show all databases?
  2. Review WordPress error log for connection failures
  3. Manually test each database connection
  4. Temporarily disable problem databases to isolate the issue

Duplicate Regions

Cause: Same region UUID exists in multiple databases.

Fix: This is normal! L.O.R.E. uses REPLACE instead of INSERT, so the most recently synced version wins. No duplicates appear on the map.

Sync Takes Forever

Cause: Syncing 5 databases with 1,000+ regions each takes time!

Fix:

  • This is normal for very large grids
  • Batch size is 50 per database - can't be increased safely
  • Enable auto-sync so you don't need to manually sync often
  • Be patient - even 5,000 regions only takes ~3 minutes total

🎯 Best Practices

1. Label Your Databases Clearly

Keep notes on which database contains which regions:

Primary: Mainland regions (1-500)
DB2: Private estates (501-1000)  
DB3: Event regions (1001-1200)

2. Test Credentials Before Saving

Use phpMyAdmin or MySQL Workbench to verify each database connection BEFORE entering in L.O.R.E.

3. Monitor Auto-Sync Logs

After enabling auto-sync, check logs the next morning:

tail -f /path/to/wordpress/wp-content/debug.log | grep "L.O.R.E"

4. Start with Primary Only

Even if you eventually need multiple databases:

  1. Configure Primary Database first
  2. Sync and test
  3. Add Database 2 once Primary works
  4. Test again
  5. Continue adding databases one at a time

5. Use Consistent Naming

If possible, name your databases similarly:

  • robust1, robust2, robust3 (good)
  • main_db, regions_backup, test_robust (confusing)

💡 Advanced: Migration Scenario

Problem: You're moving from old_server to new_server but some regions are still on old database.

Solution:

  1. Primary Database → new server (db.newserver.com)
  2. Database 2 → old server (db.oldserver.com)
  3. Enable both, sync
  4. Map shows ALL regions from both servers!
  5. As you migrate regions, they appear in new database
  6. When migration complete, disable Database 2

📈 Performance Impact

Q: Does syncing 5 databases slow down sync?

A: Slightly, but not significantly.

  • Single database: ~500 regions in 10 seconds
  • 5 databases: ~2,500 regions in 50 seconds

Batch processing ensures no timeouts regardless of database count.

Q: Does this slow down my map?

A: No! Once synced, all regions are in one WordPress table. The map loads exactly the same speed whether you have 1 database or 5.


🔄 Disabling Databases

To stop using a database:

  1. Uncheck the checkbox next to it
  2. Save Settings
  3. Manual Sync to remove its regions from the map

Old regions from disabled databases remain in wp_lore_regions until next sync clears the table.


📚 Related Pages


Questions? Ask in GitHub Discussions!

Clone this wiki locally