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

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

 Set up a read-only scale-out system
  1. Create the following directory: c:\scaleoutdemo.

  2. 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:

    dbsrv12 -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. Then, you can connect to the utility database to shut down the database server, if necessary. See -su dbeng12/dbsrv12 server option.

  4. Connect to the root database from Interactive SQL:

    dbisql -c "UID=DBA;PWD=sql;SERVER=scaleout_root_demo;DBN=scaleoutdemo"
  5. Define the root database server for the scale-out system:

    BEGIN
        EXECUTE IMMEDIATE
        'CREATE MIRROR SERVER "scaleout_primary_demo"
        AS PRIMARY
            connection_string = ''SERVER=scaleout_primary_demo;HOST=' 
            || PROPERTY( 'MachineName' ) || ':6871''';
    END
  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.

    BEGIN
        EXECUTE IMMEDIATE
        'CREATE MIRROR SERVER "scaleout_root_demo"
            AS PARTNER
            connection_string = ''SERVER=scaleout_root_demo;HOST=' 
            || PROPERTY( 'MachineName' ) || ':6871''';
    END
  7. Set the options for the root server for the scale-out system:

    SET MIRROR OPTION auto_add_server='scaleout_root_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. Start the backup copy of the database as a child (copy node) of the scaleout_root_demo database server:

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

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

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

  11. You can view the mirror servers in the scale-out system by running the following query:

    SELECT * FROM SYSMIRRORSERVER;
  12. Proceed to Lesson 2: Monitoring your read-only scale-out system from Sybase Central.