postgresql

package
v1.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 2, 2024 License: MIT Imports: 17 Imported by: 0

README

PostgreSQL Exporter

Write block data to a postgres database.

The database maintained by this plugin is designed to serve the Indexer API.

Connection string

The connection string is defined by the pgx database driver.

For most deployments, you can use the following format:

host={url} port={port} user={user} password={password} dbname={db_name} sslmode={enable|disable}

For additional details, refer to the parsing documentation here.

Data Pruning

The delete-task prunes old transactions according to its configuration. This can be used to limit the size of the database.

Pruning an Existing Database

The first run after enabling pruning for an existing database must delete all of the older transactions. For many configurations, this process may take many hours or days. While the initial delete is in progress, the transaction table will be locked, and you'll see database errors in the log.

Cloud Database Optimization

Many cloud databases like RDS will allocate storage as needed. Once allocated, they typically do not deallocate the storage if it is no longer needed. To realize the benefits of data pruning, you should consider migrating to a new database to reset the allocated storage. You can do this by starting a new deployment from scratch.

Configuration

name: postgresql
config:
    # Pgsql connection string
    # See https://github.com/jackc/pgconn for more details
    connection-string: "host= port=5432 user= password= dbname="

    # Maximum connection number for connection pool
    # This means the total number of active queries that can be running
    # concurrently can never be more than this
    max-conn: 20

    # The delete task prunes old transactions according to its configuration.
    # By default transactions are not deleted.
    delete-task:
        # Interval used to prune the data. The values can be -1 to run at startup,
        # 0 to disable, or N to run every N rounds.
        interval: 0

        # Rounds to keep
        rounds: 100000

Documentation

Index

Constants

View Source
const PluginName = "postgresql"

PluginName to use when configuring.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExporterConfig

type ExporterConfig struct {
	/* <code>connectionstring</code> is the Postgresql connection string<br/>
	See https://github.com/jackc/pgconn for more details
	*/
	ConnectionString string `yaml:"connection-string"`
	/* <code>max-conn</code> specifies the maximum connection number for the connection pool.<br/>
	This means the total number of active queries that can be running concurrently can never be more than this.
	*/
	MaxConn uint32 `yaml:"max-conn"`
	/* <code>test</code> will replace an actual DB connection being created via the connection string,
	with a mock DB for unit testing.
	*/
	Test bool `yaml:"test"`
	// <code>delete-task</code> is the configuration for data pruning.
	Delete util.PruneConfigurations `yaml:"delete-task"`
}

ExporterConfig specific to the postgresql exporter

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL