In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
1. System requirement
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
two。 Install postgres-xl
/ home/soft/
Tar zxvf postgres-xl-9.5r1.4.tar.gz
. / configure
Make
Make install
3. Add user
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. Set up a data directory
-- create data directories for coord, datanode and gtm
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. Initialize 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. Start 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. Configure node type, port
/ 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. Configuration execution orientation
/ 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. Overload configuration
/ 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. Insertion test
Create a test table
Log in to 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) as key, 'Peter' | | (random () * (10 ^ 3)):: integer
INSERT 0 1000000
Test=#\ timing
Timing is on.
Test=# insert into T1 SELECT generate_series (1000001Power5000000) as key, 'Peter' | | (random () * (10 ^ 3)):: integer
INSERT 0 4000000
Time: 60653.631 ms
Test=#
View data distribution
Log in to 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
Log in to 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
Log in to 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=#
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.