# HA_Switch

> This sample demonstrates how to switch between master and replica eXtremeDB High Availability applications.

### How to Run

> See instructions here on how to build this and other samples on your development platform. Once built, the sample can be run from the `\target\bin` directory.

> In a console window run:

>         haswitch

> The application attempts to connect to an existing master database. If the attempt fails, it switches to master mode, creates and populates the database, then enters a loop creating and deleting objects.

> Then in a second console window run:

>         haswitch

> This instance connects to the first application instance. To exchange master and replica roles, press <Enter> in the first or second console window. To stop the application, type "q <Enter>".

> But it is more instructive to run one instance in your development environment debugger, stepping through the code.

Related Topics