by Mark Nielsen ��������: The Computer Underground, Inc. ��Ϊlinux��ʹ���ߴ��¼Ĺ�������������Ŀ����ֻ����Ϊ������������˼��Mark���� ZING����, ����Ϊ־Ը����www.genericbooks.com ����: |
![[Illustration]](../../common/images/illustration21.jpg)
ժҪ:
��ƪ���½�չʾ������RAMDISK������PostgreSQL���ݿ��ķ����ٶ�.
Okay, ʲô��RAMDISK?���������������������ݿ�server����Ӧ�ٶ�?
Ramdisk����˵������Ӳ�̿ռ����ڴ档����ʲôʱ����ʹ��Ramdisk��ʵ����������ʹ���ڴ�������Ӳ�̡�����һ���ϼ����ŵ�����ȱ�㡣�������ģ��������ŵ���������ʹ���ڴ棬��������һ�ж�����һЩ����ΪӲ�̵��ٶȽ��ڴ�����������ȱ�����������ı������ݿ������������ݲ���������������ʱ��������һ�иĶ�������ʧ��
�������ݿ�Server PostgreSQL��˵, �����㽫���е����ݿ������ڴ潫���������������ٶȡ�
��Ĭ��ramdisk�е�һ��ָ��Ŀ¼/Test��
mkdir -p /Test mkfs -t ext2 /dev/ram0 mount /dev/ram0 /Test
������һ��ʧ�ܵĻ���Ҳ������Ϊ�����������ں˲�֧��ramdisk����Ӧ�ý��ں�����ѡ���е�CONFIG_BLK_DEV_RAM
һ����Ϊ���õ�״̬��
���ϵIJ���ֻ�ܸ����ṩһ��4M��С��ramdisk��The above gives you a ramdisk with available space of just under 4Mb. ���ο� Ramdisk Article һ�ģ��������ν����ı���50M��С��
��������Ӧ�������������ݿ�server��һ���������Խ����ĵģ���һ������ramdisk�ϵĿ�����ʵ����һ����Ӧ���õ�"pg_dump" ���� "pg_dumpall"���
ע��: ���Ǽٶ����Ѿ����ļ��н��й�����������ramdisk�����������ݿ��Ĵ�С�����������õ����Ľ��ƵĴ�С����������"cd /var/lib/pgsql; du ".
����������ʹ����postgresql��װ�� "/var/lib/pgsql" ���ҽ����Ƿŵ��ڴ��У���������
### Stop the current postgresql server
/etc/rc.d/init.d/postgres stop
### rename the current directory
mv /var/lib/pgsql /var/lib/pgsql_main
#### Create a directory to have our ramdisk on
mkdir -p /var/lib/pgsql_memory
#### change the ownership of the new directory to postgres or whatever
#### the actual owner is.
chown postgres /var/lib/pgsql_memory
#### Make an alias or link to the original name, /var/lib/pgsql
ln -s /var/lib/pgsql_memory /var/lib/pgsql
#### Format the ramdisk
mkfs -t ext2 /dev/ram0
#### Mount the ramdisk to the postgresql directory
mount /dev/ram0 /var/lib/pgsql_memory
#### Copy everything from the main directory into the ramdisk
tar -C /var/lib/pgsql_main -cp . | tar -C /var/lib/pgsql_memory -xp
### Start the current postgresql server
/etc/rc.d/init.d/postgres start
���Ѿ���postgresql�ֱ���ramdisk�ϺͲ���ramdisk�Ͻ��й��ٶȷ������ܵIJ��ԡ���Щʱ������ramdisk�ϵ�postgresql���ٶȽ�������50%����Ȼ��Щʱ�����������ġ�
��ע�����ϵͳ���������û���ʱ��ϵͳ���ܵ����߲����ܴ�ֻ�д�Լ10%��20%�����д����µ����ݱ�ͬʱ�������ݿ�ʱ��ϵͳ�������������������ߡ�
��ʹ��ramdisk�������ĺô�����������ǿ���������ݿ������ڴ��ж�����ʹ��Ӳ�̡������㲻ʹ��ramdisk���������ݿ⽫���ܱ������ڴ档������ʹ��ʱ�ٱ���Ӳ���ϵ����ڴ档
|
��ҳ��LinuxFocus�༭��ά��
© Mark Nielsen LinuxFocus 1999 |
������Ϣ:
|
1999-12-15, generated by lfparser version 0.9