PostgreSQL 8.0.0 �����ĵ���PostgreSQL �й� ������ | ||||
---|---|---|---|---|
Prev | Fast Backward | Fast Forward | Next |
postmaster [-A 0 | 1 ] [-B nbuffers] [-c name=value] [-d debug-level] [-D datadir] [-F] [-h hostname] [-i] [-k directory] [-l] [-N max-connections] [-o extra-options] [-p port] [-S] [--name=value] [-n | -s]
postmaster �� PostgreSQL ���û����ݿ�������� һ���ͻ���Ϊ�˷���һ�����ݿ⣬����ͨ������أ����ӵ�һ�������ŵ� postmaster�� Ȼ��� postmaster ����һ�������ķ��������̣�"postgres"�� �Բ������ӡ�postmaster �����Ʒ���������֮���ͨѶ��
ȱʡʱpostmaster��ǰ̨���������������ϵͳ�����ӡ��־��Ϣ�� ��ʵ��Ӧ���postmasterӦ����Ϊ��̨����������Ҳ���������ʱ��
һ��postmaster���ǹ�������ͬһ�����ݿ⼯Ⱥ�����ݡ� һ�����ݿ⼯Ⱥ��һ����ͬһ���ļ�ϵͳλ�ô�����ݵ����ݿ⣨"������"���� һ��ϵͳ��ͬʱ�������м���postmaster���̣� ֻҪ����ʹ�ò�ͬ���������Ͳ�ͬ�Ķ˿ںţ������ģ��� һ������������ initdb �����ġ�
postmaster ������ʱ������Ҫ֪�����ݿ�����λ�á� ��λ��ͨ�� -D ѡ����� PGDATA �������������ģ� û��ȱʡֵ��ͨ����-D ���� PGDATA ָ��һ�� initdb ������Ŀ¼�� �������ܵIJ����� Section 16.4.1 �����ۡ�
postmaster �������������в����� ������Щѡ��ĸ���ϸ��������ο� Section 16.4�� ��Ҳ����ͨ������һ�������ļ��������û���Щѡ�
������ʱ���Լ�飬�Ǽ���̴���ĵ������� ֻ���ڱ��� PostgreSQL ʱ�������������ʹ�������������ʱ���ˣ�ȱʡ�Ǵ�
Ϊ���������̷������Ĺ����ڴ滺���������� ���������ȱʡֵ�� initdb �Զ�ѡ��ģ� �ο� Section 16.4.3.1 ��ȡ������Ϣ��
����һ������������ʱ������PostgreSQL ֧�ֵ����ò����� Section 16.4 �������� ���������������ѡ��ʵ���϶��������IJ�����ֵ�Ķ���ʽ�� -c ���Գ��ֶ���������ö��������
���õ��Լ�����ֵԽ�ߣ�д����������־�ĵ������Խ�ࡣ ��ֵ��Χ�� 1 �� 5��
��������Ŀ¼���������ļ����ļ�ϵͳ·����ϸ����� Section 16.4.1��
�ر� fsync ���ã�������ܣ�����Ҫðϵͳ����ʱ���ݻٻ��ķ��ա� �������ѡ���Ч�ر��� fsync ��������ʹ��֮ǰ�Ķ���ϸ�ĵ���
--fsync=true �������ѡ��ķ���Ч����
���� postmaster �����ŵȴ�����ǰ��Ӧ�� TCP/IP ���ӵ� IP ���������ַ�� ��ֵҲ������һ���ÿո�ָ��ĵ�ַ�б�����*��ʾ�������п��õĵ�ַ�� ��ֵ��ʾ�������κ� IP ��ַ����ֻ��ʹ�� Unix ������������ postmaster �����ӡ� ȱʡ��ʱ����ֻ���� localhost�� �������ѡ���Ч������ listen_addresses ���ò�����
���ѡ��� TCP/IP �����������֣�ͨѶ�� û�����ѡ�ֻ�ܽ��ܱ������ӡ� ���ѡ���Ч���� postgresql.conf �л���ͨ�� -h ���� listen_addresses Ϊ *��
���ѡ���Ѿ������ˣ���Ϊ������ʵ�� listen_addresses �����й��ܡ� �������ֱ������ listen_addresses��
���� postmaster �����ŵȴ�����ǰ��Ӧ�����ӵ� Unix �����ֵ�λ�á� ȱʡͨ���� /tmp�����ǿ�����������ʱ���ġ�
���ѡ����� SSL ���еİ�ȫͨѶ��Ҫʹ�����ѡ�����PostgreSQLʱ�������� SSL ѡ� �й�ʹ�� SSL ����Ϣ����ο� Section 16.7��
����postmaster���������ķ������������������Ŀ��ȱʡ����ʱ����ֵΪ 32�� ������ϵͳ��֧�ָ�����̣���ֵ����������Ϊ���ϵͳ����֧�ֵļ��ޡ� ʱ�ģ����� src/include/config.h���� ����ע��-Bѡ��Ҫ������������-N���� Section 16.5 ��ȡ�йش�ͻ�����ϵͳ��Դ���� �������ѡ���Ч������ max_connections ���ò�����
�� extra-options �������� postgres ѡ����ݸ���������� postmaster �����ķ�����̡� ���� postgres ��ȡ����ѡ� ���ѡ���ִ������κοհף������ִ�������������
���� postmaster �����ŵȴ��ͻ���Ӧ�����ӵĻ����� TCP/IP �˿ڻ�һ������ Unix �������ļ���չ������������ ȱʡ�Ķ˿ں��ǻ������� PGPORT ��ֵ�����û������ PGPORT ȱʡ�� PostgreSQL ����ʱ������ֵ��ͨ���� 5432���� �����������һ����ȱʡ�˿ڣ���ô����ǰ��Ӧ�ã����� psql����������������ѡ����� PGPORT ����ͬһ���˿ڡ�
ָ�� postmaster ���̽�����ģʽ������Ҳ����˵�� �������û��ģ����ƣ�tty ���벢������������Ľ����顣 �������ѱ�����ͱ������ض��� /dev/null��
ʹ��������ػὫ��־��������������ܲ�����ϣ���ģ� ��Ϊ�����������ҷdz����ѡ��������Ļ�ȡһ���ں�̨���� postmaster �ĸ��õķ�����
--silent_mode=false �����ú����ѡ���Ч�������෴��
����һ������������ʱ����������д��ʽ�� -c��
�����������������ѡ��������ڵ��Ե��·������쳣�˳��� ��������״����һ�������֪ͨ�������������������˳��� Ȼ�����³�ʼ�������ڴ���źŵơ�������Ϊһ������ķ��������˳�ǰ�����Ѿ��ƻ���һЩ�����״̬�� ��Щѡ��������ֻ����µ� postmaster �����ʣ�����û���ĸ�ѡ����Ϊ��ͨ����������
��Щ����ѡ���ǣ�
postmaster ���������³�ʼ���������ݽṹ�� һ���о����ϵͳ����Ա��ʱ�Ϳ���ʹ�õ�������鹲���ڴ���źŵ�״̬��
postmaster ��ͨ�������ź�SIGSTOP ֹͣ�����������������̣������ᵼ�������˳��� ����������ϵͳ����Ա�ֹ������з����������ռ��㵹�ĺ��ģ�core dumps����
�ͻ���ʹ�õ�ȷȱʡ�ַ����롣���ͻ��˿��Զ����ظ�������������ֵҲ�����������ļ������á�
ȱʡ����Ŀ¼λ��
����ʱ���� DateStyle ��ȱʡֵ�����Ѿ����ٹ���ʹ�û��������ˡ���
ȱʡ�˿ڣ�����������ļ������ã�
������ʱ��
һ���ᵽ�� semget ���� shmget �Ĵ�����Ϣ������ζ������Ҫ��������ںˣ� �ṩ�㹻�Ĺ����ڴ���źŵơ��������ۣ����� Section 16.5��
��ʾ: ��Ҳ����ͨ������ shared_buffers ����ֵ�Լ��� PostgreSQL�Ĺ����ڴ�����ģ� ���߽���max_connections�IJ���ֵ����PostgreSQL���źŵƵ����ģ� �Դ˿����Ƴ����������ںˡ�
�����һ��˵����һ�� postmaster �������еĴ�����Ϣ������Ӧ��ȷ��û�������� postmaster �����������С��ж�����������İ취��ʹ������
$ ps ax | grep postmaster
����
$ ps -e | grep postmaster
����ʹ������ȡ�������ϵͳ�����ȷ��û�г�ͻ�� postmaster �����У���ô�����ɾ����Ϣ���ᵽ�����ļ�Ȼ���ٴ����С�
һ��˵���˿ڵĴ�����Ϣ���ܱ����ö˿��Ѿ��������� PostgreSQL ����ʹ�á� �������ֹpostmaster����������ͬһ���˿�����������Ҳ�п��ܵõ����������Ϣ�� ��ʱ��������ȼ��룬�Ȳ���ϵͳ�ر��˸ö˿ں����ԡ� ��������ʹ����һ������ϵͳ��Ϊ�DZ����Ķ˿ڣ�Ҳ���ܵ������������Ϣ�� ���磬�ҵ� Unix �汾��Ϊ���� 1024 �Ķ˿ں���"�����ε�"�����ֻ�� Unix �����û�����ʹ�����ǡ�
����п��ܣ���Ҫʹ�� SIGKILLɱ�� postmaster�� ��������ֹ postmaster���˳�ǰ�ͷ������е�ϵͳ��Դ�����繲���ڴ���źŵƣ���
Ҫ�������� postmaster������ʹ���ź� SIGTERM��SIGINT�� �� SIGQUIT�� ��һ���źŽ��ȴ����еĿͻ����˳�����˳��� �ڶ�����ǿ�ƶϿ����пͻ��ˣ�������������ֹͣ�����˳��� ����������ʱ�Ļָ����С�
�������� pg_ctl �������ڰ�ȫ����Ч����ͣ postmaster��
-- ��FreeBSD���� OpenBSD�������С� Ӧ���� -c��������Ӱ���ϵͳ���Ǹ����棻 ������ë��û�����ã������� PostgreSQL �汾���ṩһ���ƿ��İ취��
��ȱʡֵ�ں�̨����postmaster�����룺
$ nohup postmaster >logfile 2>&1 </dev/null &
��ָ���Ķ˿����� postmaster��
$ postmaster -p 1234
��������ڶ˿� 1234 ���� postmaster�� Ϊ����psql����� postmaster ���ӣ� ��Ӧ����ô����psql
$ psql -p 1234
�������û������� PGPORT��
$ export PGPORT=1234 $ psql
����������ʱ�������������еķ��֮һ���ã�
$ postmaster -c work_mem=1234 $ postmaster --work-mem=1234
������ʽ��������Щ���е��� postgresql.conf ����� work_mem �����á� ��ע���ڲ���������»������������Ͽ���д���»��ߣ�Ҳ����д�ɻ��ߡ�
��ʾ: �������ڶ��ڵ�ʵ�����⣬���õ�ϰ���DZ༭���� postgresql.conf ��������ã� ���������������п������ò�����