@Shutdown

Documentation

Home » Documentation » Using VoltDB

@Shutdown

@Shutdown — Shuts down the database.

Synopsis

@Shutdown

Description

The @Shutdown system procedure performs an orderly shut down of a VoltDB database on all nodes of the cluster.

VoltDB is an in-memory database. By default, data is not saved when you shut down the database. If you want to save the data between sessions, you can enable command logging or save a snapshot (either manually or using automated snapshots) before the shutdown. See Chapter 10, Command Logging and Recovery and Chapter 9, Saving & Restoring a VoltDB Database for more information.

Note that once the database shuts down, the client connection is lost and the calling program cannot make any further requests to the server.

Examples

The following examples show calling @Shutdown from sqlcmd and using the voltadmin shutdown command. These two commands are equivalent:

$ sqlcmd
1> exec @Shutdown;
$ voltadmin shutdown

The following program example uses @Shutdown to stop the database cluster. Note the use of catch to separate out a VoltDB call procedure exception (which is expected) from any other exception.

try {
    client.callProcedure("@Shutdown"); 
}

         // we expect an exception when the connection drops.
catch (org.voltdb.client.ProcCallException e) {
    System.out.println("Database shutdown initiated.");
}
         // report any other exception.
catch (Exception e) {
    e.printStackTrace();
}