Controller: /nodeworx/cluster/lb

Required Permissions

CLUSTERING

Action: addService

Added in Version

4.7.0-339

Description

Add load balancing to a service.

Input Parameters

Name

Type

Required?

Example Values

Default Values

Notes

service_port

integer

Yes

80, 443, 25, 587, 110, 995, 143, 993

virtual_ip

string

Yes

0.0.0.0, 192.168.0.3, 192.168.0.4, 192.168.0.5

A virtual IP will be shared and load-balanced among your cluster according to policies set here. Load-balancing IPv6 addresses requires Linux kernel >= 2.6.28-rc3 and ipvsadm >= 1.25. Both are provided by default in RHEL 6 and CentOS 6.

policy

string

Yes

rr, wrr, lc, wlc, lblc

persistent

integer

Yes

0, 300, 1800, 3600

300

weight_apidocs.interworx.com

integer

No*

0, 1

1

weight_apidocs-node1.interworx.com

integer

No*

0, 1

1

* indicates that it’s actually required, but probably already has a valid default value.

Action: deleteService

Added in Version

4.7.0-339

Description

Delete loadbalancing of a service.

Input Parameters

Name

Type

Required?

Example Values

Default Values

Notes

services

struct (string)

Yes

192.168.0.3:80, 192.168.0.4:80, 192.168.0.5:80

Action: editService

Added in Version

4.7.0-339

Description

Edit a clustered service.

Input Parameters

Name

Type

Required?

Example Values

Default Values

Notes

service

string

Yes

192.168.0.3:80, 192.168.0.4:80, 192.168.0.5:80

policy

string

No*

rr, wrr, lc, wlc, lblc

rr

persistent

integer

No*

0, 300, 1800, 3600

300

weight_apidocs.interworx.com

integer

No*

0

1

weight_apidocs-node1.interworx.com

integer

No*

0

1

* indicates that it’s actually required, but probably already has a valid default value.

Action: externalLb

Added in Version

6.3.0-1630

Description

Set external load balancer mode on/off (beta).

Input Parameters

Name

Type

Required?

Example Values

Default Values

Notes

external_lb

integer

No*

1, 0

0

InterWorx runs a LVS load balancer on the cluster manager server. This can be replaced with an external load balancer configuration, but must be configured and managed outside of InterWorx. This is required if the network environment does not support LVS load balancing. <a target=”_blank” href=”https://www.interworx.com/support/faq/enable-external-load-balancer-mode-aws-elastic-load-balancer-google-load-balancer/”>Full Documentation</a>

* indicates that it’s actually required, but probably already has a valid default value.

Action: fail

Added in Version

4.7.0-339

Description

Magic function - test for failure mechanism.

Action: isRunning

Added in Version

4.7.0-339

Description

Checks if the service is running or not.

Sample Output

array (
  'status' => 0,
  'payload' => true,
  'reply_code' => 205,
)

Action: isRunningOnNode

Added in Version

4.7.0-339

Description

Checks if the service is running on a specific node (Clustering only).

Input Parameters

Name

Type

Required?

Example Values

Default Values

Notes

node_id

string

No*

* indicates that it’s actually required, but probably already has a valid default value.

Action: listCurrentLoadBalancerStatus

Added in Version

4.7.0-339

Description

Lists the current load balancer status.

Sample Output

array (
  'status' => 0,
  'payload' =>
  array (
    '192.168.0.3:80' =>
    array (
      'info' =>
      array (
        'protocol' => 'TCP',
        'vip' => '192.168.0.3',
        'port' => '80',
        'pport' => 'http',
        'policy' => 'rr',
        'ppolicy' => '##LG_ROUND_ROBIN##',
        'persistent' => '300',
      ),
      'realservers' =>
      array (
        '192.168.0.1:80' =>
        array (
          'vip' => '192.168.0.1',
          'port' => '80',
          'forward' => 'Route',
          'weight' => '1',
          'active' => '0',
          'inactive' => '0',
        ),
        '192.168.0.254:80' =>
        array (
          'vip' => '192.168.0.254',
          'port' => '80',
          'forward' => 'Route',
          'weight' => '1',
          'active' => '0',
          'inactive' => '0',
        ),
      ),
    ),
    '192.168.0.4:80' =>
    array (
      'info' =>
      array (
        'protocol' => 'TCP',
        'vip' => '192.168.0.4',
        'port' => '80',
        'pport' => 'http',
        'policy' => 'rr',
        'ppolicy' => '##LG_ROUND_ROBIN##',
        'persistent' => '300',
      ),
      'realservers' =>
      array (
        '192.168.0.1:80' =>
        array (
          'vip' => '192.168.0.1',
          'port' => '80',
          'forward' => 'Route',
          'weight' => '1',
          'active' => '0',
          'inactive' => '0',
        ),
        '192.168.0.254:80' =>
        array (
          'vip' => '192.168.0.254',
          'port' => '80',
          'forward' => 'Route',
          'weight' => '1',
          'active' => '0',
          'inactive' => '0',
        ),
      ),
    ),
    '192.168.0.5:80' =>
    array (
      'info' =>
      array (
        'protocol' => 'TCP',
        'vip' => '192.168.0.5',
        'port' => '80',
        'pport' => 'http',
        'policy' => 'rr',
        'ppolicy' => '##LG_ROUND_ROBIN##',
        'persistent' => '300',
      ),
      'realservers' =>
      array (
        '192.168.0.1:80' =>
        array (
          'vip' => '192.168.0.1',
          'port' => '80',
          'forward' => 'Route',
          'weight' => '1',
          'active' => '0',
          'inactive' => '0',
        ),
        '192.168.0.254:80' =>
        array (
          'vip' => '192.168.0.254',
          'port' => '80',
          'forward' => 'Route',
          'weight' => '1',
          'active' => '0',
          'inactive' => '0',
        ),
      ),
    ),
  ),
  'reply_code' => 205,
)

Action: listGeneralName

Added in Version

4.7.0-339

Description

Lists the “normal” name - ie “web server” instead of “httpd”.

Sample Output

array (
  'status' => 0,
  'payload' => '##LG_LOAD_BALANCER##',
  'reply_code' => 205,
)

Action: listPortNumbers

Added in Version

4.7.0-339

Description

Lists a string of the port numbers that this service uses, comma-seperated.

Sample Output

array (
  'status' => 0,
  'payload' => '##LG_NOT_APPLICABLE##',
  'reply_code' => 205,
)

Action: listPortNumbersArray

Added in Version

4.7.0-339

Description

Lists array of port numbers and ranges that this service uses.

Sample Output

array (
  'status' => 0,
  'payload' =>
  array (
    0 => '##LG_NOT_APPLICABLE##',
  ),
  'reply_code' => 205,
)

Action: listRequiredPermissions

Added in Version

4.7.0-339

Description

Lists an array of permissions required to control the service.

Sample Output

array (
  'status' => 0,
  'payload' =>
  array (
    0 => 'CLUSTERING',
  ),
  'reply_code' => 205,
)

Action: listServiceInfo

Added in Version

4.7.0-339

Description

Lists the service name, ports, page, and status.

Sample Output

array (
  'status' => 0,
  'payload' =>
  array (
    'id' => 'ipvsadm',
    'name' => '##LG_LOAD_BALANCER##',
    'ports' => '##LG_NOT_APPLICABLE##',
    'page' => '/nodeworx/cluster/lb',
    'ctrl' => '/nodeworx/cluster/lb',
    'is_running' => 1,
  ),
  'reply_code' => 205,
)

Action: listServiceName

Added in Version

4.7.0-339

Description

Lists the service name - ie “httpd” instead of “web server”.

Sample Output

array (
  'status' => 0,
  'payload' => 'ipvsadm',
  'reply_code' => 205,
)

Action: listServicePage

Added in Version

4.7.0-339

Description

Lists the page that controls the service.

Sample Output

array (
  'status' => 0,
  'payload' => '/nodeworx/cluster/lb',
  'reply_code' => 205,
)

Action: queryEditService

Added in Version

5.1.0-838

Description

Displays the information available to the action “editService”.

Input Parameters

Name

Type

Required?

Example Values

Default Values

Notes

service

string

Yes

192.168.0.3:80, 192.168.0.4:80, 192.168.0.5:80

Sample Output

array (
  'status' => 0,
  'payload' =>
  array (
    'service_copy' => '192.168.0.3:80',
    'policy' => 'rr',
    'persistent' => '300',
    'service' => '192.168.0.3:80',
    'port' => '80',
    'vip' => '192.168.0.3',
    'nodes' =>
    array (
      'apidocs.interworx.com' => '1',
      'apidocs-node1.interworx.com' => '1',
    ),
  ),
  'reply_code' => 205,
)

Action: querySettings

Added in Version

5.1.0-838

Description

Displays the information available to the action “settings”.

Sample Output

array (
  'status' => 0,
  'payload' =>
  array (
    'emailalert' => '',
    'emailalertstatus' =>
    array (
    ),
  ),
  'reply_code' => 205,
)

Action: reroute

Added in Version

4.7.0-339

Description

Action to re-route from the current controller to a different one.

Input Parameters

Name

Type

Required?

Example Values

Default Values

Notes

controller

string

Yes

Index, Overview, Users, Lang, Apikey, Plugins, Twofactorauth, Notice, Siteworx, Shell, Packages, Backup, Import, Softaculous, Reseller, ResellerPackages, ResellerBandwidthhistory, Http, Phpextensions, Ftp, Sshd, MailMta, MailSmtp, MailSmtp2, MailSend, MailMda, MailMsa, MailDovecot, MailSpam, MailVirus, MailMailman, MailQueue, Mysql, MysqlRemote, MysqlPhpmyadmin, Dns, DnsZone, DnsRecord, DnsSync, Nfs, NfsExport, NfsMount, Health, Cron, Firewall, Ssl, Logs, Settings, Updates, Rrd, …

Action: restart

Added in Version

4.7.0-339

Description

Restart the service.

Action: restartOnNode

Added in Version

4.7.0-339

Description

Restarts the service on a specific node (Clustering only).

Input Parameters

Name

Type

Required?

Example Values

Default Values

Notes

node_id

string

No*

* indicates that it’s actually required, but probably already has a valid default value.

Action: settings

Added in Version

4.7.0-339

Description

Modify ldirectord variables.

Input Parameters

Name

Type

Required?

Example Values

Default Values

Notes

emailalert

string

No

Email address that will receive status changes.

emailalertstatus

struct (string)

No

starting, running, stopping, reloading

Which status changes should be sent out as alerts.

Action: start

Added in Version

4.7.0-339

Description

Start the service.

Action: startOnBoot

Added in Version

4.7.0-339

Description

Set the loadbalancer start on boot status.

Input Parameters

Name

Type

Required?

Example Values

Default Values

Notes

startonboot

integer

No*

1, 0

1

If set to ‘Yes’, the Load Balancer will be automatically started when the server starts up

* indicates that it’s actually required, but probably already has a valid default value.

Action: startOnNode

Added in Version

4.7.0-339

Description

Starts the service on a specific node (Clustering only).

Input Parameters

Name

Type

Required?

Example Values

Default Values

Notes

node_id

string

No*

* indicates that it’s actually required, but probably already has a valid default value.

Action: stop

Added in Version

4.7.0-339

Description

Stop the service.

Action: stopOnNode

Added in Version

4.7.0-339

Description

Stops the service on a specific node (Clustering only).

Input Parameters

Name

Type

Required?

Example Values

Default Values

Notes

node_id

string

No*

* indicates that it’s actually required, but probably already has a valid default value.

Action: win

Added in Version

4.7.0-339

Description

Magic function - test for testing success mechanism.