Coder Social home page Coder Social logo

allas's Introduction

allas

Introduction

allas is a connection pooler for PostgreSQL which only supports LISTEN / NOTIFY. The idea is to allow the application to use e.g. pgbouncer in transaction pooling mode while only receiving notifications through allas. allas only uses a single PostgreSQL connection and takes care of LISTENing and UNLISTENing appropriately on that connection to make sure all of its clients get the set of notifications they're interested in.

How to build

Clone the repository, and run "go build" in the cloned directory. This should produce a binary called "allas".

Configuration

The configuration file uses a JSON format and is organized into sections. The top level structure is a JSON object, with the following keys ("sections"):

listen

listen specifies how allas listens to new connections. It has three possible options:

  1. port (integer) specifies the port to listen on.
  2. host (string) specifies the address to listen on. The asterisk ("*") can be used to listen on all TCP interfaces, or an absolute path can be used to listen on a UNIX domain socket.
  3. keepalive (boolean) specifies whether TCP keepalives should be enabled or not.
connect

connect is a pq connection string. It supports many of libpq's options.

startup_parameters

startup_parameters is a JSON object specifying the list of "startup parameters" (such as the server's version number) to send to each client when they connect.

prometheus

prometheus is a JSON object with the following keys:

  1. listen (object) specifies how allas listens to connections from the Prometheus scraping process. The keys are the same as used by the main listen section, documented above. The port 9226 has been allocated in the Prometheus wiki for allas's use.
databases

databases is an array of JSON objects with the following keys:

  1. name (string) specifies the name of the database.
  2. auth (object) is described in the section Database authentication, below.

Database authentication

The auth key of a database configuration section is a JSON object with a combination of the following keys:

  1. method (string) is the authentication method used. There are only two values values: "trust" and "md5". Both match their respective counterpart in PostgreSQL HBA configuration.
  2. user (string) is the user name the user has to pass to match the authentication method.
  3. password (string) is a clear-text copy of the password the client should use for authentication.

Configuration example

Here's an example configuration file:

{
    "listen": {
        "port": 6433,
        "host": "localhost"
    },
    "connect": "host=localhost port=5432 sslmode=disable",
    "startup_parameters": {
        "server_version": "9.1.24",
        "client_encoding": "UTF8"
    },
    "prometheus": {
        "listen": {
            "port": 9226,
            "host": "*"
        }
    },
    "databases": [
        {
            "name": "allas",
            "auth": {
                "method": "md5",
                "user": "allas",
                "password": "s3cret"
            }
        }
    ]
}

allas's People

Contributors

johto avatar markottt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

allas's Issues

Hack for SET queries could possibly be removed.

These exceptions to allow some SET queries could possibly be removed if you instead had the JDBC users set the connection parameter assumeMinServerVersion to 9.0 or higher when connecting.

That will cause the JDBC driver to send those parameters in the startup message rather than as SET queries.

https://github.com/pgjdbc/pgjdbc/blob/c8a639edbd0cf39453048f1fd7d9412ec8e09293/pgjdbc/src/main/java/org/postgresql/core/v3/ConnectionFactoryImpl.java#L722

It could possibly be more future proof since the JDBC people are likely to add any other such properties in the same way in the future.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.