Sybernet / Inside Sybernet
Release 3.00
September 7, 2002
backwards forwards

INSIDE SYBERNET

The following diagram is more complicated than it looks, but does illustrate how
Sybernet is configured to work with our web servers on spock and the various in-
stances of Oracle on oradev and oraprod.


    oradev.cnad.sri.com contains two instances of Oracle used for development.

        The ORADEV instance is used for application development.
        The ORAUSER instance is used for user testing.

    oraprod.cnad.sri.com contains the production instance of Oracle.

        The ORAPROD instance represents the production environment.
	

As with the Oracle instances there are also development and production versions
of Sybernet located on the appropriate unix server:


    oradev.cnad.sri.com runs the development version of Sybernet.
    oraprod.cnad.sri.com runs the production version of Sybernet.


Close inspection reveals that it's possible to  connect to any instance of Oracle
from any version of Sybernet.





--------------------------------------------------------------------------------

oraprod.cnad.sri.com

The directory structure on oraprod is similar to oradev.cnad.sri.com except that
on oraprod the username oracle owns these objects while on oradev they are owned
by username denis.  Files on oraprod are copied from oradev.

/opt/home/oracle/oracle

For historical reasons the Oracle version of Sybernet resides in the oracle dir-
ectory.    On oraprod this directory was created one level below the oracle home
directory.

    -rw-r--r--   1 oracle   dba         6057 Sep  8 13:44 README
    drwxr-xr-x   2 oracle   dba          512 Sep  7 10:46 SCRIPTS
    -rwxr-xr-x   1 oracle   dba       228644 Sep  1 12:02 SQLPlus
    -rwxr-x---   1 oracle   dba       309188 Jul 30 06:11 Sybercron
    -rwxr-x---   1 oracle   dba      1088540 Aug  2 21:44 Sybernet
    -rwxr-x---   1 oracle   dba       197944 Jul 30 06:11 Sybernet.cgi
    -rw-r-----   1 oracle   dba         1882 Sep  7 11:27 Sybernet.config
    -rwxr-x---   1 oracle   dba       174660 Aug 11 14:05 Sybernet.scout
    -rw-r-----   1 oracle   dba          528 Sep  7 11:47 Sybernet.statistics
    -rw-r--r--   1 oracle   dba            0 Sep  7 11:47 Sybernet.sumlog
    -rwxr-x---   1 oracle   dba       468184 Jul 30 06:11 Sybernet.utility
    drwxr-xr-x   2 oracle   dba          512 Apr 17 12:01 Troi
    drwxr-xr-x   5 oracle   dba          512 Sep  7 10:48 cgi-bin
    drwxr-xr-x   2 oracle   dba         1024 Sep  7 11:52 develop
    -rwxr-xr-x   1 oracle   dba       110748 Sep  1 11:10 extproc.so
    drwxr-xr-x   4 oracle   dba          512 Sep  7 10:51 htdocs
    -rwxr-x---   1 oracle   dba       430988 Apr 22 19:05 ldapsearch
    -rwxr-xr-x   1 oracle   dba        39040 Jun 10 06:20 pkill
    -rw-r--r--   1 oracle   dba       149693 Sep  4 05:41 scout.log
    -rwxr-x---   1 oracle   dba         5864 Sep  7 11:45 start
    -rwxr-x---   1 oracle   dba         2823 Sep  7 11:46 start_sybercron
    -rwxr-xr-x   1 oracle   dba         2914 Sep  7 11:45 start_sybernet
    -rwxr-x---   1 oracle   dba         1453 Sep  7 11:43 status
    -rwxr-x---   1 oracle   dba         1542 Sep  7 11:45 stop
    -rwxrwxrwx   1 oracle   dba         1642 Sep  7 11:46 stop_sybercron
    -rwxr-x---   1 oracle   dba         1571 Sep  7 11:45 stop_sybernet


pkill

pkill is a combination of PS and KILL.  Its usage is defined thusly:


    pkill name [ signal ]


name is case-insensitive and is required.  It can be a username,  a task name or
any text returned by PS (so be careful); for example,


    pkill sybercron
	
	
is similar to


    ps -ef | grep -i 'Sybercron'
	
	
although the display is different.


    #19592 ./Sybercron -X -C 6990 -S ORADEV  -I ORADEV -T 60            (parent)
    #19595 ./Sybercron -X -C 6991 -S ORAUSER -I ORADEV -T 60            (parent)
    #22222 ./Sybercron -X -C 6990 -S ORADEV  -I ORADEV -T 60            ( 19592)


The parent tasks are the Sybercron daemons. In the example above, task 19592 has
spawned task 2222. If you told Sybercron to terminate (using stop_sybercron), no
parents tasks will exit until their children have completed.

When combined with an optional signal, pkill will issue that signal to all tasks
that match to name.  If I wanted Sybercron to terminate cleanly, I would issue


    pkill sybercron quit
	
	
If I wanted Sybercron to terminate immediately, I would issue the following:


    pkill sybercron kill


status

This script can be run to determine the active status of Sybernet and Sybercron.
This is what a typical display looks like.  It isn't definitive because Sybernet
or Sybercron may have spawned some workers.


    ./status
    #  560 ./Sybercron -X -C 6890 -S ORADEV  -I ORAPROD -T 60              (parent)
    #  565 ./Sybercron -X -C 6892 -S ORAPROD -I ORAPROD -T 60              (parent)
    ###############################################################################
    # SYBERCRON                                                           (RUNNING)
    ###############################################################################
    #  512 ./Sybernet 6892                                                 (parent)
    #  520 ./Sybernet 6893                                                 (parent)
    #  497 ./Sybernet 6890                                                 (parent)
    #  527 ./Sybernet 6894                                                 (parent)
    #  505 ./Sybernet 6891                                                 (parent)
    #  540 ./Sybernet 6895                                                 (parent)
    ###############################################################################
    # SYBERNET                                                            (RUNNING)
    ###############################################################################
	
	
Notice that Sybercron for ORAUSER is not running.


stop_sybercron

This script stops Sybercron if it is running.   If Sybercron is busy with one or
more tasks,  this script will wait until all copies of Sybercron have completed.
If you need to bring Sybercron down immediately, you must kill it yourself.  You
can use pkill to do this:


    pkill sybercron kill

	
pkill will issue a kill to all copies of Sybercron when invoked in this manner.


    ./stop_sybercron
    #  560 ./Sybercron -X -C 6890 -S ORADEV  -I ORAPROD -T 60              (parent)
    #  565 ./Sybercron -X -C 6892 -S ORAPROD -I ORAPROD -T 60              (parent)
    #WAITING FOR SYBERCRON TO STOP...
    #SYBERCRON HAS STOPPED


start_sybercron

This script will start all copies of Sybercron.    Since it calls stop_sybercron
which waits until all running copies have completed,  you can safely call start_
sybercron at anytime.


    ./start_sybercron
    #STARTING SYBERCRON...
    Sybercron successfully started (ORADEV)
    Sybercron successfully started (ORAPROD)


stop_sybernet (unsafe)

This script stops Sybernet. Since this script assumes that Sybercron is not run-
ning, invoking it manually is discouraged. stop_sybernet will issue a SIGQUIT to
Sybernet which tells it to disconnect all users and exit. If you issue a SIGKILL
yourself, you could end up with zombie processes as well as user connections in-
side of Oracle.


start_sybernet (unsafe)

This script starts one copy of Sybernet. Since this script assumes that Sybernet
is not running on a particular port, invoking it manually is discouraged. 


stop

It is safe to call at anytime as long as you do not mind losing user connections
to Oracle.

    ./stop
    #  560 ./Sybercron -X -C 6890 -S ORADEV  -I ORAPROD -T 60              (parent)
    #  565 ./Sybercron -X -C 6892 -S ORAPROD -I ORAPROD -T 60              (parent)
    #WAITING FOR SYBERCRON TO STOP...
    #SYBERCRON HAS STOPPED

    #  512 ./Sybernet 6892                                                 (parent)
    #  520 ./Sybernet 6893                                                 (parent)
    #  497 ./Sybernet 6890                                                 (parent)
    #  527 ./Sybernet 6894                                                 (parent)
    #  505 ./Sybernet 6891                                                 (parent)
    #  540 ./Sybernet 6895                                                 (parent)
    #WAITING FOR SYBERNET TO STOP...
    #SYBERNET HAS STOPPED


start

This script starts Sybernet.  start first call stop.  start then starts Sybernet
on each defined port in the configuration file. start then calls start_sybercron.


    ./start
    #STARTING SYBERNET...
    Sybernet 6890 successfully started.
    Sybernet 6891 successfully started.
    Sybernet 6892 successfully started.
    Sybernet 6893 successfully started.
    Sybernet 6894 successfully started.
    Sybernet 6895 successfully started.
    #STARTING SYBERCRON...
    Sybercron successfully started (ORADEV)
    Sybercron successfully started (ORAPROD)


/etc/init.d/

All of the scripts above can be started without cd-ing to a particular directory
and without relying on the setting of any path or environment variables:


   #!/sbin/sh
   case "$1" in
   'start')
            /opt/home/oracle/oracle/start
            ;;

    'stop')
            /opt/home/oracle/oracle/stop
            ;;

    *)
            echo "Usage: $0 { start | stop }"
            exit 1
            ;;
    esac
    exit 0



--------------------------------------------------------------------------------

spock.sri.com

This section discusses the three nodes on spock to support oradev.html, oraprod.
html, and oracle.html (?).

/webservers/etc/httpd/cgi-bin/oraprod

This is the directory that is pointed to by oraprod.html.  oraprod always points
to the production version of Sybernet on oraprod.cnad.sri.com.


    lrwxrwxrwx   1 www      ade           12 Sep  8 07:54 SCRIPTS -> /mis/SCRIPTS/
    -rwxrwx-w-   1 www      ade       300252 Jul 27 10:19 Sybercron
    -rwxrwx-w-   1 www      ade       468184 Sep  7 12:27 Sybernet.Utility
    -rwxrwx-w-   1 www      ade       197944 Jul 27 10:19 Sybernet.cgi*
    -rw-rw--w-   1 www      ade         1895 Sep  9 10:32 Sybernet.config
    -rw-rw--w-   1 www      ade          355 Sep 10 15:29 Sybernet.sumlog
    -rwxrwx-w-   1 www      ade       199408 Sep  7 12:27 Sybernet.utility
    -rwxr-x---   1 www      ade       179756 Jul  9 17:55 csv*
    -rwxrwx-w-   1 www      ade        29448 Jul 27 10:19 pkill
    -rwxr-x---   1 www      ade          587 Sep  8 07:56 start
    -rwxr-x---   1 www      ade         1355 Sep  8 07:56 start_sybercron
    -rwxrwx-w-   1 www      ade          998 Sep  8 07:57 status
    -rwxr-x---   1 www      ade          579 Sep  8 07:56 stop
    -rwxr-x---   1 www      ade          707 Sep  8 07:57 stop_sybernet


Sybernet does not run on spock.sri.com.   That file may or may not be present in
this directory.  start in this case simply calls start_sybercron and stop simply
calls stop_sybercron.

Sybernet.utility and Sybernet.Utility?  On spock Sybernet.utility is actually an
http proxy (similar to Sybernet.cgi) that points to the real Sybernet Utility on
oradev or oraprod. Sybernet.Utility is the Sybernet Utility which runs on spock,
and can be used to interrogate the Sybernet log or confugration files on spock.

/webservers/etc/httpd/cgi-bin/oradev

This is the directory that is pointed to by oradev.html. oradev always points to
the development version of Sybernet on oradev.cnad.sri.com.


    lrwxrwxrwx   1 www      ade           12 Sep  8 07:54 SCRIPTS -> /mis/SCRIPTS/
    -rwxrwx-w-   1 www      ade       300252 Jul 27 10:19 Sybercron
    -rwxrwx-w-   1 www      ade       468184 Sep  7 12:27 Sybernet.Utility
    -rwxrwx-w-   1 www      ade       197944 Jul 27 10:19 Sybernet.cgi
    -rw-rw--w-   1 www      ade         1895 Sep  9 10:32 Sybernet.config
    -rw-rw--w-   1 www      ade          355 Sep 10 15:29 Sybernet.sumlog
    -rwxrwx-w-   1 www      ade       199408 Sep  7 12:27 Sybernet.utility
    -rwxr-x---   1 www      ade       179756 Jul  9 17:55 csv
    drwxrwx-w-   4 www      ade         2560 Sep 10 14:59 develop/
    -rwxrwx-w-   1 www      ade        29448 Jul 27 10:19 pkill
    -rwxr-x---   1 www      ade          587 Sep  8 07:56 start
    -rwxr-x---   1 www      ade         1355 Sep  8 07:56 start_sybercron
    -rwxrwx-w-   1 www      ade          998 Sep  8 07:57 status
    -rwxr-x---   1 www      ade          579 Sep  8 07:56 stop
    -rwxr-x---   1 www      ade          707 Sep  8 07:57 stop_sybernet


Sybernet does not run on spock.sri.com.   That file may or may not be present in
this directory.  start in this case simply calls start_sybercron and stop simply
calls stop_sybercron.

Sybernet.utility and Sybernet.Utility?  On spock Sybernet.utility is actually an
http proxy (similar to Sybernet.cgi) that points to the real Sybernet Utility on
oradev or oraprod. Sybernet.Utility is the Sybernet Utility which runs on spock,
and can be used to interrogate the Sybernet log or confugration files on spock.

/webservers/etc/httpd/cgi-bin/oracle

This is the directory that is pointed to by oracle.html. The directory can point
to either oradev or oraprod. Normally it points to oraprod because it represents
the "production" version of Sybernet on spock.sri.com.

Except for toggle which allows you to toggle between oradev and oraprod,  all of
the files in this directory are soft links that point to the desired directory.


    lrwxrwxrwx   1 www      ade           12 Sep 10 15:10 SCRIPTS -> /mis/SCRIPTS/
    lrwxrwxrwx   1 www      ade           20 Sep 10 16:23 Sybercron -> ../oraprod/Sybercron
    lrwxrwxrwx   1 www      ade           27 Sep 10 16:23 Sybernet.Utility -> ../oraprod/Sybernet.Utility
    lrwxrwxrwx   1 www      ade           23 Sep 10 16:23 Sybernet.cgi -> ../oraprod/Sybernet.cgi
    lrwxrwxrwx   1 www      ade           26 Sep 10 16:23 Sybernet.config -> ../oraprod/Sybernet.config
    lrwxrwxrwx   1 www      ade           26 Sep 10 16:23 Sybernet.sumlog -> ../oraprod/Sybernet.sumlog
    lrwxrwxrwx   1 www      ade           27 Sep 10 16:23 Sybernet.utility -> ../oraprod/Sybernet.utility
    -rwxrwxrwx   1 www      ade         1653 Sep 10 16:23 toggle


toggle

toggle allows you to point oracle (oracle.html) to either oradev or oraprod. Its
usage is defined thusly:


    toggle [ oradev | oraprod ]


To interrogate the current status simply issue this


    ./toggle
    Currently configured for oraprod.


To point to oradev instead issue this


    ./toggle oradev
    Configuration changed to oradev


If you toggle between oradev and oraprod,  it is recommended that you first stop
Sybernet on oradev or oraprod to disconnect all users.  Clearly this is not nec-
cessary if that unix server is down.

If you are fast enough, issuing


    ./toggle oradev
    Configuration changed to oradev
    ./toggle oraprod
    Configuration changed to oraprod

could go unnoticed by the user, but any user attempting to submit a request while
you do this would be told that they are not connected.



--------------------------------------------------------------------------------

INSIDE SYBERCRON

Whenever you add an Oracle instance, Sybercron must be manually configured if you
want it to run on that database.  Configuring Sybercron simply means means adding
an entry to the start_sybercron script on each platform that you desire Sybercron
to run from. To use Leibnitz and HTTP.SP_CSV against this instance, you will also
need to update tables on all Sybase and Oracle servers.

start_sybercron

Here is a snapshot of the start_sybercron script on ORADEV:


    ./Sybercron -X -C 6990 -S ORADEV  -I ORADEV -T 60
    ./Sybercron -X -C 6992 -S ORAPROD -I ORADEV -T 60
	

For a description of each parameter that can be passed to Sybercron, please refer
to the documentation.

What is illustrated here is two copies of Sybercron.  One  points  to  the ORADEV
instance of Oracle, and the other points to the ORAPROD instance of Oracle.   The
-I (PLATFORM) flag tells Sybercron to look for all queued entries which are using
(or requesting) this platform at that instance.

Let's pretend you just created an Oracle instance called ORATEST.   If you wanted
to initiate a Sybercron job from oradev.cnad.sri.com,  then you would add another
line to the start_sybercron script.  It would look like this:


    ./Sybercron -X -C 6990 -S ORADEV  -I ORADEV -T 60
    ./Sybercron -X -C 6992 -S ORAPROD -I ORADEV -T 60
    ./Sybercron -X -C 6991 -S ORATEST -I ORADEV -T 60


If you later dropped this database,  then you would also delete the line you just
added.  In both cases you should also invoke start_sybercron after modifying this
script.


    ./start_sybercron


Remember that you want to update all start_sybercron scripts on all  hosts  where
you want Sybercron to run from.  If you want to invoke Sybercron from kirk,  then
the start_sybercron script on  kirk.cnad.sri.com  needs to be updated (specifying
KIRK as the platform). If you don't need to invoke Sybercron from ASTRO, then you
do not need to update the start_sybercron script on astro.cnad.sri.com.

HTTP.CRON_PLATFORMS

This table contains all valid platforms that a user may request when invoking the
function HTTP.SP_CRON_INSERT.   If ORATEST does not exist in this table,  then an
error is raised by any application that attempts to use it.

Sybercron will automatically add itself to this table because you added it to the
start_sybercron script.  But if you delete this line and restart Sybercron,  then
the row remains and users could specify an invalid platform name.

If you want to send yourself e-mail whenever Sybercron goes down,  simply  update
the MAILTO column in this table with your e-mail address.

HTTP.LEIBNITZ_HOSTS

This table is used by Leibnitz and HTTP.SP_CSV.  These procedures will reject any
request from the source server or the destination server if  they don't recognize
this host.   In the example above,  ORATEST must be added to LEIBNITZ_HOST on all
Sybase and Oracle servers.  Here is an example of how that is accomplished:


    INSERT INTO HTTP.LEIBNITZ_HOSTS
    (
           'ORATEST'
    ,      HOSTNAME
    ,      USERNAME
    ,      DIR
    ,      PLATFORM
    ,      PORT
    )
    SELECT DESTSERVER
    ,      HOSTNAME
    ,      USERNAME
    ,      DIR
    ,      PLATFORM
    ,      PORT
    FROM   HTTP.LEIBNITZ_HOSTS
    WHERE  DESTSERVER = 'ORADEV'


As of this writing the HOSTNAME, USERNAME and DIR columns are the same.  When the
HOSTNAME of the source server is  different  from the HOSTNAME of the destination
server,  then public key authentication needs to be established to transfer files
between two instances.

HTTP.CRON_KEYWORDS

This table is used by Sybercron Register  (HTTP.SP_HTML_CRON_REGISTER)  to create
user-friendly drop-down lists. If this table is empty, then no action is required
when you add a new instance because no drop-down list is created.   If you copied
this table from another instance, however,  then  it  is necessary to update both
DESTSERVER and SRCESERVER.  Here is an example of how that is accomplished:



    UPDATE HTTP.CRON_KEYWORDS                   --> all servers
    SET    VALUE = VALUE || ',ORATEST'
    WHERE  NAME = 'DESTSERVER'

    UPDATE HTTP.CRON_KEYWORDS                   --> ORATEST only
    SET    VALUE = 'ORATEST'
    WHERE  NAME = 'SRCESERVER'


The first update statement must be invoked an all Sybase and Oracle servers.  The
second update statement must be invoked from ORATEST only.





Sybernet is a trademark of SRI International.
Copyright © 1996-2004 SRI International. All Rights Reserved.
Denis D. Workman / http://Sybernet.sri.com/