システムの運用において、定期保守やバックアップの取得時などの特定の時間に自動的にデータベースの停止や再起動を行うケースがあるかと思います。InfiniDBではアクティブなトランザクションが存在するタイミングで停止や再起動を行うと、以下のようにプロンプトを表示して待ち状態になります。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
# cc shutdownSystem y shutdownsystem Thu Jul 17 16:41:40 2014 This command stops the processing of applications on all Modules within the Calpont System The following tables are locked: LockID Name Process PID Session CreationTime State DBRoots 44848 test.emp DMLProc 1036 19452 2014-07-17 午後04時40分54秒 LOADING 1 There are active transactions being processed Your options are: Cancel -- Cancel the shutdown request Wait -- Wait for write operations to end and then shutdown Force -- Force a shutdown What would you like to do: [Cancel]: |
スケジューラによる自動運用を行う上で停止や再起動を強制的に行いたい場合には、以下のようなシェルスクリプトを作成して呼び出すことにより対応が可能です。
【例】shutdown_force.sh
1 2 3 4 5 6 7 |
#!/bin/sh /usr/local/Calpont/bin/calpontConsole shutdownSystem y <<EOF force EOF ※再起動の場合はshutdownSystemの代わりにrestartSystemを実行 |
InfiniDBの停止・再起動時に残っていた未確定のトランザクションは、次回起動時に自動的にロールバックされます。
1 2 3 4 5 6 7 8 9 |
# cc startsystem startsystem Thu Jul 17 16:42:42 2014 startSystem command, 'infinidb' service is down, sending command to start the 'infinidb' service on all modules System being started, please wait......................... System Not Ready, DMLProc is checking/processing rollback of abandoned transactions. Processing could take some time, please wait... Successful start of System |