Press release

Tips & Tricks: PostgreSQL의 메모리 스토리지

image
image

PostgreSQL은 Red Hat Enterprise Linux와 함께 사용되는 매우 정교하고 강력한 데이터베이스 서버입니다. 하지만, 많은 이들이 MySQL의 메모리 스토리지 엔진이 빠져 있다는 점에 대해 문제를 제기하곤 합니다.

스토리지 엔진은, 드물게 업데이트되지만 빈번히 액세스가 이루어지는 임시 데이터를 처리하는 애플리케이션에 특히 이상적이라 할 수 있습니다. 이들 애플리케이션은 메모리에 저장된 데이터베이스를 사용하여 디스크 오퍼레이션의 수를 줄여 주는데, 이러한 애플리케이션의 예로 웹 기반의 BitTorrent Tracker를 들 수 있습니다.

팁에서는 PostgreSQL 데이터베이스 서버 자체와 Red Hat Enterprise Linux 운영체제가 제공하는 표준 기능을 사용하여 PostgreSQL의 메모리 스토리지를 설정하는 방법에 대해 알아보도록 하겠습니다.

image
image
image
image

image
image

image

ramfs 파일시스템이 언마운트될 때마다 데이터베이스 구조를 덤프하고 복원해야 합니다.
단, 메모리 데이터베이스를 사용하는 애플리케이션이라면 데이터 손실을 인지하고 재생성 작업을 수행할 수 있어야 합니다.

image
pg_dump --create --schema-only --file=$FILENAME --host=$HOST -U postgres $DATABASE_NAME


image
psql --file $FILENAME -U $ROLE_NAME --dbname postgres --host $HOST

image
image

재시작할 때마다 이 설정이 적용되도록 하려면 '/etc/init.d/postgresql'을 편집해야 하는데, 항목들이 올바른 순서로 표시되도록 유의하십시오.

image


image
pg_dump --create --schema-only --file=/root/memdb.sql --host=localhost -U postgres memdb
image

image
umount /mnt/ramfs




image

image
if [ ! -d /mnt/ramfs ]; then
mkdir -p /mnt/ramfs

fi
mount -t ramfs none /mnt/ramfs

image
mkdir /mnt/ramfs/pgdata
echo $PGMAJORVERSION > /mnt/ramfs/pgdata/PG_VERSION
chown -R postgres:postgres /mnt/ramfs/pgdata
chmod -R go-rwx /mnt/ramfs/pgdata


image

image
psql --quiet -U postgres --host localhost --command "DROP DATABASE memdb;" 2>/root/psql.log

image

psql --quiet --file /root/memdb.sql -U $ROLE_NAME -d postgres --host localhost 2>/root/psql.log

image

image

PostgreSQL 데이터베이스 서버와 관련하여 메모리 스토리지를 설정하는 방법에 대해 알아보았습니다. PostgreSQL의 모든 기능 이외에도, 메모리 데이터베이스를 사용할 경우 MySQL에서와 같은 제한 사항은 발생하지 않습니다. 완벽한 설정을 위해서 임의대로 init 스크립트를 손보아야 할 수도 있습니다.

image

image

area area area area area area area area

area area area area area area area

About Red Hat

Red Hat is the world’s leading provider of open source software solutions, using a community-powered approach to reliable and high-performing cloud, Linux, middleware, storage and virtualization technologies. Red Hat also offers award-winning support, training, and consulting services. As the connective hub in a global network of enterprises, partners, and open source communities, Red Hat helps create relevant, innovative technologies that liberate resources for growth and prepare customers for the future of IT. Learn more at http://www.redhat.com.

전망 보고서

Certain statements contained in this press release may constitute "forward-looking statements" within the meaning of the Private Securities Litigation Reform Act of 1995. Forward-looking statements provide current expectations of future events based on certain assumptions and include any statement that does not directly relate to any historical or current fact. Actual results may differ materially from those indicated by such forward-looking statements as a result of various important factors, including: risks related to delays or reductions in information technology spending; the effects of industry consolidation; the ability of the Company to compete effectively; the integration of acquisitions and the ability to market successfully acquired technologies and products; uncertainty and adverse results in litigation and related settlements; the inability to adequately protect Company intellectual property and the potential for infringement or breach of license claims of or relating to third party intellectual property; the ability to deliver and stimulate demand for new products and technological innovations on a timely basis; risks related to data and information security vulnerabilities; ineffective management of, and control over, the Company’s growth and international operations; fluctuations in exchange rates; and changes in and a dependence on key personnel, as well as other factors contained in our most recent Quarterly Report on Form 10-Q (copies of which may be accessed through the Securities and Exchange Commission’s website at http://www.sec.gov), including those found therein under the captions "Risk Factors" and "Management’s Discussion and Analysis of Financial Condition and Results of Operations". In addition to these factors, actual future performance, outcomes, and results may differ materially because of more general factors including (without limitation) general industry and market conditions and growth rates, economic and political conditions, governmental and public policy changes and the impact of natural disasters such as earthquakes and floods. The forward-looking statements included in this press release represent the Company’s views as of the date of this press release and these views could change. However, while the Company may elect to update these forward-looking statements at some point in the future, the Company specifically disclaims any obligation to do so. These forward-looking statements should not be relied upon as representing the Company’s views as of any date subsequent to the date of this press release.