Add Servers to the Cluster and Stop Servers

SQLFire manages data in a flexible way that enables you to expand or contract your cluster at runtime to support different loads. To dynamically add more capacity to a cluster, you add new server members and specify the -rebalance option.

Procedure
  1. Open a new terminal or command prompt window, and create a directory for the new server. Also set your PATH in the new terminal if necessary:
    cd ~/vFabric_SQLFire_10x
    mkdir server3
    export PATH=$PATH:~/vFabric_SQLFire_10x/bin
  2. Start the new server with a unique port number and specify the -rebalance option:
    sqlf server start -dir=server3 -locators=ip_address[10101] -client-bind-address=ip_address -client-port=1530 -rebalance &
  3. View the contents of the new SQLFire directory:
    ls server3

    Notice that the new SQLFire server also persists the available table data, and contains the same disk store files as the other two servers.

  4. You can view all members of the distributed system using sqlf. In the available sqlf session, execute the query:
    select id from sys.members;
  5. Verify that all servers now host the data:
    select id from sys.systables s, sys.members where s.tablename='FLIGHTS';
  6. Examine the table data that each server hosts:
    select count(*) memberRowCount, dsid() from flights group by dsid();
  7. Exit the sqlf session:
    exit;
  8. You can stop an individual SQLFire server by using the sqlf server stop command and specifying the server directory. To shut down an entire cluster of servers at once, use the sqlf shut-down-all command:
    sqlf shut-down-all -locators=ip_address[10101]
    
    Connecting to distributed system: locators=ip_address[10101]
    Successfully shut down 4 members