Forum OpenACS Q&A: Re: Remote Postgresql DB Server
How to Connect to a remote PostGres database. This is a skeleton of what I'll put in the docs. It's based on the Reference Platform.
- On the database machine
- Edit the file /usr/local/pgsql/data/postgresql.conf
#tcpip_socket = falseto
tcpip_socket = trueand restart postgresql (service postgres restart)
- In the file /usr/local/pgsql/data/pg_hba.conf, grant access to a specific IP address (in this example, 192.168.0.12) by adding this line:
host all 192.168.0.12 255.255.255.255 trust
This line says that a computer ("host") at 192.168.0.12 (in conjuction with the netmask, which lets you specify a range of ips; in the example we use 255.255.255.255, which limits us to the exact ip) can access any database ("all") on the server. The word "trust" means no further authentication is required above the ip address.
For other kinds of remote access control, read the comments in the file. Nine different authentication modes are available.
- Edit the file /usr/local/pgsql/data/postgresql.conf and change
- On the client machine
The client machine is a computer running aolserver but using the remote database
- Edit /web/service0/etc/config.tcl and change each of the three instances of
ns_param datasource service0to
ns_param datasource 192.168.0.11::service0
In this example, 192.168.0.11 is the ip address of the database server and service0 is the name of the database.
Some other issues when running one OpenACS site across multiple servers (these are rough notes - I'll add details and incorporate everybody's opinions when I add to the actual docs):
- Synchronizing content. You can designate one as the master, presumably working from cvs, and then use rsync in a cron job from all other machines. I use
*/5 * * * * rsync -CruL -e ssh email@example.com:/web/service0/ /web/service0/
(su - to service0 and use crontab -e to edit the cron file. Since this uses ssh, you will have to set up certificates, as detailed in (to be detailed later), which you should do anyway so that the database connection can also be sshed.)
- Collecting all of the log files into one place
- Handling outgoing email