Chapter 4: Deploying The PostgreSQL Relational Database
Initialization
Next we need to initialize the PostgreSQL database. We will be doing this using the non-standard location for PostgreSQL database files in order to prevent any problems with previously used databases.
As root, begin by creating a directory that is owned by user postgres and in group postgres:
[root@nodeB ~]# mkdir -p /opt/pgsql/data
[root@nodeB ~]# chown -R postgres /opt/pgsql
[root@nodeB ~]# chgrp -R postgres /opt/pgsql
Next become the 'postgres' user:
[root@nodeB ~]# su - postgres
Initialize the database by running the following command, being sure to use the -D option to point to the location where the new database files will be stored:
-bash-3.00$ /usr/bin/initdb -D /opt/pgsql/data
The files belonging to this database system will be owned by user "postgres". This user must also own the server process.
The database cluster will be initialized with locale en_US.UTF-8.
The default database encoding has accordingly been set to UNICODE.
fixing permissions on existing directory /opt/pgsql/data ... ok
creating directory /opt/pgsql/data/global ... ok
creating directory /opt/pgsql/data/pg_xlog ... ok
creating directory /opt/pgsql/data/pg_xlog/archive_status ... ok
creating directory /opt/pgsql/data/pg_clog ... ok
creating directory /opt/pgsql/data/pg_subtrans ... ok
creating directory /opt/pgsql/data/base ... ok
creating directory /opt/pgsql/data/base/1 ... ok
creating directory /opt/pgsql/data/pg_tblspc ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 1000
creating configuration files ... ok
creating template1 database in /opt/pgsql/data/base/1 ... ok
initializing pg_shadow ... ok
enabling unlimited row size for system tables ... ok
initializing pg_depend ... ok
creating system views ... ok
loading pg_description ... ok
creating conversions ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the -A option the next time you run initdb.
Success. You can now start the database server using:
/usr/bin/postmaster -D /opt/pgsql/data
or
/usr/bin/pg_ctl -D /opt/pgsql/data -l logfile start
The database is now initialized.
|