Mainos / Advertisement:

Ero sivun ”PostgreSQL” versioiden välillä

Kohteesta Taisto
Siirry navigaatioon Siirry hakuun
Rivi 54: Rivi 54:
  
 
Tarkista sysctl -p komennolla että arvot ovat oikein.
 
Tarkista sysctl -p komennolla että arvot ovat oikein.
 +
 +
== Komentoja ==
 +
 +
Yhdistäminen tietokantapalvelimelle PostgreSQL-palvelimelta konsolilla
 +
 +
  sudo -u postgres psql
 +
 +
Lisää kaikki tietokannat
 +
 +
\l
 +
 +
== Varmuuskopiointi ==
 +
 +
Tässä yksinkertainen tapa tehdä SQL dumppi tietokannasta postgres.
 +
 +
  sudo -u postgres pg_dump postgres > postgres-backup-$(date '+%y%m%d').sql
  
 
== Lähteet ==
 
== Lähteet ==
  
 
http://leopard.in.ua/2013/09/05/postgresql-sessting-shared-memory/
 
http://leopard.in.ua/2013/09/05/postgresql-sessting-shared-memory/

Versio 22. kesäkuuta 2017 kello 18.19

PostgreSQL on tietokantaohjelmisto.

Asennus

 aptitude install postgresql

Konfigurointi

Jaettu muisti

Yleinen virhe:

FATAL:  could not create shared memory segment: Invalid argument
DETAIL:  Failed system call was shmget(key=5440001, size=4011376640, 03600).

This error usually means that PostgreSQL's request for a shared memory
segment exceeded your kernel's SHMMAX parameter. You can either
reduce the request size or reconfigure the kernel with larger SHMMAX.
To reduce the request size (currently 4011376640 bytes), reduce
PostgreSQL's shared_buffers parameter (currently 50000) and/or
its max_connections parameter (currently 12).

Kuinka korjata:

Sinun tulee konfiguroida Unix System jaettu muisti, jos haluat saada PostgreSQL toimimaan.

Tässä alla on scripti joka laskee shmax ja shmall arvot. Tallenna scripti esimerkiksi shcalc.sh ja aja se.

#!/bin/bash
# simple shmsetup script
page_size=`getconf PAGE_SIZE`
phys_pages=`getconf _PHYS_PAGES`
shmall=`expr $phys_pages / 2`
shmmax=`expr $shmall \* $page_size`
echo kernel.shmmax = $shmmax
echo kernel.shmall = $shmall

Tämä scripti tulostaa palvelimessa jossa on 2GB RAM muistia:

kernel.shmmax = 1055092736
kernel.shmall = 257591

Kopioi nämä ja avaa /etc/sysctl.conf tiedosto

 nano /etc/sysctl.conf

Liitä kopioidut arvot tiedostoon.

Tarkista sysctl -p komennolla että arvot ovat oikein.

Komentoja

Yhdistäminen tietokantapalvelimelle PostgreSQL-palvelimelta konsolilla

 sudo -u postgres psql

Lisää kaikki tietokannat

\l

Varmuuskopiointi

Tässä yksinkertainen tapa tehdä SQL dumppi tietokannasta postgres.

 sudo -u postgres pg_dump postgres > postgres-backup-$(date '+%y%m%d').sql

Lähteet

http://leopard.in.ua/2013/09/05/postgresql-sessting-shared-memory/

Mainos / Advertisement: