Create a .ini file to configure LiveCompare. See Settings for a description of the various configuration options.
For example, a basic template contains:
This basic template compares three connections, live1, live2, and live3, and outputs the results to the liveoutput database. LiveCompare only uses the public schema in the comparison.
Running the comparison
To run the comparison, run livecompare and pass it the name of your settings file as an argument. If you have created a my_project.ini file, execute the following command:
While LiveCompare executes, N+1 progress bars appear, where N is the number of processes. (You can specify the number of processes in the settings.) The first progress bar shows overall execution. The other progress bars show the current table being processed by a specific process.
The information being shown for each table is, from left to right:
Number of the process
Table name
Status, which can be the ID of the comparison round followed by the current table chunk.
p1/1 means the table wasn't split. A status of setup means the table is being analyzed (checking row count and splitting if necessary).
Number of rows processed
Number of total rows being considered in this comparison round
Time elapsed
Estimated time to complete
Speed in records per second
While the program is executing, you can cancel it at any time by pressing Ctrl-C. A message like the following appears:
Important
If LiveCompare is running in the background or running in another shell, you can still softly stop it. It keeps the PID of the master process inside the session folder (lc_session_6 in the example) in a file named livemaster.pid. You can then invoke kill -2 <PID> to softly stop it.
Then, at any time you can resume a previously canceled session, for example:
When the program ends, if it found no inconsistencies, the output is similar to the following:
If any inconsistencies were found, the output looks like this:
Recheck mode
In a PGD environment, any divergence that PGD finds can later not exist, as the replication caught up due to eventual consistency. Depending on several factors, replication lag can cause LiveCompare to report false positives.
To overcome that, in a later moment when replication lag has decreased or data has already caught up, you can manually execute a recheck only on the differences that were previously found. This execution mode is called recheck. You can execute it like this:
In this mode, LiveCompare generates separate recheck logs and updates all reports that already exist in the lc_session_X directory.
Important
If resuming a compare or executing under recheck, LiveCompare checks whether the settings and connections attributes are the same as when the session was created. If any divergence is found, it quits the execution and gives a message.
Conflicts mode
To run LiveCompare in conflicts mode, invoke it with:
For more details about the conflicts mode, see PGD support.
Dry-run mode
Dry-run mode allows you to run the comparison without actually executing it. This mode is useful for checking the configuration before running the comparison.
For example, suppose you have the following INI file:
As the DSN under Output Connection (the LiveCompare cache database) is incorrect due to a mis-spelling of liveoutput, running LiveCompare initially fails with:
After fixing this, then the output connection is now reachable. But suppose that only one of the data connections is set correctly. In that case, LiveCompare fails again with:
LiveCompare can start a comparison with at least two data connections available. So you go ahead and fix the third connection. But LiveCompare still fails with:
This happens because the example set difference_tie_breakers = first, and any connection set as a tie breaker or source of truth needs to be reachable.
After fixing all those issues, then LiveCompare can start the comparison.
However, when setting up a comparison from scratch, you can check beforehand whether LiveCompare will abort with a configuration error. Further checks of this nature are all shown in the order LiveCompare performs them.
You can do this with the --dry-run mode, which:
Prints all execution aborts that will happen due to configuration issues.
Prints the list of connections with some details, including if it's reachable.
Prints the table filter.
After applying the table filter, prints the list of tables that are common to the reachable connections.
Here's one sample output, given the example .ini file, and all configuration errors regarding unreachable connections: