|-c configurationfile||Use this configuration file instead of /usr/local/etc/postgresql-relay.conf.|
|-f||Stay in the foreground, dont daemonize. The logging will be printed to stdout too.|
|-q||Be quiet, dont log anything|
|-v||Be verbose, log a lot.|
Each line in the configuration file has five fields, seperated by colons:
The first field is the incoming port for clients. For the easiest configuration on the client-side, keep this all the same (say port 5432 as the standard postgresql port).
The second field is the name of the database the client wants to connect to. This doesnt have to be the name of the database on the server connecting to.
The third field is the name of the host the database is located on.
The fourth field is the port the database is listening on.
The fifth field is the name of the database to connect to.
Say you have two databases, one named mail on the local machine on port 5444 and one named users on the machine foo on port 5445. The configuration file would then be:
With this configuration, Postgresql-relay will listen on port 5432 and forward connections to the mail and users databases.
Start the relay with a non-standard configuration file and keep it in the foreground:
postgresql-relay -c /usr/local/etc/postgresql-relay.conf.test -f
Now, in a different terminal, connect to to mail database:
psql -h dbserver -p 5432 -U root mail
postgresql-relay.conf, most likely in /usr/local/etc.
Postgresql-relay supports tcpwrappers. For access to postgresql-relay the daemon is called postgresql. For access to a database the daemon is called postgresql-dbname.
In the following example, the localhost and the hosts in the 10/8 network have access to postgresql-relay, while only the localhost and the 10.10.10.0/8 network have access to the database fdc:
postgresql : 10.0.0.0/255.0.0.0 : allow postgresql : 127.0.0.1 : allow postgresql : ALL : deny
postgresql-mail : 10.10.10.0/255.255.255.0 : deny postgresql-mail : 127.0.0.1 : allow postgresql-mail : ALL : deny
Logging goes to syslog, to the facility daemon.
It would be best practise if the name of the machine on which postgresql-relay is running would have an alias in DNS, so that even if the machine on which postgresql-relay is running changes, the scripts dont have to be updated. A recommended name is dbrelay.
If the communication protocol version is unknown, it should fail properly but this hasnt been tested.
Edwin Groothuis, firstname.lastname@example.org (http://www.mavetju.org)
|November 22, 2004||POSTGRESQL-RELAY (8)||November 22, 2004|