YugabyteDB - Database Detail Pattern
- Pattern Goal
- Queries Run
- Application Model Produced by Software Pattern
- Platforms Supported by the Pattern
- Identification
- Testing
Pattern Goal
Current pattern allows to discover and model all databases, schemas and tables for YugabyteDB instances as Detail nodes.
Queries Run
Query | Reason | Permission |
|---|---|---|
select datname from pg_database | Get database list | select permission on pg_database |
select pg_database_size(db name) | Get database sizes | connect permission on relevant database |
select version() | Get product version |
Application Model Produced by Software Pattern
The Yugabyte Query Layer (YQL) is the upper layer of YugabyteDB. Applications interact directly with YQL using client drivers. This layer deals with the API certain feature such as query or command compilation and the runtime. Currently YugabyteDB - Database Detail Pattern supports only YSQL. Starting from version 11.2 YugabyteDB SQL processing layer is built by using the PostgreSQL code.
Every YB-TServer is configured to support these protocols, on different ports. Default YSQL port is 5433. Clients can connect to any of the YB-TServers on the relevant port to perform operations against the YugabyteDB cluster.
By default the pattern skips:
- databases: "postgres", "template0", "template1", "yugabyte", "system_platform"
- schemas: "pg_catalog", "information_schema"
Configuration Options
There are several configuration options available for this product:
Option | Default value | Commentary |
|---|---|---|
ignore_databases | ["postgres", "template0", "template1", "yugabyte", "system_platform"] | List of databases to ignore. |
ignore_schemas | ["pg_catalog", "information_schema"] | List of schemas to ignore. |
model_schemas_and_tables | true | The pattern only creates schema and table nodes if this is true. Setting this option to true lengthens the runtime but provides a deeper model. |
Platforms Supported by the Pattern
The pattern identifies databases, schemas and tables of YugabyteDB running on UNIX platforms.
Identification
Software Instance Triggers
Pattern | Trigger Node | Attribute | Condition | Argument |
|---|---|---|---|---|
YugabyteDatabases | SoftwareInstance created, confirmed | type | in | 'YugabyteDB Tablet Server', 'YugabyteDB Master' |
Software Pattern Model
Modeling Databases
Databases are modeled as 'Database' nodes of the parent SoftwareInstance.
The pattern retrieves the list of databases using the YSQL JDBC driver.
The following table describes the attributes returned:
Modeled attribute | Description |
|---|---|
type | "YSQL Database" |
name | "YSQL Database <Database name>" |
short_name | Database name |
instance | Database name |
logical_database_type | "YSQL Database" |
SQL Query method
Databases list("YSQL Database") is obtained using sql query:
- "select datname from pg_database" , where each entry is a database name.
then, for each obtained database the pattern runs the following sql query:
- "select schemaname, tablename from pg_tables"
which obtains the list of all available schema names("YSQL Database Schema") and tables names("YSQL Database Table").
Pattern Trigger
YugabyteSchemas pattern triggers on the each created or confirmed Database where logical_database_type = 'YSQL Database'.
YugabyteTables pattern triggers on the each created or confirmed DatabaseDetail where full_type = 'YSQL Database Schema'.
Detail keys
Detail key consists of the key of the parent YugabyteDB instance and original database or table name, returned by active command.
Testing
The pattern has been tested against live installations of the YugabyteDB product on Linux CentOS platform.