Command-line Usage¶
比較モード¶
プロジェクトで使用する/etc/livecompare/template*.iniをコピーし、必要に応じて調整します(以下のセクションSettingsを参照)。
cp /etc/livecompare/template_basic.ini my_project.ini
livecompare my_project.ini
LiveCompareの実行中に、N+1プログレスバーが表示されます。Nはプロセスの数です(設定でプロセスの数を指定できます)。最初の進行状況バーは全体的な実行を示し、その他の進行状況バーは特定のプロセスによって処理されている現在のテーブルを示します。
各テーブルに表示される情報は、左から順に次のとおりです。
プロセスの数
テーブル名前
ステータス。比較ラウンドのIDの後に現在のID テーブルチャンク(
p1/1はテーブルが分割されなかったことを意味します)。ステータスにある場合setup、テーブルが分析されていることを意味します(行数のチェックと分割 必要に応じて)処理された行数
この比較ラウンドで考慮される合計行の数
経過時間
完了までの推定時間
1秒あたりの記録の速度
テーブルにparallel_chunk_rows設定よりも多くの行がある場合(以下の詳細を参照)、ハッシュファンクションを使用して、どのジョブが行を考慮するかを決定します。これにより、比較が個別に遅くなる可能性がありますが、全体としての比較は、指定されたテーブルの並列処理の恩恵を受ける可能性があります。
プログラムの実行中に、Ctrl-cを押すといつでもキャンセルできます。次のようなメッセージが表示されます。
Manually stopping session 6... You can resume the session with:
livecompare my_project.ini 6
重要
:LiveCompareがバックグラウンドで実行されている場合、または別のシェルで実行されている場合でも、ソフトストップで停止できます。
livemaster.pid名前付けのファイルに、セッションフォルダー(例ではlc_session_6)内のマスタープロセスのPIDを保持します。その後、kill -2 <PID>を呼び出してソフトストップできます。
その後、いつでも以前にキャンセルしたセッションを再開でき例。
livecompare my_project.ini 6
プログラムが終了し、矛盾が見つからなかった場合、次のような出力が表示されます。
Saved file lc_session_5/summary_20190514.out with the complete table summary.
You can also get the table summary by connecting to the output database and executing:
select * from livecompare.vw_table_summary where session_id = 5;
Elapsed time: 0:02:10.970954
Processed 3919015 rows in 6 tables using 3 processes.
Found 0 inconsistent rows in 0 tables.
しかし、矛盾が見つかった場合、出力は次のようになります。
Comparison finished, waiting for remaining difference checks...
Outstanding differences:
+--------------+-------------------+-----------------+------------------+----------------------+-------------------+---------------------------+
| session_id | table_name | elapsed_time | num_total_rows | num_processed_rows | num_differences | max_num_ignored_columns |
|--------------+-------------------+-----------------+------------------+----------------------+-------------------+---------------------------|
| 6 | public.categories | 00:00:00.027864 | 18 | 18 | 4 | |
+--------------+-------------------+-----------------+------------------+----------------------+-------------------+---------------------------+
Saved file lc_session_6/summary_20200129.out with the complete table summary.
You can also get the table summary by connecting to the output database and executing:
select * from livecompare.vw_table_summary where session_id = 6;
Elapsed time: 0:00:50.149987
Processed 172718 rows in 8 tables from 3 connections using 2 workers.
Found 4 inconsistent rows in 1 tables.
Saved file lc_session_6/differences_20200129.out with the list of differences per table.
You can also get a list of differences per table with:
select * from livecompare.vw_differences where session_id = 6;
Too see more details on how LiveCompare determined the differences:
select * from livecompare.vw_consensus where session_id = 6;
Script lc_session_6/apply_on_the_first_20200129.sql was generated, which can be applied to the first connection and make it consistent with the majority of connections.
You can also get this script with:
select difference_fix_dml from livecompare.vw_difference_fix where session_id = 6 and connection_id = 'first';
再確認モード¶
BDR環境では、 BDRが検出した相違は、最終的な一貫性のためにレプリケーションが追いつくため、後で存在しなくなる可能性があります。いくつかの要因に応じて、レプリケーションラグによりLiveCompareが誤検知をレポートする可能性があります。
それを克服するために、レプリケーションラグが減少した後、またはデータが既に追いついた後、ユーザーは手動で以前に検出された差分のみで再チェックを実行できます。この実行モードは「recheck」と呼ばれ、次のように実行できます。
livecompare my_project.ini 6 --recheck
このモードでは、LiveCompareは個別のrecheckログを生成し、lc_session_Xディレクトリに既に存在するすべてのレポートを更新します。
重要
:compareを再開する場合、またはrecheckの下で実行する場合、LiveCompareは設定および接続属性がセッションの作成時と同じかどうかを確認します。相違が見つかった場合、適切なメッセージで実行を終了します。
競合モード¶
LiveCompareをconflictsモードで実行するには、次のコマンドで呼び出す必要があります。
livecompare my_project.ini --conflicts
conflictsモードの詳細については、 BDRサポートの章をご覧ください。