26.1. Configuring the Metadata Catalog #
Metadata tables of pgpro_metastore are stored in the axe_catalog schema of the Postgres Pro DBMS, or in the so-called metadata catalog. This catalog can be initialized on the local Postgres Pro AXE server or on a remote server.
26.1.1. Defining a Metadata Catalog Connection (define_catalog_connection) #
You must define a metadata catalog connection regardless of whether the metadata catalog is initialized on the local Postgres Pro AXE server or on a remote server.
Required privileges: Postgres Pro AXE administrator only. For more information about stored procedures and privileges, refer to Section 18.1.
Execute the following command on the Postgres Pro AXE server:
SELECT metastore.define_catalog_connection('host', 'port', 'database', 'username', 'password');
Where:
hostandport: The hostname and port for connecting to the server where to initialize the metadata catalog later.database: The name of the server database where to create metadata tables.usernameandpassword: The username and password for connecting to the Postgres Pro DBMS on the server.
If one of these parameters is missing, pass an empty string as a value.
Example 26.1. Defining a Metadata Catalog Connection without a Username and Password
SELECT metastore.define_catalog_connection('localhost','5433','postgres','','');
For the changes to take effect, reconnect to the Postgres Pro AXE server (not to the server with the metadata catalog).
Postgres Pro AXE performs the following actions:
Checks input parameters and user privileges.
Updates the foreign server (
metastore_catalog) using the specified public connection parameters of the server with the metadata catalog:ALTER SERVER metastore_catalog OPTIONS ( SET host 'host', SET port 'port', SET dbname 'database', SET user 'username' );Updates the user mapping for the
PUBLICrole using the specified private connection parameters of the server with the metadata catalog:ALTER USER MAPPING FOR PUBLIC SERVER metastore_catalog OPTIONS ( SET password 'password' );
If the connection to the server with the metadata catalog fails when performing one of the stored procedures, you are automatically reconnected using the last connection parameters.
Example 26.2.
postgres=# SELECT metastore.remove_storage('mt_storage');
INFO: Connection failed! Trying to reconnect.
INFO: Reconnecting...1
INFO: Reconnect successful!
remove_storage
-----------------------------------
Storage was removed successfully.
(1 row)
26.1.2. Initializing the Metadata Catalog (init) #
When you initialize the metadata catalog, metadata tables are created in the server database.
Before performing this instruction, define a metadata catalog connection.
Required privileges: Postgres Pro AXE administrator only. For more information about stored procedures and privileges, refer to Section 18.1.
Execute the following command on the Postgres Pro AXE server:
SELECT metastore.init(force_init bool DEFAULT false)
Where force_init specifies whether to reinitialize the metadata catalog if it is already initialized on the server.
Postgres Pro AXE performs the following actions:
Checks input parameters and user privileges.
If the
force_initparameter is set tofalseand theaxe_catalogschema already exists on the server, outputs a warning that the metadata catalog is already initialized and terminates the command. Otherwise, Postgres Pro AXE initializes the metadata catalog on the server.If the
force_initparameter is set totrue, performs the following actions:Deletes all proxy tables from the
metastoreschema on the Postgres Pro AXE server.Reinitializes the metadata catalog on the server.