Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SAP Sybase SQL Anywhere 16.0 » SQL Anywhere Server - Database Administration » High availability and read-only scale-out systems » SQL Anywhere read-only scale-out » Tutorial: Creating a read-only scale-out system


Lesson 1: Creating a read-only scale-out system

Create a read-only scale-out system, which includes a root node (the root database server) and copy nodes (read-only backup copies of the database).


This lesson assumes that you have the roles and privileges listed in the Privileges section at the start of this tutorial: Tutorial: Creating a read-only scale-out system.

Contexte et remarques

In this tutorial, all the database servers are running on the same computer. However, each database server must be installed on a separate computer in a production environment.

If this tutorial is used with database servers running on different computers, references to localhost in the connection strings must be changed to the actual computer names.

  1. Create the directories c:\scaleoutdemo and c:\scaleoutdemo\copynode.

  2. At a command prompt, run the following command to create the database scaleoutdemo.db, which contains data from the sample database:

    newdemo c:\scaleoutdemo\scaleoutdemo.db
  3. Start the root database server for the scale-out system:

    dbsrv16 -n scaleout_root_demo -su sql -x TCPIP(port=6871) "c:\scaleoutdemo\scaleoutdemo.db" -xp on

    It is recommended that you include the -su option to specify the password for the utility database so that you can connect to the utility database to shut down the database server, if necessary.

  4. Connect to the database from Interactive SQL:

    dbisql -c "UID=DBA;PWD=sql;SERVER=scaleout_root_demo;DBN=scaleoutdemo"
  5. In Interactive SQL, define the root database server of the scale-out system:

    CREATE MIRROR SERVER "scaleout_primary_demo"
    connection_string = 'SERVER=scaleout_primary_demo;HOST=localhost:6871';
  6. Define the root database server as a partner in the scale-out system. The name of the partner server must match the database server name that is used in the command to start the database server.

    CREATE MIRROR SERVER "scaleout_root_demo"
    connection_string = 'SERVER=scaleout_root_demo;HOST=localhost:6871';
  7. Set the options for the root database server of the scale-out system:

    SET MIRROR OPTION auto_add_server='scaleout_primary_demo';
    SET MIRROR OPTION child_creation='automatic';
    SET MIRROR OPTION authentication_string='abc';
    SET MIRROR OPTION auto_add_fan_out='10';
  8. Make a backup copy of the database, placing it in the directory c:\scaleoutdemo\copynode.

    BACKUP DATABASE DIRECTORY 'c:\\scaleoutdemo\\copynode';
  9. At a command prompt, start the backup copy of the database as a copy node of the scaleout_root_demo root database server:

    dbsrv16 -n scaleout_child_demo -su sql -x TCPIP(port=6873) "c:\scaleoutdemo\copynode\scaleoutdemo.db" -xp on
  10. Connect to the copy node from Interactive SQL:

    dbisql -c "UID=DBA;PWD=sql;SERVER=scaleout_child_demo"

    Once the copy node connects to the root database server, you are warned that the copy node is a read-only copy of the database. You can now connect to the copy node and execute queries against it.

  11. In Interactive SQL, you can view the mirror servers in the scale-out system by running the following query:

  12. Close all Interactive SQL windows.


You have created a read-only scale-out system.

 See also