1.系統(tǒng)需求
創(chuàng)新互聯(lián)建站成都網(wǎng)站建設(shè)按需策劃設(shè)計(jì),是成都網(wǎng)站開(kāi)發(fā)公司,為成都汽車玻璃修復(fù)提供網(wǎng)站建設(shè)服務(wù),有成熟的網(wǎng)站定制合作流程,提供網(wǎng)站定制設(shè)計(jì)服務(wù):原型圖制作、網(wǎng)站創(chuàng)意設(shè)計(jì)、前端HTML5制作、后臺(tái)程序開(kāi)發(fā)等。成都網(wǎng)站推廣熱線:13518219792
CentOS 7.2 X64
postgres-xl-9.5r1.4.tar.gz
# yum install -y gcc-c++
# yum install -y readline-devel
# yum install -y zlib-devel
# yum install -y perl
# yum install -y flex
# yum install -y flex-devel
2.安裝postgres-xl
/home/soft/
tar zxvf postgres-xl-9.5r1.4.tar.gz
./configure
make
make install
3.添加用戶
adduser postgres
su - postgres
vi .bash_profile
export LD_LIBRARY_PATH=/usr/local/pgsql/lib
export PATH=/usr/local/pgsql/bin:$PATH
export MANPATH=/usr/local/pgsql/share/man:$MANPATH
4.建立data目錄
--建立coord, datanode, gtm的data目錄
mkdir -p /opt/pgxl/data/data_coord1
mkdir -p /opt/pgxl/data/data_datanode_1
mkdir -p /opt/pgxl/data/data_datanode_2
mkdir -p /opt/pgxl/data/data_gtm
chown postgres /opt/pgxl/data/data_coord1
chown postgres /opt/pgxl/data/data_datanode_1
chown postgres /opt/pgxl/data/data_datanode_2
chown postgres /opt/pgxl/data/data_gtm
5.初始化coordinator, datanode
su - postgres
/usr/local/pgsql/bin/initdb -D /opt/pgxl/data/data_coord1 \
--nodename coord1
/usr/local/pgsql/bin/initdb -D /opt/pgxl/data/data_datanode_1 \
--nodename datanode_1
/usr/local/pgsql/bin/initdb -D /opt/pgxl/data/data_datanode_2 \
--nodename datanode_2
/usr/local/pgsql/bin/initgtm -D /opt/pgxl/data/data_gtm -Z gtm
6.啟動(dòng)gtm, datanode, coordinator
-- gtm
/usr/local/pgsql/bin/gtm -D /opt/pgxl/data/data_gtm >/opt/pgxl/data/data_gtm/gtm_logfile.log 2>&1 &
-- datanode
/usr/local/pgsql/bin/postgres --datanode -p 15432 -c pooler_port=40101 \
-D /opt/pgxl/data/data_datanode_1 >/opt/pgxl/data/data_datanode_1/datanode1_logfile.log 2>&1 &
/usr/local/pgsql/bin/postgres --datanode -p 15433 -c pooler_port=40102 \
-D /opt/pgxl/data/data_datanode_2 >/opt/pgxl/data/data_datanode_1/datanode2_logfile.log 2>&1 &
-- coordinator
/usr/local/pgsql/bin/postgres --coordinator -c pooler_port=40100 \
-D /opt/pgxl/data/data_coord1 >/opt/pgxl/data/data_coord1/data_coord1_logfile.log 2>&1 &
7.配置節(jié)點(diǎn)類型、端口
/usr/local/pgsql/bin/psql -c "ALTER NODE coord1 \
WITH (TYPE = 'coordinator', PORT = 5432)" postgres
/usr/local/pgsql/bin/psql -c "CREATE NODE datanode_1 \
WITH (TYPE = 'datanode', PORT = 15432)" postgres
/usr/local/pgsql/bin/psql -c "CREATE NODE datanode_2 \
WITH (TYPE = 'datanode', PORT = 15433)" postgres
8.配置執(zhí)行導(dǎo)向
/usr/local/pgsql/bin/psql -c "EXECUTE DIRECT ON (datanode_1) \
'ALTER NODE datanode_1 WITH (TYPE = ''datanode'', PORT = 15432)'" postgres
/usr/local/pgsql/bin/psql -c "EXECUTE DIRECT ON (datanode_1) \
'CREATE NODE datanode_2 WITH (TYPE = ''datanode'', PORT = 15433)'" postgres
/usr/local/pgsql/bin/psql -c "EXECUTE DIRECT ON (datanode_1) \
'CREATE NODE coord1 WITH (TYPE = ''coordinator'', PORT = 5432)'" postgres
/usr/local/pgsql/bin/psql -c "EXECUTE DIRECT ON (datanode_2) \
'ALTER NODE datanode_2 WITH (TYPE = ''datanode'', PORT = 15433)'" postgres
/usr/local/pgsql/bin/psql -c "EXECUTE DIRECT ON (datanode_2) \
'CREATE NODE datanode_1 WITH (TYPE = ''datanode'', PORT = 15432)'" postgres
/usr/local/pgsql/bin/psql -c "EXECUTE DIRECT ON (datanode_2) \
'CREATE NODE coord1 WITH (TYPE = ''coordinator'', PORT = 5432)'" postgres
9.重載配置
/usr/local/pgsql/bin/psql -c "SELECT pgxc_pool_reload()" postgres
/usr/local/pgsql/bin/psql -c "EXECUTE DIRECT ON (datanode_1) \
'SELECT pgxc_pool_reload()'" postgres
/usr/local/pgsql/bin/psql -c "EXECUTE DIRECT ON (datanode_2) \
'SELECT pgxc_pool_reload()'" postgres
10.插入測(cè)試
創(chuàng)建測(cè)試表
登錄 coordinator
/usr/local/pgsql/bin/createdb test
/usr/local/pgsql/bin/psql test
test=# create table t1(id int, name varchar(20))
test=# \dt
List of relations
Schema | Name | Type | Owner
--------+------+-------+----------
public | t1 | table | postgres
(1 row)
test=# insert into t1 SELECT generate_series(1,1000000) as key, 'Peter'||(random()*(10^3))::integer;
INSERT 0 1000000
test=# \timing
Timing is on.
test=# insert into t1 SELECT generate_series(1000001,5000000) as key, 'Peter'||(random()*(10^3))::integer;
INSERT 0 4000000
Time: 60653.631 ms
test=#
查看數(shù)據(jù)分布
登錄datanode_1
[postgres@localhost ~]$ psql -p 15432 test
psql (PGXL 9.5r1.4, based on PG 9.5.5 (Postgres-XL 9.5r1.4))
Type "help" for help.
test=# select count(*) from t1;
count
---------
2502488
(1 row)
test=# \q
登錄datanode_2
[postgres@localhost ~]$ psql -p 15433 test
psql (PGXL 9.5r1.4, based on PG 9.5.5 (Postgres-XL 9.5r1.4))
Type "help" for help.
test=# select count(*) from t1;
count
---------
2497512
(1 row)
test=# \q
登錄 coordinator
[postgres@localhost ~]$ psql -p test
psql: invalid port number: "test"
[postgres@localhost ~]$ psql test
psql (PGXL 9.5r1.4, based on PG 9.5.5 (Postgres-XL 9.5r1.4))
Type "help" for help.
test=# select count(*) from t1;
count
---------
5000000
(1 row)
test=# \dt t1;
List of relations
Schema | Name | Type | Owner
--------+------+-------+----------
public | t1 | table | postgres
(1 row)
test=#
網(wǎng)頁(yè)標(biāo)題:Postgres_XL簡(jiǎn)要安裝配置說(shuō)明
標(biāo)題URL:http://jinyejixie.com/article46/iieshg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供動(dòng)態(tài)網(wǎng)站、網(wǎng)站制作、軟件開(kāi)發(fā)、網(wǎng)站導(dǎo)航、手機(jī)網(wǎng)站建設(shè)、Google
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)