# hasql

> This sample starts in replica mode and tries to connect to a master up to 3 times. If it fails to connect or the master dies, then it switches to master mode. In the master mode it initializes the database if necessary and then updates random records for 10 seconds

### How to Run

> In a console window run:

>         RplMst

> Then in a second console window run the following, where `connect_string` is the `host:port` combination (`localhost:10000` by default):

>         RplMst <connect_string>

> Break the first instance with `Ctrl+C`. The second instance will automatically switch to master mode.

> Run the first instance again. It will connect to the second instance as replica.

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