# CHAPTER 5: Distributed Server Set Up

## 5.1 Empress Distributed Server Set Up

Setting up the Empress Distributed Server consists of three steps:

1. Setting up the Global Data Dictionary on the client machine.

2. Setting up the Server Configuration File on the client and server machines.

3. Starting the server on the server machine.

For example, to set up a Distributed Server with the following configuration:

- a server machine named "copper".

- we will configure the server with the name `srv1` and allow it to have one server sub-process.

- a database resides on the server machine located in`/usr/databases/db1`.

- we want it to be accessed using the logical name `logicaldb1`.

### 5.1.1 Setting Up the Global Data Dictionary

The Global Data Dictionary, which must be set up on the client (local) machine, is an ASCII file and is created by running the Empress utility program `empsvutl` with the syntax:

`empsvutl -gdd GDD`

where:

`GDD` | is the name of the Global Data Dictionary file which can be any filename.

Empress responds with the following:

    Logical Database name <hit return to quit> :logicaldb1

    Full path name of the Database in the Server machine (e.g. /usr/empress/db_name) > /usr/database/db1

    Distributed Server name [LOCAL] : srv1

    Logical Database name :   logicaldb1
    Physical Database path name : /usr/database/db1
    Distributed Server name :   srv1

    Is this correct (y/n/q) ? y

    Logical Database name <hit return to quit> :

In this example the Global Data Dictionary is named `GDD` and resides in`/usr/dbadmin`.

The contents of the file are as follows:

    MSDBLOGICALNAME=logicaldb1
       MSDBLOCATION=/usr/databases/db1
       MSDBSERVERNAME=srv1
    MSDBLOGICALEND

Set the Empress environment variable `MSGLOBALDATADICTIONARY` to indicate the location of the Global Data Dictionary.

For example, in the UNIX C shell:

`setenv MSGLOBALDATADICTIONARY /usr/dbadmin/GDD`

or in the UNIX Bourne or Korn shell:

    MSGLOBALDATADICTIONARY=/usr/dbadmin/GDD
    export MSGLOBALDATADICTIONARY

### 5.1.2 Setting Up the Server Configuration File

The Server Configuration File is an ASCII file and is created by running the Empress utility program `empsvutl` with the syntax:

`empsvutl -scf SCF`

`SCF` | is the name of the Server Configuration File which can be any file name.

Empress responds with the following:

    Distributed Server name <hit return to quit> : srv1

    Node name of the machine where Server resides: > copper

    Number of Server sub-processes [1] :
    Name of Server administrator [support] : joe

    Note that : No two active Servers can have the same combination
                of host name an Internet port number
    Internet port number (5000 - 65534) : 5001
    Distributed Server name : srv1
    Server host name : copper
    Number of Server sub-processes : 1
    Name of Server administrator : joe
    Network access type : INET_SOCKET
    Internet port number : 5001

    Is this correct (y/n/q) ? y

    Distributed Server name <hit return to quit> :

For the purpose of this example, we will use the name `SCF` and place the file in the directory `/usr/dbadmin`. The contents of the file are as follows:

    MSSERVERNAME=srv1
       MSSERVERHOSTNAME=copper
       MSSERVERNPROCS=1
       MSSERVERADMINISTRATOR=joe
       MSSERVERNETTYPE=INET_SOCKET
          MSINETPORT=5001
    MSSERVEREND

Set the Empress environment variable `MSSERVERCONFIGFILE` to indicate the location of the Server Configuration File on the server machine.

In the UNIX C shell:

`setenv MSSERVERCONFIGFILE /usr/dbadmin/SCF`

or in the UNIX Bourne or Korn shell:

    MSSERVERCONFIGFILE=/usr/dbadmin/SCF
    export MSSERVERCONFIGFILE

Follow the same procedure to set up the Server Configuration File and the environment variable on the client machine. Ideally, copy the file from the server machine to the client. This will guarantee that the files are identical.

### 5.1.3 Starting the Server

The Empress utility `empsv` is used from the server machine to start the Distributed Server. The syntax is as follows:

`empsv server_name`

where:

`server_name` | is the name of the server which is defined in the Server Configuration File.

In our example, we start the server by typing the command:

`empsv srv1`

The server must reside on the same machine as the database it will service. The server must be started from the machine where it will run. The variable `MSSERVERCONFIGFILE` must be set before this command is run so that the server can find its configuration file when it starts.

There should be one process for each server sub-process as specified by `MSSERVERNPROCS` within the Server Configuration File. There will be one extra process for the server spooler-scheduler.