Geneos


The end of life (EOL) date for this module is on 31 January, 2020.

oacluster.sh

Quick Start

To start a single node in the foreground using the default settings, simply run the script from the binary directory:

> ./oacluster.sh

Working with single node instances

The following commands will work with a single daemon node instance. The instance number will be used as the id and the port offset, so by default instance 1 will be on port 2551, instance 2 will be on port 2552, etc.

To start instance 1 as a daemon using the default settings:

> ./oacluster.sh --start 1

To check the process status of instance 1:

> ./oacluster.sh --process-status 1

To check the cluster membership status of instance 1:

> ./oacluster.sh --cluster-status 1

To stop instance 1:

> ./oacluster.sh --kill 1

Working with multiple node instances

The following commands operate on multiple instances, from 1 to <number>.

To run a 5 node cluster from port 2551 to 2555:

> ./oacluster.sh --start all 5

To get the process status of instances 1 to 5:

> ./oacluster.sh --process-status all 5

To get the process status of all running instances:

> ./oacluster.sh --process-status all

or

> ./oacluster.sh --process-status

To stop all instances 1 to 5:

> ./oacluster.sh --kill all 5

To stop all running instances:

> ./oacluster.sh --kill all

Flags

Main operations

Flag Abbr Arguments Description
–start -s <n> Starts the <n>th instance
    all <count> Starts instances 1 to <count>
–kill -k <n> Stops the <n>th instance
    all <count> Stops instances 1 to <count>
    all Stops all running instances
–process-status -ps <n> Gets the process status for the <n>th instance
    all <count> Gets the process status for instances 1 to <count>
    all Gets the process status for all running instances
      Gets the process status for all running instances
–cluster-status -cs <n> Gets the cluster status for the <n>th instance
    all <count> Gets the cluster status for instances 1 to <count>
    all Gets the cluster status for all running instances
      Gets the cluster status for all running instances
–echo -e   Echoes the run script, daemon script and the global settings
    run,start,settings Echoes the run script, daemon script or global settings respectively
–help -h   Prints some help

Optional

Flag Abbr Arguments Description
–outfile -o   If specified, daemon proccesses will create a .out file for stderr and stdout.
–log-level -ll INFO,WARN,ERROR,DEBUG,TRACE Sets the logging level. This will override OAC_LOG_LEVEL global setting.
–no-jmx -nj   Disables JMX. –cluster-status will not work.

Global Settings

These setting can be set as environment variables or set in a resources file. By default, the oacluster.sh script will read the ~/.oacluster.rc file on start up. In this file you can override variables as required.

In this example we set JAVA_HOME, OAC_HOME and the OAC_NODE_PORT_BASE. Setting OAC_HOME is required if you wish to move the script outside the default directory. Changing the OAC_NODE_PORT_BASE changes the listening port used. In this example the first instance will be on port 32551.

# ~/.oacluster.rc
JAVA_HOME=/usr/lib/jvm/java-8-oracle
OAC_HOME=/opt/geneos-openaccess-node/latest
OAC_NODE_PORT_BASE=32550

Note: run ./oacluster.sh--echosettings to see the current values for these in your environment.

Flag Description
JAVA_HOME Location of java. If not set, the script will guess based on the location of ‘java’.
OAC_HOME Location of the open access node binary. Defaults to the location of the script.
OAC_CONFIG_HOME The location of the configuration files, defaults to $OAC_HOME/config.
OAC_LOG_HOME The location of the log files, defaults to $OAC_HOME/logs.
OAC_PID_HOME The location of the pid and optional out files, defaults to $OAC_HOME/pids.
OAC_LOG_LEVEL The log level (e.g. DEBUG, WARNING). Defaults to INFO.
OAC_FILE_NAME_BASE The base name for logs and pid files. Defaults to the name of the script (oacluster). Note: The instance number will be appended to this (oacluster1.log, oacluster2.log etc).
OAC_JAVA_MEMORY The java heap size. Defaults to ‘1024M’.
OAC_NODE_PORT_BASE The base port for the nodes, each instance adds 1 to this. Defaults to 2550.
OAC_JMX_PORT_BASE The base JMX port for the nodes, each instance adds 1 to this. Defaults to 9990.

Use case: Changing directories and file names

By default, the configuration and log files are kept in a sub directory of the oacluster.sh location. It is a common requirement to specify different locations for these files.

In this use case we will:

  • Change the log directory to /opt/log/oanode
  • Change the pid directory to /tmp/nodepids
  • Change the configuration directory to /opt/config/oanode
  • Change log file and pid file names to start with mynode

Lets assume that the binary was extracted to /opt/node/latest and the user account that will run the node is called nodeuser. Firstly, we create resource file in the users home directory. As nodeuser:

> touch ~/.oacluster.rc

Now we can edit the ~/.oacluster.rc, and add the following entries:

OAC_LOG_HOME=/opt/log/oanode
OAC_PID_HOME=/tmp/nodepids
OAC_CONFIG_HOME=/opt/config/oanode
OAC_FILE_NAME_BASE=mynode

We now need to create the configuration files in /opt/config/oanode. In this case we will copy the default configuration from the binary directory.

> mkdir -p /opt/config/oanode
> cp /opt/node/latest/config/* /opt/config/oanode

You can now check the settings by running oacluster.sh-esettings:

> /opt/node/latest/oacluster.sh -e settings
Global resource exists, it will be read: /home/nodeuser/.oacluster.rc
JAVA_HOME=/usr/lib/jvm/java-8-oracle
OAC_HOME=/opt/node/latest
OAC_CONFIG_HOME=/opt/config/oanode
OAC_LOG_HOME=/opt/log/oanode
OAC_PID_HOME=/tmp/nodepids
OAC_LOG_LEVEL=INFO
OAC_FILE_NAME_BASE=mynode
OAC_JAVA_MEMORY=1024M
OAC_NODE_PORT_BASE=2550
OAC_JMX_PORT_BASE=9990

Now you can start 2 node instances in the background:

> /opt/node/latest/oacluster.sh -s 2

You should find that the logs and pid files are in the specified locations, for instance:

> ls -la /opt/log/oanode/mynode*
-rw-rw-r--  1 nodeuser nodeuser 12371 Apr 10 11:25 mynode1.log
-rw-rw-r--  1 nodeuser nodeuser  6418 Apr 10 11:28 mynode2.log