Skip to content

PostgreSQL proxy server using boost asio library

License

Notifications You must be signed in to change notification settings

leo-livis/psqlproxy

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SQLProxy server

SQLProxy server is designed to proxy tcp-requests for PostgreSQL database server.

PostgreSQL uses a message-based protocol for communication between frontends and backends (clients and servers). The protocol is supported over TCP/IP and also over Unix-domain sockets. Port number 5432 has been registered with IANA as the customary TCP port number for servers supporting this protocol, but in practice any non-privileged port number can be used.

Protocol version 3.0 documentation:

Setup database

For proxy to work with requests in plain text ssl option in postgresql.conf must be switched off

ssl = false

Create test role and database

$ psql -U postgres -h localhost
postgres=# CREATE USER test with PASSWORD 'test';
postgres=# CREATE DATABASE testdb WITH ENCODING='UTF8' OWNER=test;

Build sqlproxy

Commands to build sqlproxy

with scons

$ scons -Q

with cmake:

$ mkdir .build && cd .build
$ cmake ..
$ make

Example of configuration

logger {
    filename "sqlproxy.log"
}
proxy {
    proxy_ip "127.0.0.1"
    proxy_port 3333
    postgresql_ip "127.0.0.1"
    postgresql_port 5432
}

Execute command

$ sqlproxy --config sqlproxy.conf

Testing

$ pgbench -h localhost -U test -d testdb -p 3333 -c 32 -j 4 -T 360

About

PostgreSQL proxy server using boost asio library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 93.5%
  • CMake 3.4%
  • Python 3.1%