Table of Contents |
---|
Backend rever server uses SQL DB to store stream history. It is recommended to use Postgresql. Embedded H2 DB is allowed for debug and testing purposes, but it should not be used in production.
...
Backend server SQL DB contains the following tables which are created automatically on first launch:
Field | Type | Note |
---|---|---|
ALARM | ||
id | bigint | PRIMARY KEY |
name | character varying(255) | UNIQUE CONSTRAINT |
time | bigint | |
type | bigint | |
value | bigint | |
metric_id | bigint | FOREIGN KEY REFERENCES metric(id) |
node_id | bigint | FOREIGN KEY REFERENCES node(id) |
METRIC | ||
id | bigint | PRIMARY KEY |
enum_name | character varying(255) | UNIQUE CONSTRAINT |
name | character varying(255) | UNIQUE CONSTRAINT |
note | character varying(255) | |
NODE | ||
id | bigint | PRIMARY KEY |
host | character varying(255) | UNIQUE CONSTRAINT |
NODE_PROFILE | ||
node_id | bigint | FOREIGN KEY REFERENCES node(id) |
profile_id | bigint | FOREIGN KEY REFERENCES profile(id) |
PROFILE | ||
id | bigint | PRIMARY KEY |
name | character varying(255) | UNIQUE CONSTRAINT |
rate | integer | |
PROFILE_METRICS | ||
profile_id | bigint | FOREIGN KEY REFERENCES profile(id) |
metrics_id | bigint | FOREIGN KEY REFERENCES metric(id) |
PROFILE_RULE | ||
profile_id | bigint | FOREIGN KEY REFERENCES profile(id) |
rule_id | bigint | FOREIGN KEY REFERENCES rule(id) |
RULE | ||
id | bigint | PRIMARY KEY |
name | character varying(255) | UNIQUE CONSTRAINT |
type | bigint | |
value | character varying(255) | |
STREAM | ||
id | bigint | PRIMARY KEY |
create_date | timestamp without time zone | |
duration | bigint | |
media_id | character varying(255) | |
name | character varying(255) | |
node_id | bigint | FOREIGN KEY REFERENCES node(id) |
publisher_id | bigint | FOREIGN KEY REFERENCES stream(id) |
STREAM_STATUS | ||
id | bigint | PRIMARY KEY |
status | character varying(255) | |
timestamp | timestamp without time zone | |
stream_id | bigint | FOREIGN KEY REFERENCES stream(id) |
Postgresql installation and setup
1. Install Postgresql (to for example, on CentOS 7 for example) with command
Code Block | ||||
---|---|---|---|---|
| ||||
yum install postgresql-server |
...
Code Block | ||||
---|---|---|---|---|
| ||||
\q exit |
DB queries optimizing
In builds before 1.163, to speed up Postgresql and to decrease CPU load, the following indexed should be created after successfull launch of WCS OAM:
Code Block | ||||
---|---|---|---|---|
| ||||
CREATE INDEX ON stream(name, media_id, node_id);
CREATE INDEX ON stream(node_id, name, status);
CREATE INDEX ON stream(publisher_id); |
Data structure of stream table in wcsoam database should look as follows: