WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: All in RAM except DB (is it possible?)  (Read 2240 times)

Offline malloc69

  • Newbie
  • *
  • Posts: 5
All in RAM except DB (is it possible?)
« on: February 16, 2011, 04:31:14 AM »
I've a tinycore 3.4.1 running with extensions en PPR mode. I'm using postgres and the database can grow quite large, so I do not care to keep the database in the file mydata.tgz (take much to shut down the system). It is also essential to turn off the computer, unplugging it directly from the outlet (better not ask).

What way could load the system and the extensions in RAM (PPR) and leave only the files of the database on disk (PPI).

with this what I try is to prevent the system is corrupted when i turn it off, keeping the database as safe as possible.

thanks

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14851
Re: All in RAM except DB (is it possible?)
« Reply #1 on: February 16, 2011, 06:02:17 AM »
I've never used postgres, but doesn't it give you the option to choose where to store the database? If so, you can specify somewhere on permanent storage.

If postgres does not allow you to choose where to store the database, you could use a symlink to direct it to somewhere on permanent storage and just enter the symlink in filetool.lst

Offline Arslan S.

  • Hero Member
  • *****
  • Posts: 825
Re: All in RAM except DB (is it possible?)
« Reply #2 on: February 16, 2011, 08:56:12 AM »
from postgres --help
Code: [Select]
-D DATADIR      database directoryso example usage
Code: [Select]
postgres -D /mnt/hda1/db_data
« Last Edit: February 16, 2011, 08:58:50 AM by Arslan S. »

Offline malloc69

  • Newbie
  • *
  • Posts: 5
Re: All in RAM except DB (is it possible?)
« Reply #3 on: February 16, 2011, 09:17:10 AM »
thank you both. your answers are helpful to me.

Offline malloc69

  • Newbie
  • *
  • Posts: 5
Re: All in RAM except DB (is it possible?)
« Reply #4 on: February 18, 2011, 05:29:21 AM »
I take this post, to indicate how PostgreSQL should be started at boot the system (and maybe save someone some time).

Add the following line in the file '/opt/bootlocal.sh':

Code: [Select]
su tc -c 'postgres -D path_to_data_dir &'
« Last Edit: February 18, 2011, 08:21:08 AM by malloc69 »

Offline Arslan S.

  • Hero Member
  • *****
  • Posts: 825
Re: All in RAM except DB (is it possible?)
« Reply #5 on: February 18, 2011, 02:22:25 PM »
Code: [Select]
start-stop-daemon --verbose --oknodo --background --chuid "tc:staff" --start --exec "/usr/local/bin/postgres" -- "-D /path/to/datadir"
i will add an init.d script next update