# apt-get install postgres-xc
# /etc/init.d/postgres-xc start
# su postgres-xc -c createdb testdb
ごちゃごちゃ言われることがある。/etc/init.d/postgres-xc
で restart を 2 回やれば回復するだろう。
createdb: database creation failed: ERROR: No Datanode defined in cluster
HINT: You need to define at least 1 Datanode with CREATE NODE.
あるいは明示的にこうやっても良いようだ。
$ psql -U postgres-xc postgres
> pgxc_pool_reload();
$ psql -U postgres-xc testdb
> \l -- データベース一覧
> \d -- テーブル一覧
distributed ではなく distribute "xxx" ではなく 'xxx'
create table hoge ( a varchar(255) );
create table hoge2 ( a varchar(255) ) distribute by replication;
insert into hoge values ('xxx');
insert into hoge2 values ('xxx');
kawai@ubuntu:~$ psql -U postgres-xc -p 15432 testdb
psql (PGXC 1.1, based on PG 9.2.4)
Type "help" for help.
testdb=# select * from hoge2;
a
-----
xxx
(1 row)
testdb=# select * from hoge;
a
---
(0 rows)
testdb=# ^D\q
kawai@ubuntu:~$ psql -U postgres-xc -p 15433 testdb
psql (PGXC 1.1, based on PG 9.2.4)
Type "help" for help.
testdb=# select * from hoge;
a
-----
xxx
(1 row)
testdb=# select * from hoge2;
a
-----
xxx
(1 row)
testdb=# ^D\q