0

I have a windows instance that runs a postgresql database. It is a production database for analysis purpose. Since this database is not normally needed at night, we are thinking of shutting it down at night and turning it on in the morning to cut costs.

Is this a good way to approach it or database really should run 24/7?

If the database should not ever be turned off at all cost, what can I do to cut costs? Auto Scaling or other methods?

If the start/stop model is OK, do I need to run 'SIGTERM' or 'SIGINT' to shut it down first before I turn off the instance, or I just need to turn off the instance straight away? (Turn off the instance by running powershell from other instance).

When I turn on the server do I need to open postgresql program or does it start automatically?

Thank you

iamcastelli
  • 1,564
  • 2
  • 20
  • 30
gshtong
  • 137
  • 1
  • 2
  • 10

2 Answers2

0

Postgres itself doesn't need to run 24/7. The software itself is fine running whenever you want it to. The question is whether or not your environment can handle the database being offline - this is ultimately a question only you can answer.

Is your database used for something like serving a 24/7 website? Or is it used for something like supporting a 9am-5pm office? If you can guarantee that nobody is going to need to use it, feel free to shut it off.

If you register Postgres as a Windows service, then the service will start and stop automatically when the machine is booted or shutdown. If you use the normal Windows Shutdown, then Postgres will be safely stopped, if you register it as a service.

See here for how to register it as a service: Register and run PostgreSQL 9.0 as Windows Service

You don't want to just stop the VM or power off the machine abruptly since it may cause file corruption.

Community
  • 1
  • 1
antiduh
  • 11,853
  • 4
  • 43
  • 66
0

I haven't used postgresql on ms windows so can't answer the question about stopping it safely

But stopping the instance outside working hours is addressed in this question Auto Shutdown and Start Amazon EC2 Instance

It should be possible to use a very cheap micro or nano ec2 to control this

Community
  • 1
  • 1
Vorsprung
  • 32,923
  • 5
  • 39
  • 63