Cluster nodes.conf

From ISPWiki

Jump to: navigation, search

Each cluster node may be described as follows:

Node <IP> { node parameter ... };

where <IP> is the unique IP-address of a cluster node.

Contents

Node parameters

Only the Role parameter is currently supported, it can be specified several times and should be described as follows:

Role <role name>;

or 

Role <role name> { role parameter ... };

where <role name> is a random symbol, such as a-z, A-Z, 0-9. You can describe any number of roles with different names. There are several roles for internal use only.

Predefined roles

ClusterCtl

This role allows to gain access via cluster protocol (see oproxy.conf). Description:

Role ClusterCtl {
  Password "secret";
  Port 654;
  AcceptLogs yes;
};

Where:

Password
the access password.
Port
the port on which oProxy listens the cluster protocol.
AcceptLogs
accept HTTP logs.

FrontendHTTP

On the node where this role is specified, oProxy will start in the HTTP proxying mode. The role should include HTTP proxying parameters.

Role FrontendHTTP {
  Listen "0.0.0.0:80";
  KeepAliveTimeout 30;
  BackendConnectTimeout 10;
  BackendDownRetryTime 10;
  HttpProtocolTimeout 120;
  HttpsProtocolTimeout 120;
  DisabledFile "/usr/local/ispmgr/etc/cluster_site_disabled.html";
  NotFoundFile "/usr/local/ispmgr/etc/cluster_site_not_found.html";
  AllBackendsDownFile "/usr/local/ispmgr/etc/cluster_all_backends_down.html";
  LogHostNotFound on;
  LogHostDisabled on;
  LogProtocolErrors on;
  MaxOpenHttpLogs 10;
  EnableSendfile on;
  FhCacheSize 10;
  FhCacheTimeout 10;
  ErrorsWatchInterval 30;
  ErrorsWatchPercent 50;
  ErrorsWatchSleep 10;
};


Listen
the socket address. The path to the Unix-socket or address in the format <IP:Port>.
KeepAliveTimeout
the interval to wait for the next request.
BackendConnectTimeout
the interval in seconds to wait for connection.
BackendDownRetryTime
the interval in seconds to wait for next check.
HttpProtocolTimeout
the interval to wait for data through HTTP.
HttpsProtocolTimeout
the interval to wait for data through HTTPS.
DisabledFile
the file that is returned when trying to open a disabled site.
NotFoundFile
the file that is returned when trying to open a non-existent site.
AllBackendsDownFile
the file that is returned when trying to open a site that does not have active backend servers.
LogHostNotFound
log information about requests to non-found sites.
LogHostDisabled
log information about requests to disabled sites.
LogProtocolErrors
log protocol errors.
MaxOpenHttpLogs
he size of the HTTP log cache.
EnableSendfile
call the kernel sendfile().
FhCacheSize
the file descriptor cache size.
FhCacheTimeout
cache reset time.
ErrorsWatchInterval
the interval to view HTTP errors.
ErrorsWatchPercent
the percentage of the maximum number of HTTP errors.
ErrorsWatchSleep
HTTP check time.

BackendHTTP

This role defines that one or several Apache web-servers are located on the node.

Role BackendHTTP {
  Port 80;
  MaxConnections 1000;
  PercentOfTotalConnections 100;
  WebServer 10.0.1.1 "/etc/apache2/configs/10.0.1.1.conf" "/etc/apache2/webservers-conf.d/10.0.1.1" {
    DefaultForNewUsers 1;
  };
};

Role parameters include:

Port
port on which web-servers are running.
MaxConnections
maximum number of simultaneous connections oProxy sends to the web-servers of this node.
PercentOfTotalConnections
percent of simultaneous connections to web-server of this node to total number of simultaneous connections to all the nodes. The default value is 100.
WebServer
web-server description. This parameter can be specified several times.

WebServer

Each web-server can be described as follows:

WebServer <IP> "/path/to/configuration/file" "/path/to/directory/with/files" { web-server parameters ... };

Web-server parameters include:

DefaultForNewUsers
defines that a web-server will be used for hosting new users. Указывает, что данный веб-сервер будет использован для размещения новых пользователей.

FrontendMySQL

On the node where this role is specified oProxy will start in the MySQL proxying mode. The role includes MySQL proxying parameters.

Role FrontendMySQL {
  Listen "0.0.0.0:3306";
  Listen "/tmp/mysql.sock";
  Listen "/var/run/mysqld/mysqld.sock";
  KeepAliveTimeout 20;
  BackendConnectTimeout 600;
  BackendDownRetryTime 10;
  MaxSaveQueryLength 200;
};
Listen
the socket address. The path to the Unix-socket and address in the format <IP:Port>.
KeepAliveTimeout
the interval to wait for the next connection.
BackendConnectTimeout
the interval in seconds to wait for connection.
BackendDownRetryTime
the interval to wait for next check.
MaxSaveQueryLength
the length of the SQL to be stored.

BackendMySQL

This role defines that the node is a MySQL server-backend.

Role BackendMySQL {
  Port 3307;
  Enabled 1;
  Priority 0;
  MaxConnections 10000;
}
Port
the port that the MySQL server is bound to.
Enabled
current status of the MySQL server. If the server is stopped, this option will be automatically set to "0", and oProxy will switch to an available server.
Priority
the MySQL server priority. One with the minimum priority is used by default.
MaxConnections
the maximum number of simultaneous connections, sent by oProxy to the web-server of this node.

Role description

This file describes the global role parameters, for example, which scripts should be started and stopped on the servers that run a role. The clusterctl utility is used for starting and stopping the scripts.

Record format

The following records must be described on the top level of the configuration file , i.e, outside Node { ... }

Role BackendHTTP {
        Start "/usr/local/ispmgr/etc/cluster_roles/init.d/oproxy start";
        Start "/usr/local/ispmgr/etc/cluster_roles/init.d/HTTP start";

        Stop "/usr/local/ispmgr/etc/cluster_roles/init.d/HTTP stop";
        Stop "/usr/local/ispmgr/etc/cluster_roles/init.d/oproxy stop";
};

Al the scripts are run in the order they were described. I.e. in the example given above oproxy-mysql will start first, followed by HTTP. When stopping, they will start in the reverse order.

Functions

The roles defines which services on which nodes to start. In order to start the roles of the current node use

/usr/local/ispmgr/sbin/clusterctl --node LOCAL start

In order to stop: /usr/local/ispmgr/sbin/clusterctl --node LOCAL stop

Was this helpful? Yes | No
Personal tools