Coder Social home page Coder Social logo

pgbouncer-ng's Introduction

pgbouncer-ng

Ligthweight connection pooler for PostgreSQL (completely written in python).

Features:

  • Without authentication, everything is delegated to postgresql.
  • Ssl support, both at the pool, and in connection to postgresql.

How to install?

Fetch latest development branch from github and install this:

git clone git://github.com/niwibe/pgbouncer-ng.git
cd pgbouncer-ng
sudo python setup.py install

NOTE: gevent-1.0b1+ is required dependence.

How to configure:

The configuration is divided into 3 groups: global, local, remote. In global scope you can define limits for pooler. In local scope you can define settings for local pool: bind address or/and port, ssl certificate and ssl private key. And remote scope, you can define settings for remote postgresql connection.

In pgbouncerng.ini has sample/default configuration.

The order of search configuration file is:

  • ./pgbouncerng.ini
  • ~/.config/pgbouncerng.ini
  • /usr/local/etc/pgbouncerng.ini
  • /etc/pgbouncerng.ini

pgbouncer-ng's People

Contributors

superalex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

aek

pgbouncer-ng's Issues

SET TRANSACTION ISOLATION LEVEL error on even requests

/etc/pgbouncerng.ini

[local]
;host = unix:///var/run/postgresql/.s.PGSQL.5432
host = 127.0.0.1
port = 6666
ssl = false
ssl_key = example_server.key
ssl_crt = example_server.crt

[remote]
;host = unix:///var/run/postgresql/.s.PGSQL.5432
host = 127.0.0.1
port = 5432
ssl = false

[global]
poolsize = 20
maxconns = 200

/etc/postgresql/8.4/main/pg_hba.conf

[...]

Database administrative login by UNIX sockets

local all postgres trust
local all django trust

TYPE DATABASE USER CIDR-ADDRESS METHOD

"local" is for Unix domain socket connections only

local all all ident

IPv4 local connections:

host all all 127.0.0.1/32 md5
host all all 192.168.10.0/24 md5

IPv6 local connections:

host all all ::1/128 md5

/srv/codex/codex_hg/codex/settings.py

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'codex', # Or path to database file if using sqlite3.
'USER': 'django', # Not used with sqlite3.
'PASSWORD': 'holypassword', # Not used with sqlite3.
'HOST': '127.0.0.1', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '6666', # Set to empty string for default. Not used with sqlite3.
}

Product versions

Ubuntu Natty
PostgreSQL 8.4
python-gevent 0.13.0-1build1 gevent.version 0.13
django 1.4a1 rev17500

Traceback

Environment:

Request Method: GET
Request URL: http://codex.ithilien.eu/character/

Django Version: 1.4a1
Python Version: 2.7.1
Installed Applications:
('django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'django.contrib.admindocs',
'web',
'django.contrib.databrowse',
'django_extensions',
'south',
'taggit')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware')

Traceback:
File "/srv/django_svn/django-trunk/django/core/handlers/base.py" in get_response

  1.                     response = callback(request, _callback_args, *_callback_kwargs)
    
    File "/srv/codex/codex_hg/codex/web/views.py" in CharacterSectionView
  2. highlightedresult = Character.objects.filter(highlight=True).order_by('?')[0]
    
    File "/srv/django_svn/django-trunk/django/db/models/query.py" in getitem
  3.         return list(qs)[0]
    
    File "/srv/django_svn/django-trunk/django/db/models/query.py" in len
  4.         self._result_cache.extend(self._iter)
    
    File "/srv/django_svn/django-trunk/django/db/models/query.py" in iterator
  5.     for row in compiler.results_iter():
    
    File "/srv/django_svn/django-trunk/django/db/models/sql/compiler.py" in results_iter
  6.     for rows in self.execute_sql(MULTI):
    
    File "/srv/django_svn/django-trunk/django/db/models/sql/compiler.py" in execute_sql
  7.     cursor.execute(sql, params)
    
    File "/srv/django_svn/django-trunk/django/db/backends/util.py" in execute
  8.         return self.cursor.execute(sql, params)
    
    File "/srv/django_svn/django-trunk/django/db/backends/postgresql_psycopg2/base.py" in execute
  9.         return self.cursor.execute(query, args)
    

Exception Type: DatabaseError at /character/
Exception Value: SET TRANSACTION ISOLATION LEVEL debe ser llamado antes de cualquier consulta

Apache error logs

None

pgbouncer-ng logs

INFO: Now listening on 127.0.0.1:6666
DEBUG: New remote client connected from ('127.0.0.1', 51191)
DEBUG: Waiting for client data...
DEBUG: Creating socket for remote connection.
DEBUG: Connection not found on pool, creating new.
DEBUG: Authenticating client...
DEBUG: Entering on recv/send loop...
DEBUG: Connection is closed in any socket.
DEBUG: Client connection is break.
DEBUG: Reset database connection state.
DEBUG: Returning connection to pool.
DEBUG: Current pool size: 1

OK!

DEBUG: New remote client connected from ('127.0.0.1', 51193)
DEBUG: Waiting for client data...
DEBUG: Creating socket for remote connection.
DEBUG: Remote connection found on pool, returning this.
DEBUG: Authenticating client...
DEBUG: Entering on recv/send loop...
DEBUG: Connection is closed in any socket.
DEBUG: Server connection is break. Closing all connections.

ERROR!

DEBUG: New remote client connected from ('127.0.0.1', 51195)
DEBUG: Waiting for client data...
DEBUG: Creating socket for remote connection.
DEBUG: Connection not found on pool, creating new.
DEBUG: Authenticating client...
DEBUG: Entering on recv/send loop...
DEBUG: Connection is closed in any socket.
DEBUG: Client connection is break.
DEBUG: Reset database connection state.
DEBUG: Returning connection to pool.
DEBUG: Current pool size: 1

OK!

etc.

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.