PostgreSQL Tutorial
PrevNext

Chapter 2. アーキテクチャ

Postgresアーキテクチャの概念

Before we begin, you should understand the basic Postgres system architecture. Understanding how the parts of Postgres interact will make the next chapter somewhat clearer. In database jargon, Postgres uses a simple "process per-user" client/server model. A Postgres session consists of the following cooperating UNIX processes (programs): 話を始める前に,まず基本的なPostgres システム・アーキテクチャを理解していた方がよいでしょう. Postgresの各部分が,いかにして相互に 作用しているかを理解しておくと,次の章がかなり読みやすくなる でしょう.データベースの用語集によると,Postgres は「ユーザごとに処理を行う」クライアント・サーバ・ モデルを用いているということになっています.ある Postgresセッションは,以下に示すような,互いに 協調する UNIX プロセス群(プログラム)から構成されています.

A single postmaster manages a given collection of databases on a single host. Such a collection of databases is called an installation or site. Frontend applications that wish to access a given database within an installation make calls to the library. The library sends user requests over the network to the postmaster (どうやって接続が確立されるか), which in turn starts a new backend server process 単一のpostmasterは,単一のホスト上 において,与えられたデータベースの一群を管理します.そのような データベースの一群のことをインストレーション(installation) とかサイト(site)と呼びます.1つのインストレーション内部において, 与えられたデータベースにアクセスしたいと思うフロントエンド・ アプリケーションは,ライブラリを呼び出します.ライブラリは, ユーザの要求をネットワークを介して postmaster (どうやって接続が確立されるか) に送ります.postmasterは,次々に 新しいバックエンド・サーバ・プロセスを開始させます.

Figure 2-1. どうやって接続が確立されるか

and connects the frontend process to the new server. From that point on, the frontend process and the backend server communicate without intervention by the postmaster. Hence, the postmaster is always running, waiting for requests, whereas frontend and backend processes come and go. そしてフロントエンド・プロセスを新しいサーバに接続します. この時点から,フロントエンド・プロセスとバックエンド・サーバは postmasterを介さずに通信を行います. このため,postmasterは常に動作し続け, 要求を待ち,フロントエンドとバックエンド・プロセスがいつでも 接続できるようになっているのです.

The libpq library allows a single frontend to make multiple connections to backend processes. However, the frontend application is still a single-threaded process. Multithreaded frontend/backend connections are not currently supported in libpq. One implication of this architecture is that the postmaster and the backend always run on the same machine (the database server), while the frontend application may run anywhere. You should keep this in mind, because the files that can be accessed on a client machine may not be accessible (or may only be accessed using a different filename) on the database server machine. libpqライブラリを使うと,1つのフロントエンド がバックエンド・プロセスに対して複数の接続を行うことができます. しかしながら,フロントエンドのアプリケーションは相変わらず シングル・スレッドのプロセスです.マルチスレッドのフロントエンド /バックエンド接続は,libpqにおいては現在 サポートされていません.このアーキテクチャでは,フロントエンド・ アプリケーションはどこで動いていても良いにもかかわらず, postmasterとバックエンドは,常に同一の マシン(データベース・サーバ)で動作しなければならないことを暗に 示しています.これは覚えておく必要があります.それは,クライアント・ マシン上でアクセスできるファイルは,データベース・サーバ・マシン 上ではアクセスできない(かまたは,異なったファイル名を使ってのみ アクセスできる)かもしれないからです.

You should also be aware that the postmaster and postgres servers run with the user-id of the Postgres"superuser." Note that the Postgres superuser does not have to be a special user (e.g., a user named "postgres"). Furthermore, the Postgres superuser should definitely not be the UNIX superuser ("root")! In any case, all files relating to a database should belong to this Postgres superuser. postmasterと postgres サーバは, Postgresの"スーパーユーザ"のユーザID で動作することにも注意してください.Postgres のスーパーユーザは,特定のユーザ(すなわち"postgres" という名前のユーザ)である必要はありません.さらに, Postgresのスーパーユーザは,明らかに UNXI のスーパー ユーザ("root")であってはなりません.いずれのケースにおいても, データベースに関連するすべてのファイルは,この Postgresスーパーユーザに属している必要があります.


PrevHomeNext
著作権と商標 スタート