Urgent.News

What's breaking now, across thousands of outlets.

Tech

Cloning a staging MongoDB and MySQL to your laptop without installing a single database client

Every week someone on my team needs a copy of our staging data on their laptop. Two databases, MongoDB and MySQL, a few gigabytes. For years the answer was a wiki page: install mongodump of the right major version, install the MySQL client, run four commands, wait, and hope the SSH session doesn't drop halfway through a 3 GB restore. I got tired of the wiki page and wrote dbclone , a small Go…

A small Go command line tool called dbclone enables cloning MongoDB and MySQL databases to your laptop without installing any database clients. The process involves using Docker images that already contain the necessary tools, such as mongodump, mongorestore, mysqldump, and mysql. The tool creates a Docker container and performs the dump and restore operations through it.

Version skew between the client and server is eliminated, as the same major version is used for both dumping and restoring. The tool does not require any staging or storage of dump files, making the process efficient. Each dump is piped directly into its restore, eliminating the need for cleanup steps. MySQL table groups are split into size-balanced chunks, each with its own snapshot, ensuring a consistent point in time.

The tool retries failed streams three times with backoff, and it never writes passwords on the command line. This tool is meant for development data and not for backups.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Trie Data Structure: Efficient Prefix Matching and Autocomplete Implementation

Introduction When building features like search bar autocomplete, spell checkers, or IP routing tables, traditional hash maps and balanced binary search trees often fall short.

  • Trie excels at prefix matching unlike hash maps and balanced trees
  • TrieNode stores child nodes and boolean flag for complete words
  • Insertion, search, and prefix search all O(m) time complexity

Node.js Security Best Practices: Build Safer and More Resilient APIs

Node.js makes it easy to build fast APIs, but speed and simplicity do not automatically make an application secure. Production services handle authentication tokens, user input, database queries…

  • Treat all external values as untrusted and validate before application logic
  • Use security headers like Content-Security-Policy to mitigate browser attacks
  • Store secrets in environment variables or dedicated secrets manager

More from Wednesday 7 October →