blob: 9ba24736b73a91d670f3c8a648930152472ad17d [file] [log] [blame]
Filip Pytloun26ebcc02015-10-06 16:28:32 +02001
2==========
3PostgreSQL
4==========
5
6PostgreSQL, often simply Postgres, is an object-relational database management system available for many platforms including Linux, FreeBSD, Solaris, Microsoft Windows and Mac OS X. It is released under the PostgreSQL License, which is an MIT-style license, and is thus free and open source software. PostgreSQL is developed by the PostgreSQL Global Development Group, consisting of a handful of volunteers employed and supervised by companies such as Red Hat and EnterpriseDB.
7
8Support
9=======
10
11* required by: [redmine](../master/redmine)
12* service versions: 9.1
13* operating systems: Ubuntu 12.04
14
15Sample pillars
16==============
17
18Single database server with empty database
19------------------------------------------
20
21.. code-block:: yaml
22
23 postgresql:
24 server:
25 enabled: true
26 version: 9.1
27 bind:
28 address: 127.0.0.1
29 port: 5432
30 protocol: tcp
31 clients:
32 - 127.0.0.1
33 database:
34 name: 'databasename'
35 encoding: 'UTF8'
36 locale: 'cs_CZ'
37 user:
38 name: 'username'
39 password: 'password'
40 host: 'localhost'
41 rights: 'all privileges'
42
43Single database server with prepopulated database
44-------------------------------------------------
45
46.. code-block:: yaml
47
48 postgresql:
49 server:
50 enabled: true
51 version: 9.1
52 bind:
53 - address: 127.0.0.1
54 port: 5432
55 protocol: tcp
56 clients:
57 - 127.0.0.1
58 database:
59 name: 'databasename'
60 encoding: 'UTF8'
61 locale: 'cs_CZ'
62 initial_data:
63 engine: backupninja
64 source: backup.host
65 host: original-host-name
66 database: original-database-name
67 user:
68 name: 'username'
69 password: 'password'
70 host: 'localhost'
71 rights: 'all privileges'
72
73User with createdb privileges
74-----------------------------
75
76.. code-block:: yaml
77
78 postgresql:
79 server:
80 enabled: true
81 version: 9.1
82 bind:
83 address: 127.0.0.1
84 port: 5432
85 protocol: tcp
86 clients:
87 - 127.0.0.1
88 database:
89 name: 'databasename'
90 encoding: 'UTF8'
91 locale: 'cs_CZ'
92 user:
93 name: 'username'
94 password: 'password'
95 host: 'localhost'
96 createdb: true
97 rights: 'all privileges'
98
99
100PostgreSQL extensions
101---------------------
102
103.. code-block:: yaml
104
105 postgresql:
106 server:
107 enabled: true
108 version: 9.1
109 bind:
110 address: 127.0.0.1
111 port: 5432
112 protocol: tcp
113 clients:
114 - 127.0.0.1
115 database:
116 name: 'databasename'
117 encoding: 'UTF8'
118 locale: 'cs_CZ'
119 user:
120 name: 'username'
121 password: 'password'
122 host: 'localhost'
123 createdb: true
124 rights: 'all privileges'
125 extension:
126 postgis_topology:
127 fuzzystrmatch:
128 postgis_tiger_geocoder:
129 postgis:
130
131## Sample usage
132
133Init database cluster with given locale
134
135 sudo su - postgres -c "/usr/lib/postgresql/9.3/bin/initdb /var/lib/postgresql/9.3/main --locale=C"
136
137Convert PostgreSQL cluster from 9.1 to 9.3
138
139 sudo su - postgres -c '/usr/lib/postgresql/9.3/bin/pg_upgrade -b /usr/lib/postgresql/9.1/bin -B /usr/lib/postgresql/9.3/bin -d /var/lib/postgresql/9.1/main/ -D /var/lib/postgresql/9.3/main/ -O "-c config_file=/etc/postgresql/9.3/main/postgresql.conf" -o "-c config_file=/etc/postgresql/9.1/main/postgresql.conf"'
140
141Ubuntu on 14.04 on some machines won't create default cluster
142
143 sudo pg_createcluster 9.3 main --start
144
145## Read more
146
147* http://www.postgresql.org/
148* http://www.postgresql.org/docs/9.1/interactive/index.html
149* http://momjian.us/main/writings/pgsql/hw_performance/
150* https://gist.github.com/ibussieres/11262268 - upgrade instructions for ubuntu