单机环境: CentOS 6 64bit, pgxc-v1.0.1.tar.gz
解压 pgxc-v1.0.1.tar.gz,进入pgxc,
./configure –without-readline –without-zlib ( 注:由于服务器未安装readline和zlib包,故省去)
gmake
gmake install
安装协调结点,数据结点和GTM,
cd /usr/local/pgsql/bin/
./initdb -D /usr/local/pgsql/data_coord1 –nodename coord1
./initdb -D /usr/local/pgsql/data_datanode1 –nodename datanode1
./initdb -D /usr/local/pgsql/data_datanode2 –nodename datanode2
./initgtm -D /usr/local/pgsql/data_gtm -Z gtm
启动服务:
./gtm -D /usr/local/pgsql/data_gtm &
./postgres -X -p 15432 -D /usr/local/pgsql/data_datanode1 &
./postgres -X -p 15433 -D /usr/local/pgsql/data_datanode2 &
./postgres -C -D /usr/local/pgsql/data_coord1 &
进入postgres-xc,创建元数据
./psql
create node datanode1 with(type=’datanode’, port=15432);
create node datanode2 with(type=’datanode’, port=15433);
select pgxc_pool_reload();
./createdb test
创建测试数据库
./psql test
create table user_info_hash(id int primary key,firstname text,lastname text,info text) distribute by hash(id) to node datanode1,datanode2;
insert into user_info_hash select generate_series(1,10000),’zhou’,’digoal’,’DBA’;