Operations

Moving a VICIdial server: what we copy and what we never copy

A VICIdial move is a database import with rules. Which tables travel, which never do, what gets rewritten, and how to prove nothing was lost.

By Published 5 min read
Moving boxes stacked in a bright empty office room

To the point

Moving a VICIdial floor means importing the data tables, rewriting every column that holds the old server address, and leaving the new machine's own identity alone. The rows that describe the old box, and the eight in-memory tables, never travel.

  • Check db_schema_version first. Import only into a destination at the same schema or newer.
  • Skip the eight MEMORY tables, the old servers row, settings and carriers.
  • Rewrite every server_ip column, then count the old address. We got zero left.
  • Compare row counts by full scan, not COUNT(*).
  • Recordings are files and move separately.

Check the schema direction first

Three version numbers live in system_settings: version, db_schema_version and an SVN revision. Only db_schema_version decides whether the move is safe.

A dump carries the columns the source had. Import it into an older schema and whatever that schema has never heard of is silently dropped. VICIdial's upgrade path only moves forward.

  • Destination behind the source: stop and upgrade the destination. Never downgrade the source.
  • Destination ahead: the normal, safe direction.
  • Equal: nothing to reconcile.

On our first real move the source was at schema 1745 and the destination at 1750 or higher. Across 344 common tables, zero columns existed only on the source.

What never travels

The destination already has a servers row, system_settings, carriers, a template set, a session table and performance logs. They describe the destination. Pass them to mysqldump with --ignore-table, along with the live-agent table, session_data, server_performance and the per-address cid_channels_recent_<ip> table.

Eight tables live in memory and are rebuilt empty on every restart: vicidial_auto_calls, vicidial_hopper, server_updater, live_channels, live_sip_channels, parked_channels, vicidial_campaign_server_stats, web_client_sessions. Copying them imports a photograph of calls that are not happening. mysqlcheck cannot check them and prints a note, which is noise, not damage.

What gets rewritten

Every one of these can hold the old address: servers.server_ip, phones.server_ip, vicidial_inbound_dids.server_ip and .filter_server_ip, vicidial_remote_agents.server_ip, recording_log.server_ip, vicidial_conferences.server_ip, conferences.server_ip, vicidial_stations.server_ip and vicidial_automated_reports.report_server.

Do not trust a hand-made list. Drive the rewrite from information_schema.columns, which finds every server_ip and call_server_ip column, then count the old address afterward. Check hostname -f where links carry a name. Finally set rebuild_conf_files='Y' on the server row, reload Asterisk, and restart cron and the VICIdial processes.

The order that kept the data

Diagram: seven steps of a safe VICIdial database move, from disk check to restart
The order matters more than the tooling
  1. Check disk. About twice the database size plus the recordings, with 30 percent headroom.
  2. Take a rollback net. mysqldump --add-drop-table | gzip of the destination.
  3. Quiesce the source. See how to tell a server is idle.
  4. Dump read-only: --skip-lock-tables --no-create-info --complete-insert --quick --hex-blob, piped to gzip.
  5. Verify with gzip -t and refuse to continue if it fails.
  6. Preserve, stop, truncate, import with foreign key and unique checks off.
  7. Re-apply the preserved rows, rewrite addresses, restart.

In the Trustane console

Trustane console Migrate in page with the connection fields marked
Migrate in, step 1 of 4: how we reach your old box
  1. How we get into your old box: pick a password or a key.
  2. Host / IP of your existing dialer: the source to read from.
  3. Check my dialer: reads it before anything is written.

Prove it with full scans

Diagram: recording_log row count from the stored header versus a full scan
The header number would have made a perfect move look like a 37 percent loss

Do not use COUNT(*) on a MyISAM table after an unclean shutdown. Count a column that cannot be null, COUNT(start_time) here, on both sides. Then compare file counts and, if you can, the sum of bytes.

Recordings are a separate move

Recordings are files. One set we moved was 24 GB in about 258,000 files. Use rsync, not tar, because it resumes, and throttle with --bwlimit or run off hours. They can finish after cutover, as long as the new box can play what has arrived.

We tested ViciBox 12 sources and destinations, schema 1745 and up, MyISAM only. With InnoDB tables --single-transaction becomes available and the locking story changes.

Questions people ask

Which version number matters?

db_schema_version. The SVN revision is advisory, because the working copy can differ from the database you are importing into.

How long does the move take?

The database part is hours or less. Recordings take longest and can run past cutover.

Next steps

Our migration service runs these steps in this order. Server hosting covers where the new box lives, pricing the cost, and build times how fast the destination can exist.

VICIdial is a trademark of its owner. Trustane is an independent hosting provider.

Sources

  1. Migration ground truth, schema direction, engines and addresses
  2. Migration audit, the failure modes of a destructive restore
  3. MySQL reference manual, mysqldump
  4. Cover photo by SHVETS production on Pexels

Trustane

Managed VICIdial hosting

Run it on cores of your own

Managed VICIdial, billed by the hour against a balance you top up.

Or try one server free for 7 days, no top-up.