version 4 showing authors affecting page license.
.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
POSTMASTER |
|
|
2 |
!!!POSTMASTER |
|
|
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
DESCRIPTION |
|
|
6 |
NOTES |
|
|
7 |
USAGE |
|
|
8 |
---- |
|
|
9 |
!!NAME |
|
|
10 |
|
|
|
11 |
|
|
|
12 |
postmaster - PostgreSQL multiuser database server |
|
|
13 |
!!SYNOPSIS |
|
|
14 |
|
|
|
15 |
|
|
|
16 |
__postmaster__ [[ __-A 0__ | __1__ ] [[ __-B__ |
|
|
17 |
''nbuffers'' ] [[ __-c__ |
|
|
18 |
''name''__=__''value'' ] [[ __-d__ |
|
|
19 |
''debug-level'' ] [[ __-D__ ''datadir'' ] [[ |
|
|
20 |
__-F__ ] [[ __-h__ ''hostname'' ] [[ __-i__ ] [[ |
|
|
21 |
__-k__ ''directory'' ] [[ __-l__ ] [[ __-N__ |
|
|
22 |
''max-connections'' ] [[ __-o__ ''extra-options'' ] |
|
|
23 |
[[ __-p__ ''port'' ] [[ __-S__ ] [[ |
|
|
24 |
__--__''name''__=__''value'' ] [[ __-n__ | |
|
|
25 |
__-s__ ] |
|
|
26 |
!!DESCRIPTION |
|
|
27 |
|
|
|
28 |
|
|
|
29 |
__postmaster__ is the PostgreSQL multiuser database |
|
|
30 |
server. In order for a client application to access a |
|
|
31 |
database it connects (over a network or locally) to a |
|
|
32 |
running __postmaster__. The __postmaster__ then starts |
|
|
33 |
a separate server process (``postgres(1)'') to handle |
|
|
34 |
the connection. The __postmaster__ also manages the |
|
|
35 |
communication among server processes. |
|
|
36 |
|
|
|
37 |
|
|
|
38 |
By default the __postmaster__ starts in the foreground |
|
|
39 |
and prints log messages to the standard output. In practical |
|
|
40 |
applications the __postmaster__ should be started as a |
|
|
41 |
background process, perhaps at boot time. |
|
|
42 |
|
|
|
43 |
|
|
|
44 |
One __postmaster__ always manages the data from exactly |
|
|
45 |
one database cluster. A database cluster is a collection of |
|
|
46 |
databases that is stored at a common file system location. |
|
|
47 |
When the postmaster starts it needs to know the location of |
|
|
48 |
the database cluster files (``data area''). This is done |
|
|
49 |
with the __-D__ invocation option or the __PGDATA__ |
|
|
50 |
environment variable; there is no default. More than one |
|
|
51 |
postmaster process can run on a system at one time, as long |
|
|
52 |
as they use different data areas and different communication |
|
|
53 |
ports (see below). A data area is created with |
|
|
54 |
initdb(1). |
|
|
55 |
|
|
|
56 |
|
|
|
57 |
__OPTIONS__ |
|
|
58 |
|
|
|
59 |
|
|
|
60 |
__postmaster__ accepts the following command line |
|
|
61 |
arguments. For a detailed discussion of the options consult |
|
|
62 |
the ''Administrator's Guide''. You can also save typing |
|
|
63 |
most of these options by setting up a configuration |
|
|
64 |
file. |
|
|
65 |
|
|
|
66 |
|
|
|
67 |
__-A 0|1__ |
|
|
68 |
|
|
|
69 |
|
|
|
70 |
Enables run-time assert checks, which is a debugging aid to |
|
|
71 |
detect programming mistakes. This is only available if it |
|
|
72 |
was enabled during compilation. If so, the default is |
|
|
73 |
on. |
|
|
74 |
|
|
|
75 |
|
|
|
76 |
__-B__ ''nbuffers'' |
|
|
77 |
|
|
|
78 |
|
|
|
79 |
Sets the number of shared buffers for use by the server |
|
|
80 |
processes. This value defaults to 64 buffers, where each |
|
|
81 |
buffer is 8 kB. |
|
|
82 |
|
|
|
83 |
|
|
|
84 |
__-c__ ''name''__=__''value'' |
|
|
85 |
|
|
|
86 |
|
|
|
87 |
Sets a named run-time parameter. Consult the |
|
|
88 |
''Administrator's Guide'' for a list and descriptions. |
|
|
89 |
Most of the other command line options are in fact short |
|
|
90 |
forms of such a parameter assignment. __-c__ can appear |
|
|
91 |
multiple times to set multiple parameters. |
|
|
92 |
|
|
|
93 |
|
|
|
94 |
__-d__ ''debug-level'' |
|
|
95 |
|
|
|
96 |
|
|
|
97 |
Sets the debug level. The higher this value is set, the more |
|
|
98 |
debugging output is written to the server log. The default |
|
|
99 |
is 0, which means no debugging. Values up to 4 are useful; |
|
|
100 |
higher numbers produce no additional output. |
|
|
101 |
|
|
|
102 |
|
|
|
103 |
__-D__ ''datadir'' |
|
|
104 |
|
|
|
105 |
|
|
|
106 |
Specifies the file system location of the data directory. |
|
|
107 |
See discussion above. |
|
|
108 |
|
|
|
109 |
|
|
|
110 |
__-F__ |
|
|
111 |
|
|
|
112 |
|
|
|
113 |
Disables __fsync__ calls for performance improvement, at |
|
|
114 |
the risk of data corruption in event of a system crash. Read |
|
|
115 |
the detailed documentation before using this! |
|
|
116 |
|
|
|
117 |
|
|
|
118 |
__-h__ ''hostname'' |
|
|
119 |
|
|
|
120 |
|
|
|
121 |
Specifies the TCP/IP host name or address on which the |
|
|
122 |
__postmaster__ is to listen for connections from client |
|
|
123 |
applications. Defaults to listening on all configured |
|
|
124 |
addresses (including __localhost__). |
|
|
125 |
|
|
|
126 |
|
|
|
127 |
__-i__ |
|
|
128 |
|
|
|
129 |
|
|
|
130 |
Allows clients to connect via TCP/IP (Internet domain) |
|
|
131 |
connections. Without this option, only local Unix domain |
|
|
132 |
socket connections are accepted. |
|
|
133 |
|
|
|
134 |
|
|
|
135 |
__-k__ ''directory'' |
|
|
136 |
|
|
|
137 |
|
|
|
138 |
Specifies the directory of the Unix-domain socket on which |
|
|
139 |
the __postmaster__ is to listen for connections from |
|
|
140 |
client applications. The default is normally ''/tmp'', |
|
|
141 |
but can be changed at build time. |
|
|
142 |
|
|
|
143 |
|
|
|
144 |
__-l__ |
|
|
145 |
|
|
|
146 |
|
|
|
147 |
Enables secure connections using SSL. The __-i__ option |
|
|
148 |
is also required. You must have compiled with SSL enabled to |
|
|
149 |
use this option. |
|
|
150 |
|
|
|
151 |
|
|
|
152 |
__-N__ ''max-connections'' |
|
|
153 |
|
|
|
154 |
|
|
|
155 |
Sets the maximum number of client connections that this |
|
|
156 |
__postmaster__ will accept. By default, this value is 32, |
|
|
157 |
but it can be set as high as your system will support. (Note |
|
|
158 |
that __-B__ is required to be at least twice __-N__. |
|
|
159 |
See the ''Administrator's Guide'' for a discussion of |
|
|
160 |
system resource requirements for large numbers of client |
|
|
161 |
connections.) |
|
|
162 |
|
|
|
163 |
|
|
|
164 |
__-o__ ''extra-options'' |
|
|
165 |
|
|
|
166 |
|
|
|
167 |
The command line-style options specified in |
|
|
168 |
''extra-options'' are passed to all backend server |
|
|
169 |
processes started by this __postmaster__. See |
|
|
170 |
postgres(1) for possibilities. If the option string |
|
|
171 |
contains any spaces, the entire string must be |
|
|
172 |
quoted. |
|
|
173 |
|
|
|
174 |
|
|
|
175 |
__-p__ ''port'' |
|
|
176 |
|
|
|
177 |
|
|
|
178 |
Specifies the TCP/IP port or local Unix domain socket file |
|
|
179 |
extension on which the __postmaster__ is to listen for |
|
|
180 |
connections from client applications. Defaults to the value |
|
|
181 |
of the __PGPORT__ environment variable, or if |
|
|
182 |
__PGPORT__ is not set, then defaults to the value |
|
|
183 |
established during compilation (normally 5432). If you |
|
|
184 |
specify a port other than the default port, then all client |
|
|
185 |
applications must specify the same port using either |
|
|
186 |
command-line options or __PGPORT__. |
|
|
187 |
|
|
|
188 |
|
|
|
189 |
__-S__ |
|
|
190 |
|
|
|
191 |
|
|
|
192 |
Specifies that the __postmaster__ process should start up |
|
|
193 |
in silent mode. That is, it will disassociate from the |
|
|
194 |
user's (controlling) terminal, start its own process group, |
|
|
195 |
and redirect its standard output and standard error to |
|
|
196 |
''/dev/null''. |
|
|
197 |
|
|
|
198 |
|
|
|
199 |
Using this switch discards all logging output, which is |
|
|
200 |
probably not what you want, since it makes it very difficult |
|
|
201 |
to troubleshoot problems. See below for a better way to |
|
|
202 |
start the __postmaster__ in the background. |
|
|
203 |
|
|
|
204 |
|
|
|
205 |
__--__''name''__=__''value'' |
|
|
206 |
|
|
|
207 |
|
|
|
208 |
Sets a named run-time parameter; a shorter form of |
|
|
209 |
__-c__. |
|
|
210 |
|
|
|
211 |
|
|
|
212 |
Two additional command line options are available for |
|
|
213 |
debugging problems that cause a backend to die abnormally. |
|
|
214 |
These options control the behavior of the __postmaster__ |
|
|
215 |
in this situation, and __neither option is intended for use |
|
|
216 |
in ordinary operation__. |
|
|
217 |
|
|
|
218 |
|
|
|
219 |
The ordinary strategy for this situation is to notify all |
|
|
220 |
other backends that they must terminate and then |
|
|
221 |
reinitialize the shared memory and semaphores. This is |
|
|
222 |
because an errant backend could have corrupted some shared |
|
|
223 |
state before terminating. |
|
|
224 |
|
|
|
225 |
|
|
|
226 |
These special-case options are: |
|
|
227 |
|
|
|
228 |
|
|
|
229 |
__-n__ |
|
|
230 |
|
|
|
231 |
|
|
|
232 |
__postmaster__ will not reinitialize shared data |
|
|
233 |
structures. A knowledgeable system programmer can then use a |
|
|
234 |
debugger to examine shared memory and semaphore |
|
|
235 |
state. |
|
|
236 |
|
|
|
237 |
|
|
|
238 |
__-s__ |
|
|
239 |
|
|
|
240 |
|
|
|
241 |
__postmaster__ will stop all other backend processes by |
|
|
242 |
sending the signal SIGSTOP, but will not cause them to |
|
|
243 |
terminate. This permits system programmers to collect core |
|
|
244 |
dumps from all backend processes by hand. |
|
|
245 |
|
|
|
246 |
|
|
|
247 |
__OUTPUTS__ |
|
|
248 |
|
|
|
249 |
|
|
|
250 |
__semget: No space left on device__ |
|
|
251 |
|
|
|
252 |
|
|
|
253 |
If you see this message, you should run the __ipcclean__ |
|
|
254 |
command. After doing so, try starting __postmaster__ |
|
|
255 |
again. If this still doesn't work, you probably need to |
|
|
256 |
configure your kernel for shared memory and semaphores as |
|
|
257 |
described in the installation notes. If you run multiple |
|
|
258 |
instances of __postmaster__ on a single host, or have a |
|
|
259 |
kernel with particularly small shared memory and/or |
|
|
260 |
semaphore limits, you may have to reconfigure your kernel to |
|
|
261 |
increase its shared memory or semaphore |
|
|
262 |
parameters. |
|
|
263 |
|
|
|
264 |
|
|
|
265 |
__Tip:__ You may be able to postpone reconfiguring your |
|
|
266 |
kernel by decreasing __-B__ to reduce the shared memory |
|
|
267 |
consumption of PostgreSQL, and/or by reducing __-N__ to |
|
|
268 |
reduce the semaphore consumption. |
|
|
269 |
|
|
|
270 |
|
|
|
271 |
__!StreamServerPort: cannot bind to port__ |
|
|
272 |
|
|
|
273 |
|
|
|
274 |
If you see this message, you should make certain that there |
|
|
275 |
is no other __postmaster__ process already running on the |
|
|
276 |
same port number. The easiest way to determine this is by |
|
|
277 |
using the command |
|
|
278 |
|
|
|
279 |
|
|
|
280 |
$ __ps ax | grep postmaster |
|
|
281 |
__or |
|
|
282 |
|
|
|
283 |
|
|
|
284 |
$ __ps -e | grep postmaster |
|
|
285 |
__depending on your system. |
|
|
286 |
|
|
|
287 |
|
|
|
288 |
If you are sure that no other __postmaster__ processes |
|
|
289 |
are running and you still get this error, try specifying a |
|
|
290 |
different port using the -p option. You may also get this |
|
|
291 |
error if you terminate the __postmaster__ and immediately |
|
|
292 |
restart it using the same port; in this case, you must |
|
|
293 |
simply wait a few seconds until the operating system closes |
|
|
294 |
the port before trying again. Finally, you may get this |
|
|
295 |
error if you specify a port number that your operating |
|
|
296 |
system considers to be reserved. For example, many versions |
|
|
297 |
of Unix consider port numbers under 1024 to be |
|
|
298 |
''trusted'' and only permit the Unix superuser to access |
|
|
299 |
them. |
|
|
300 |
!!NOTES |
|
|
301 |
|
|
|
302 |
|
|
|
303 |
If at all possible, __do not__ use SIGKILL to kill the |
|
|
304 |
__postmaster__. This will prevent __postmaster__ from |
|
|
305 |
freeing the system resources (e.g., shared memory and |
|
|
306 |
semaphores) that it holds before terminating. |
|
|
307 |
|
|
|
308 |
|
|
|
309 |
To terminate the __postmaster__ normally, the signals |
|
|
310 |
SIGTERM, SIGINT, or SIGQUIT can be used. The first will wait |
|
|
311 |
for all clients to terminate before quitting, the second |
|
|
312 |
will forcefully disconnect all clients, and the third will |
|
|
313 |
quit immediately without proper shutdown, resulting in a |
|
|
314 |
recovery run during restart. |
|
|
315 |
|
|
|
316 |
|
|
|
317 |
The utility command pg_ctl(1) can be used to start |
|
|
318 |
and shut down the __postmaster__ safely and |
|
|
319 |
comfortably. |
|
|
320 |
|
|
|
321 |
|
|
|
322 |
The __--__ options will not work on FreeBSD or OpenBSD. |
|
|
323 |
Use __-c__ instead. This is a bug in the affected |
|
|
324 |
operating systems; a future release of PostgreSQL will |
|
|
325 |
provide a workaround if this is not fixed. |
|
|
326 |
!!USAGE |
|
|
327 |
|
|
|
328 |
|
|
|
329 |
To start __postmaster__ in the background using default |
|
|
330 |
values, type: |
|
|
331 |
|
|
|
332 |
|
|
|
333 |
$ __nohup postmaster |
|
|
334 |
__To start __postmaster__ with a specific port: |
|
|
335 |
|
|
|
336 |
|
|
|
337 |
$ __postmaster -p 1234 |
|
|
338 |
__This command will start up __postmaster__ communicating through the port 1234. In order to connect to this __postmaster__ using psql, you would need to run it as |
|
|
339 |
|
|
|
340 |
|
|
|
341 |
$ __psql -p 1234 |
|
|
342 |
__or set the environment variable __PGPORT__: |
|
|
343 |
|
|
|
344 |
|
|
|
345 |
$ __export PGPORT=1234 |
|
|
346 |
__$ __psql |
|
|
347 |
__Named runtime parameters can be set in either of these styles: |
|
|
348 |
|
|
|
349 |
|
|
|
350 |
$ __postmaster -c sort_mem=1234 |
|
|
351 |
__$ __postmaster --sort-mem=1234 |
|
|
352 |
__Either form overrides whatever setting might exist for sort_mem in ''postgresql.conf''. Notice that underscores in parameter names can be written as either underscore or dash on the command line. |
|
|
353 |
|
|
|
354 |
|
|
|
355 |
__Tip:__ Except for short-term experiments, it's probably |
|
|
356 |
better practice to edit the setting in |
|
|
357 |
''postgresql.conf'' than to rely on a command-line switch |
|
|
358 |
to set a parameter. |
|
|
359 |
---- |