CREATE TABLE weather (
city varchar(80),
temp_lo int, -- 最低気温
temp_hi int, -- 最高気温
prcp real, -- 降水量
date date
);
INSERT INTO weather VALUES ('San Francisco', 46, 50, 0.25, '1994-11-27');
他のサーバからアクセスするため、postgres ユーザにパスワードを設定
$ sudo su - postgres
$ psql
alter role postgres with password 'password';
本当はもっと強固なパスワードにすべき
同期レプリケーションのための設定を postgresql.conf に設定
デフォルトの設定との差分は以下の通り
$ diff /var/lib/pgsql/9.3/data/postgresql.conf.bak /var/lib/pgsql/9.3/data/postgresql.conf
59c59
< #listen_addresses = 'localhost' # what IP address(es) to listen on;
---
> listen_addresses = '*' # what IP address(es) to listen on;
159c159
< #wal_level = minimal # minimal, archive, or hot_standby
---
> wal_level = hot_standby # minimal, archive, or hot_standby
188c188
< #archive_mode = off # allows archiving to be done
---
> archive_mode = on # allows archiving to be done
190c190,191
< #archive_command = '' # command to use to archive a logfile segment
---
> archive_command = 'test ! -f /usr/local/pgsql/backup/%f && cp %p /usr/local/pgsql/backup/%f'
> # command to use to archive a logfile segment
206c207
< #max_wal_senders = 0 # max number of walsender processes
---
> max_wal_senders = 3 # max number of walsender processes
215c216
< #synchronous_standby_names = '' # standby servers that provide sync rep
---
> synchronous_standby_names = 'slave' # standby servers that provide sync rep