Master Domain Center (mdc)

Description

Domain entity storage.
Provides other roles within the site with access to data for organizing processes. Some data is pre-calculated inside the role.
Has direct access to the relational DBs of all domains, regardless of which sites serve them. On startup, loads domain data from the corresponding DBs into the cache.

Each domain maintains a permanent connection to its DB. Within each connection, a primitive query is executed every 5 minutes as a connection check. If the connection is lost, its recovery is initiated; during the absence of a connection, data of static collections managed by the domain center is available for reading but not for modification. When PostgreSQL streaming replication is used, the permanent connection is made only to the master instance of the DB server. However, after a restart or activation of the domain center microservice instance, if the master DB server instance is inaccessible, it can load caches by temporarily connecting to the recovery instance of the DB server.

Split into microservices by domains. Data is automatically synchronized between sites serving the domain.
Made redundant in Active-Passive mode. Scaled by splitting the domain tree.

Table 1. System characteristics

Code

mdc

Operation mode

Storage, service

Redundancy mode

Active-Passive

Site types

Master

Layer

Business logic

Placement

Internal

State preservation and recovery on restart

Yes

Application

era_dc

Own storage

PostgreSQL entity DB

Limitations

  • Present in the initial configuration.

  • Must be located only on the master site. On other sites, the sdc role is used instead.

  • If the role is unavailable, the master site does not function. As a consequence, other system sites do not synchronize domain data with each other. This matters when a domain is served on several sites.

Parameters

Table 2. Parameters
Name Type Default Description

name

str

required

Name. May consist of Latin letters and digits and must start with a letter.

roletype

str

required

Role type. Possible values: "mdc".

ext

json

empty

Additional role options. Contains a JSON object or list.

enabled

bool

empty

Role activity flag. When set to false, the role does not participate in validation and is not started.

limit_of_cores

int

empty

Limit on the number of CPU logical cores used. Default: 0 - unlimited.

logging_default_level

int

empty

Default logging level set specifically for the role instance (microservice type). More

allow_divergence

bool

false

Flag allowing parameter differences in roles of the same group. Default: false - not allowed.

dbconnstrings

array<str>

required

Connection strings to the PostgreSQL server farm where domain databases are located (created and used) with the entity storage managed by the domain center, and their change history.
Each domain has one permanently active DB connection. If the connection breaks, automatic reconnection occurs.
Each domain uses the original specified string only to create its own DB with the unique name 'r_domain_%DOMAIN%', and for operation uses a modified connection string where its own DB name is substituted as the database.
Connection string format: "alias://pgdb_strings/<ALIAS_NAME>", where <ALIAS_NAME> is a specific configuration alias from the pgdb_strings section.
Listing several connection strings provides standby access to the DB server farm: if connection via the first string fails, connection is made via the second, and so on.

Each connection string defined in the aliases section lists the following parameters separated by commas:

  • host — host (required);

  • port — port (required);

  • login — login (required);

  • pwd — password (required). Secret: ciphertext when read; the plaintext value is not returned via API and is decrypted by the service when used; a plaintext value can be supplied on input (Encryption and keys);

  • database — database name (required);

  • ssl — (optional) secure connection flag: false | true. If ssl is not used, omit the parameter.

  • auth_method — (optional) authorization mode when using ssl: cleartext, md5, scram-sha-256.

For example:

  • host:192.168.1.101,port:5432,login:erapgadmin,pwd:StrongPassword,database:postgres;

  • host:172.17.0.102,port:5441,login:User,pwd:Pwd,database:postgres,ssl:true;

  • host:10.0.1.103,port:5441,login:User,pwd:Pwd,database:postgres,ssl:true,auth_method:scram-sha-256.

group

int

required

Group number.
As part of horizontal scaling, the role can be split into several groups on a site, in each of which only one instance is active and the rest are standby.
Responsibility is divided between groups by domain sets. Together all groups serve the full domain set. All roles in one group must have the same responsibility.
An integer from 1 to 9999999.

order

int

required

Order of the role instance within the group.
Determines the order in which takeover occurs in Active-Passive mode.

include_domains

array<str>

empty

List of domain names served by this group.
Any domain of any level can be specified. Specifying a domain causes its subtree to be served on this group and not on other role groups, except for branches mentioned in other groups.
Together, all role groups on the site serve the full domain tree.

db_keepalive_interval_sec

int

300

Timer interval that initiates keepalive requests to the domain DB.
In normal mode, the connection is always kept active, and the system accesses the DB only to write data when the administrator changes settings, and to read change history.
If a domain connection breaks, the service immediately initiates a new connection.
Keepalive queries (SELECT 1) check DB availability through the active domain connection, and on timeouts reconnection is initiated.
Available values from 0 to 86400. 0 - keepalive disabled.

max_loading_domains

int

4

Limit on the number of simultaneously loaded domains.
Useful in systems with a large number of domains.
Used to limit CPU load during microservice restart.

takeover

bool

global

Takeover mode switch.

Failover - activation of a lower-priority service instance when the higher-priority service instance (leader of the active-passive group) is detected as unavailable.
Takeover - activation of the higher-priority service instance (leader of the active-passive group) during its recovery, accompanied by stopping the service on the lower-priority service instance.

  • If the mode is enabled, takeover is performed automatically.

  • If the mode is disabled, takeover is not performed; the recovered group leader temporarily becomes a follower and waits for the service to be unloaded on the lower-priority instance.

  • If the option is not set, its value from the current site parameters is used. If it is not set on the site, the value from the general section is used. If it is not set anywhere, takeover is enabled for more accurate load distribution according to the configured priorities.

allow_divergence

bool

false

Switch for validating different settings of MDC instances in one group.
Can be used at the configuration administrator’s responsibility, for example, to set different PostgreSQL connection strings for the active and passive instances of a group if the configuration needs to be adapted to the specifics of the PG cluster node layout.

When set to 'true', the validator stops blocking different instance settings, which may lead to loss of integrity.

domain_group

int

group

Domain distribution group number. Instances with the same value share the domain subtree (include_domains) as one group. Defaults to the group number.
An integer from 0.

Configuration example

Configuration management is performed in an application available to master domain administrators. The application hides the full configuration content, but it is still available through the API.

The configuration contains a section describing all instances of all roles. Parameters are defined for each specific role instance.

Node example
{
  "name": "mdc1",
  "roletype": "mdc",

  "dbconnstrings": [
    "alias://pgdb_strings/b",
    "alias://pgdb_strings/c"
  ],
  "group": 11020,
  "order": 2
}

See also