PostgreSQL 8.0.0 �����ĵ���PostgreSQL �й� ������ | ||||
---|---|---|---|---|
Prev | Fast Backward | Fast Forward | Next |
pg_ctl start [-w] [-s] [-D datadir] [-l filename] [-o options] [-p path]
pg_ctl stop [-W] [-s] [-D datadir] [-m
s[mart] | f[ast] | i[mmediate]
]
pg_ctl restart [-w] [-s] [-D datadir] [-m
s[mart] | f[ast] | i[mmediate]
] [-o options]
pg_ctl reload [-s] [-D datadir]
pg_ctl status [-D datadir]
pg_ctl kill [signal_name] [process_id]
pg_ctl ��һ������������ֹͣ�� �������� PostgreSQL ��˷�������postmaster���� ������ʾһ�������ŵķ�������״̬�Ĺ��ߣ� �������ǿ����ֶ����������������� pg_ctl ��װ�����¶�����־����� ���ն˺ͽ����������룬�Լ������ṩ��һ��ѡ�������п��ƵĹرա�
�� start ģʽ�������һ���µķ������� ���������ں�̨�����ģ������뱻���ŵ��� /dev/null �ϡ����ʹ���� -l����ô������ͱ�������һ����־�ļ��� Ҫô�������¶��� pg_ctl �ı�����������DZ����� ���û��ѡ����־�ļ���pg_ctl �ı����Ӧ�����¶���һ���ļ������ùܵ�������� rotatelogs ��������־��ת������postmaster �����������д�������նˣ��ں�̨�����ҽ��������� shell �Ľ����顣
�� stop ģʽ�£��Ǹ������ض�����Ŀ¼���еķ��������رա� ������� -m ѡ��ѡ�����ֲ�ͬ�Ĺر�ģʽ��"Smart" ģʽ�ȴ����пͻ����ж����ӡ� �����ȱʡ��"Fast" ģʽ�����ȴ��ͻ����ж����ӡ� ���л�Ծ�����ؾ��ҿͻ��˶�ǿ�ƶϿ��� "Immediate" ģʽ����û�иɾ��رյ�������˳�����ô��������������������ʱ��Ļָ���
restart ʵ��������ִ��һ��ֹͣ��Ȼ�����һ��������������任postmaster�����е�ѡ�
reload ģʽ�ظ�postmaster����һ�� SIGHUP �źţ����������¶�ȡ���������ļ� ��postgresql.conf��pg_hba.conf �ȵȣ� �����������������ļ�ѡ���������ȫ����ϵͳ��ʹ֮��Ч��
status ģʽ���һ���������Ƿ���ָ��������Ŀ¼���У� ����ǣ���ô��ʾ�� PID �͵�������������ѡ�
kill ģʽ�������һ��ָ���Ľ��̷����źš� ������ܶ� Microsoft Windows �ر����ã���Ϊ����û�� kill ��� ʹ�� --help �鿴֧�ֵ��źŵ����ֵ��б�
���������ݿ��ļ����ļ�ϵͳλ�á� ����������ѡ�ʹ�û������� PGDATA��
�ѷ�������־��������� filename �ļ��ϡ� ������ļ������ڣ���ô��������umask����Ϊ 077�� ���ȱʡʱ�Dz�����������û�����־�ļ����ʵġ�
�����ر�ģʽ��mode ������smart, fast, ���� immediate��������������֮һ�ĵ�һ����ĸ��
����Ҫֱ�Ӵ��ݸ�postmaster ��ѡ�
����ͨ�����õ�����˫���Ű�Χ�Ա�֤������Ϊһ�����崫�ݡ�
���� postmaster ��ִ���ļ���λ�á� ȱʡʱ postmaster �ǴӺ�pg_ctl��ͬ��Ŀ¼ȡ����������ǣ� ��ô����д���İ�װĿ¼����������ɵ�ʲô�ر�����飬���ҵõ�����û���ҵ� postmaster�����Ĵ��� ����û�б�Ҫʹ�����ѡ�
ֻ��ӡ��������ӡ��ʾ����Ϣ��
�ȴ��������߹رյ���ɡ��� 60 ���ʱ�� ��������ǹر�ʱ��ȱʡֵ�� �ɹ��Ĺر�����ɾ�� PID �ļ�Ϊ��־�ġ������������ԣ� һ�γɹ��� psql -l �ͱ�־�ųɹ��� pg_ctl ����ͼʹ�ö� psql ���ʵĶ˿ڣ�������ڻ������� PGPORT����ô������ �����������ҿ����� postgresql.conf �ļ������Ƿ�������һ���˿ڡ� �����û�У�����ʹ�� PostgreSQL ����ʱ��ȱʡ�˿ڣ�ȱʡ�� 5432���� �ڵȴ���ʱ��pg_ctl �������������߹رյijɹ�״������һ��ȷ���˳����롣
���ȴ���������ֹͣ����ɡ����������������ȱʡ��
����ļ�����������Ŀ¼����Ϊ�˰��� pg_ctl �жϷ�������ǰ�Ƿ������С�
�������ļ�����������Ŀ¼��pg_ctl���� start ģʽ�£������ļ������ݵ������ݸ� postmaster �����ѡ��ݹ�ȥ�����DZ� -o ѡ��ǡ�
�������ļ�����������Ŀ¼��pg_ctl����start ģʽ�£� �����ļ������ݵ������ݸ�postmaster �����ѡ��ݹ�ȥ�� ���DZ� -o ѡ��ǡ�����ļ�������Ҳ���� status ģʽ����ʾ������
����ļ�������Ŀ¼�У���������Բ��Һ� psql һ���õĺ��ʵĶ˿ڣ��� start ģʽ����� -w ��ʱ��
���������Ŀ¼����� postmaster.opts.default �ļ�����ô���ļ�����Ϊѡ��ݸ� postmaster�� ���DZ� -o ѡ��ǡ�
�ȴ���ȫ����������һ������ú������IJ����� ������ʿ�������Ϊ���ؿͻ�����û���ֹ�����������²��ܷ��ʵĻ������ܻ�ʧЧ�������磬������֤����
������������
$ pg_ctl start
������������һ�����ӣ� �ȵ������� �����˲��˳���
$ pg_ctl -w start
����һ�� postmaster ʹ�ö˿� 5433�����Ҳ��� fsync ���У�ʹ�ã�
$ pg_ctl -o "-F -p 5433" start
$ pg_ctl stop
ֹͣ��������ʹ�� -m �����������ǿ�������Ѻ��ͣ������ -w�ȴ�������ֹͣ��-m ������˵�ֹͣģʽ��