在國產晶片伺服器上構建postgresql-xl的大資料平臺
基於海之舟大資料平臺伺服器,作業系統,使用二臺裝置構建。
埠、ip配置見下表
大資料軟體postgresql-xl,ssh軟體作業系統已自帶,使用者zs(作業系統已建立),工作目錄/home/zs/
1.以下操作二臺伺服器均需配置
su zs
nano /etc/hosts //編輯檔案,加入以下行
192.168.1.125 gtm
192.168.1.125 coordinator1
192.168.1.125 datanode1
192.168.1.8 coordinator2
192.168.1.8 datanode2
vi .bashrc //配置環境變數
export PGHOME=/usr/local/pgxl10
export LD_LIBRARY_PATH=PGHOME/lib:PGHOME/lib:PGHOME/lib:LD_LIBRARY_PATH
export PATH=PGHOME/bin:PGHOME/bin:PGHOME/bin:PATH
export dataDirRoot=$HOME/data
su root //重啟伺服器,使配置生效
reboot
2.在gtm上操作
2.1設定ssh 二臺裝置無密碼登陸
su zs
ssh-keygen -t rsa
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
ssh zs@datanode1 mkdir -p .ssh
cat .ssh/id_rsa.pub | ssh zs@datanode1 ‘cat >> .ssh/authorized_keys’
ssh zs@datanode2 mkdir -p .ssh
cat .ssh/id_rsa.pub | ssh zs@datanode2 ‘cat >> .ssh/authorized_keys’
以上操作,提問全部回車。
2.2 建立大資料庫
zs@bigdataA:~$pgxc_ctl
/bin/bash
Installing pgxc_ctl_bash script as /home/zs/pgxc_ctl/pgxc_ctl_bash.
Installing pgxc_ctl_bash script as /home/zs/pgxc_ctl/pgxc_ctl_bash.
Reading configuration using /home/zs/pgxc_ctl/pgxc_ctl_bash --home /home/zs/pgxc_ctl --configuration /home/zs/pgxc_ctl/pgxc_ctl.conf
Finished reading configuration.
******** PGXC_CTL START ***************
Current directory: /home/zs/pgxc_ctl
PGXC prepare config empty
PGXC exit
zs@bigdataA:~$ nano /home/zs/pgxc_ctl/pgxc_ctl.conf
zs@bigdataA:~$ cp /home/zs/pgxc_ctl/pgxc_ctl.conf /home/zs/pgxc_ctl.conf-all-in-2-init
zs@bigdataA:~$ pgxc_ctl
/bin/bash
Installing pgxc_ctl_bash script as /home/zs/pgxc_ctl/pgxc_ctl_bash.
Installing pgxc_ctl_bash script as /home/zs/pgxc_ctl/pgxc_ctl_bash.
Reading configuration using /home/zs/pgxc_ctl/pgxc_ctl_bash --home /home/zs/pgxc_ctl --configuration /home/zs/pgxc_ctl/pgxc_ctl.conf
Finished reading configuration.
******** PGXC_CTL START ***************
Current directory: /home/zs/pgxc_ctl
PGXC add gtm master gtm gtm 20001 $dataDirRoot/gtm
Initialize GTM master
The files belonging to this GTM system will be owned by user “zs”.
This user must also own the server process.
fixing permissions on existing directory /home/zs/data/gtm … ok
creating configuration files … ok
creating control file … ok
Success.
Done.
Start GTM master
server starting
PGXC add coordinator master coord1 gtm 30001 30011 $dataDirRoot/coord_master.1 none none
Actual Command: ssh zs@gtm “( PGXC_CTL_SILENT=1 initdb -D $dataDirRoot/coord_master.1 --nodename coord1 ) > /tmp/bigdataA_STDOUT_671_7 2>&1” < /dev/null > /dev/null 2>&1
Bring remote stdout: scp zs@gtm:/tmp/bigdataA_STDOUT_671_7 /tmp/STDOUT_671_8 > /dev/null 2>&1
The files belonging to this database system will be owned by user “zs”.
This user must also own the server process.
The database cluster will be initialized with locale “en_US.UTF-8”.
The default database encoding has accordingly been set to “UTF8”.
The default text search configuration will be set to “english”.
Data page checksums are disabled.
creating directory /home/zs/data/coord_master.1 … ok
creating subdirectories … ok
selecting default max_connections … 100
selecting default shared_buffers … 128MB
selecting dynamic shared memory implementation … posix
creating configuration files … ok
running bootstrap script … ok
performing post-bootstrap initialization … creating cluster information … ok
syncing data to disk … ok
freezing database template0 … ok
freezing database template1 … ok
freezing database postgres … ok
WARNING: enabling “trust” authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
–auth-local and --auth-host, the next time you run initdb.
Success.
Starting coordinator master coord1
2016-11-04 01:22:10.335 CST [1005] LOG: listening on IPv4 address “0.0.0.0”, port 30001
2016-11-04 01:22:10.336 CST [1005] LOG: listening on IPv6 address “::”, port 30001
2016-11-04 01:22:10.377 CST [1005] LOG: listening on Unix socket “/tmp/.s.PGSQL.30001”
2016-11-04 01:22:10.435 CST [1005] LOG: redirecting log output to logging collector process
2016-11-04 01:22:10.435 CST [1005] HINT: Future log output will appear in directory “pg_log”.
Done.
ALTER NODE
pgxc_pool_reload
t
(1 row)
vacuumdb: vacuuming database “postgres”
vacuumdb: vacuuming database “template1”
PGXC
PGXC add coordinator master coord1 gtm 30001 30011 $dataDirRoot/coord_master.1 none none
Actual Command: ssh zs@gtm “( PGXC_CTL_SILENT=1 initdb -D $dataDirRoot/coord_master.1 --nodename coord1 ) > /tmp/bigdataA_STDOUT_671_7 2>&1” < /dev/null > /dev/null 2>&1
Bring remote stdout: scp zs@gtm:/tmp/bigdataA_STDOUT_671_7 /tmp/STDOUT_671_8 > /dev/null 2>&1
The files belonging to this database system will be owned by user “zs”.
This user must also own the server process.
The database cluster will be initialized with locale “en_US.UTF-8”.
The default database encoding has accordingly been set to “UTF8”.
The default text search configuration will be set to “english”.
Data page checksums are disabled.
creating directory /home/zs/data/coord_master.1 … ok
creating subdirectories … ok
selecting default max_connections … 100
selecting default shared_buffers … 128MB
selecting dynamic shared memory implementation … posix
creating configuration files … ok
running bootstrap script … ok
performing post-bootstrap initialization … creating cluster information … ok
syncing data to disk … ok
freezing database template0 … ok
freezing database template1 … ok
freezing database postgres … ok
WARNING: enabling “trust” authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
–auth-local and --auth-host, the next time you run initdb.
Success.
Starting coordinator master coord1
2016-11-04 01:22:10.335 CST [1005] LOG: listening on IPv4 address “0.0.0.0”, port 30001
2016-11-04 01:22:10.336 CST [1005] LOG: listening on IPv6 address “::”, port 30001
2016-11-04 01:22:10.377 CST [1005] LOG: listening on Unix socket “/tmp/.s.PGSQL.30001”
2016-11-04 01:22:10.435 CST [1005] LOG: redirecting log output to logging collector process
2016-11-04 01:22:10.435 CST [1005] HINT: Future log output will appear in directory “pg_log”.
Done.
ALTER NODE
pgxc_pool_reload
t
(1 row)
vacuumdb: vacuuming database “postgres”
vacuumdb: vacuuming database “template1”
PGXC add coordinator master coord2 datanode2 30002 30012 $dataDirRoot/coord_master.2 none none
Actual Command: ssh zs@datanode2 “( PGXC_CTL_SILENT=1 initdb -D $dataDirRoot/coord_master.2 --nodename coord2 ) > /tmp/bigdataA_STDOUT_671_11 2>&1” < /dev/null > /dev/null 2>&1
Bring remote stdout: scp zs@datanode2:/tmp/bigdataA_STDOUT_671_11 /tmp/STDOUT_671_12 > /dev/null 2>&1
The files belonging to this database system will be owned by user “zs”.
This user must also own the server process.
The database cluster will be initialized with locale “en_US.UTF-8”.
The default database encoding has accordingly been set to “UTF8”.
The default text search configuration will be set to “english”.
Data page checksums are disabled.
creating directory /home/zs/data/coord_master.2 … ok
creating subdirectories … ok
selecting default max_connections … 100
selecting default shared_buffers … 128MB
selecting dynamic shared memory implementation … posix
creating configuration files … ok
running bootstrap script … ok
performing post-bootstrap initialization … creating cluster information … ok
syncing data to disk … ok
freezing database template0 … ok
freezing database template1 … ok
freezing database postgres … ok
WARNING: enabling “trust” authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
–auth-local and --auth-host, the next time you run initdb.
Success.
INFO: please do not close this session until you are done adding the new node
pgxc_lock_for_backup
t
(1 row)
Actual Command: ssh zs@datanode2 “( pg_ctl start -w -Z restoremode -D $dataDirRoot/coord_master.2 -o ‘-i -b’ ) > /tmp/bigdataA_STDOUT_671_14 2>&1” < /dev/null > /dev/null 2>&1
Bring remote stdout: scp zs@datanode2:/tmp/bigdataA_STDOUT_671_14 /tmp/STDOUT_671_15 > /dev/null 2>&1
2019-10-07 11:26:12.056 CST [1370] LOG: listening on IPv4 address “0.0.0.0”, port 30002
2019-10-07 11:26:12.056 CST [1370] LOG: listening on IPv6 address “::”, port 30002
2019-10-07 11:26:12.106 CST [1370] LOG: listening on Unix socket “/tmp/.s.PGSQL.30002”
2019-10-07 11:26:12.183 CST [1370] LOG: redirecting log output to logging collector process
2019-10-07 11:26:12.183 CST [1370] HINT: Future log output will appear in directory “pg_log”.
SET
SET
SET
binary_upgrade_set_next_pg_authid_oid
(1 row)
ALTER ROLE
UPDATE 1
UPDATE 1
REVOKE
GRANT
CREATE NODE
You are now connected to database “postgres” as user “zs”.
SET
SET
SET
SET
SET
SET
set_config
(1 row)
SET
SET
SET
UPDATE 1
UPDATE 1
COMMENT
You are now connected to database “template1” as user “zs”.
SET
SET
SET
SET
SET
SET
set_config
(1 row)
SET
SET
SET
UPDATE 1
UPDATE 1
COMMENT
Actual Command: ssh zs@datanode2 “( pg_ctl stop -w -Z restoremode -D $dataDirRoot/coord_master.2 ) > /tmp/bigdataA_STDOUT_671_16 2>&1” < /dev/null > /dev/null 2>&1
Bring remote stdout: scp zs@datanode2:/tmp/bigdataA_STDOUT_671_16 /tmp/STDOUT_671_17 > /dev/null 2>&1
Starting coordinator master coord2
2019-10-07 11:26:17.231 CST [1443] LOG: listening on IPv4 address “0.0.0.0”, port 30002
2019-10-07 11:26:17.231 CST [1443] LOG: listening on IPv6 address “::”, port 30002
2019-10-07 11:26:17.282 CST [1443] LOG: listening on Unix socket “/tmp/.s.PGSQL.30002”
2019-10-07 11:26:17.358 CST [1443] LOG: redirecting log output to logging collector process
2019-10-07 11:26:17.358 CST [1443] HINT: Future log output will appear in directory “pg_log”.
Done.
CREATE NODE
t
(1 row)
ALTER NODE
pgxc_pool_reload
t
(1 row)
vacuumdb: vacuuming database “postgres”
vacuumdb: vacuuming database “template1”
PGXC add datanode master dn1 gtm 40001 40011 $dataDirRoot/dn_master.1 none none none
Actual Command: ssh zs@gtm “( PGXC_CTL_SILENT=1 initdb -D $dataDirRoot/dn_master.1 --nodename dn1 ) > /tmp/bigdataA_STDOUT_671_20 2>&1” < /dev/null > /dev/null 2>&1
Bring remote stdout: scp zs@gtm:/tmp/bigdataA_STDOUT_671_20 /tmp/STDOUT_671_21 > /dev/null 2>&1
The files belonging to this database system will be owned by user “zs”.
This user must also own the server process.
The database cluster will be initialized with locale “en_US.UTF-8”.
The default database encoding has accordingly been set to “UTF8”.
The default text search configuration will be set to “english”.
Data page checksums are disabled.
creating directory /home/zs/data/dn_master.1 … ok
creating subdirectories … ok
selecting default max_connections … 100
selecting default shared_buffers … 128MB
selecting dynamic shared memory implementation … posix
creating configuration files … ok
running bootstrap script … ok
performing post-bootstrap initialization … creating cluster information … ok
syncing data to disk … ok
freezing database template0 … ok
freezing database template1 … ok
freezing database postgres … ok
WARNING: enabling “trust” authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
–auth-local and --auth-host, the next time you run initdb.
Success.
INFO: please do not close this session until you are done adding the new node
pgxc_lock_for_backup
t
(1 row)
Actual Command: ssh zs@gtm “( pg_ctl start -w -Z restoremode -D $dataDirRoot/dn_master.1 -o ‘-i -b’ ) > /tmp/bigdataA_STDOUT_671_23 2>&1” < /dev/null > /dev/null 2>&1
Bring remote stdout: scp zs@gtm:/tmp/bigdataA_STDOUT_671_23 /tmp/STDOUT_671_24 > /dev/null 2>&1
2016-11-04 01:26:13.536 CST [1328] LOG: listening on IPv4 address “0.0.0.0”, port 40001
2016-11-04 01:26:13.536 CST [1328] LOG: listening on IPv6 address “::”, port 40001
2016-11-04 01:26:13.580 CST [1328] LOG: listening on Unix socket “/tmp/.s.PGSQL.40001”
2016-11-04 01:26:13.622 CST [1328] LOG: redirecting log output to logging collector process
2016-11-04 01:26:13.622 CST [1328] HINT: Future log output will appear in directory “pg_log”.
SET
SET
SET
binary_upgrade_set_next_pg_authid_oid
(1 row)
ALTER ROLE
UPDATE 1
UPDATE 1
REVOKE
GRANT
CREATE NODE
CREATE NODE
You are now connected to database “postgres” as user “zs”.
SET
SET
SET
SET
SET
SET
set_config
(1 row)
SET
SET
SET
UPDATE 1
UPDATE 1
COMMENT
You are now connected to database “template1” as user “zs”.
SET
SET
SET
SET
SET
SET
set_config
(1 row)
SET
SET
SET
UPDATE 1
UPDATE 1
COMMENT
Actual Command: ssh zs@gtm “( pg_ctl stop -w -Z restoremode -D $dataDirRoot/dn_master.1 ) > /tmp/bigdataA_STDOUT_671_25 2>&1” < /dev/null > /dev/null 2>&1
Bring remote stdout: scp zs@gtm:/tmp/bigdataA_STDOUT_671_25 /tmp/STDOUT_671_26 > /dev/null 2>&1
Starting datanode master dn1.
2016-11-04 01:26:18.175 CST [1447] LOG: listening on IPv4 address “0.0.0.0”, port 40001
2016-11-04 01:26:18.176 CST [1447] LOG: listening on IPv6 address “::”, port 40001
2016-11-04 01:26:18.191 CST [1447] LOG: listening on Unix socket “/tmp/.s.PGSQL.40001”
2016-11-04 01:26:18.246 CST [1447] LOG: redirecting log output to logging collector process
2016-11-04 01:26:18.246 CST [1447] HINT: Future log output will appear in directory “pg_log”.
Done.
CREATE NODE
pgxc_pool_reload t
(1 row)
CREATE NODE
pgxc_pool_reload
t
(1 row)
EXECUTE DIRECT
pgxc_pool_reload
t
(1 row)
PGXC add datanode master dn2 datanode2 40002 40012 $dataDirRoot/dn_master.2 none none none
Actual Command: ssh zs@datanode2 “( PGXC_CTL_SILENT=1 initdb -D $dataDirRoot/dn_master.2 --nodename dn2 ) > /tmp/bigdataA_STDOUT_671_29 2>&1” < /dev/null > /dev/null 2>&1
Bring remote stdout: scp zs@datanode2:/tmp/bigdataA_STDOUT_671_29 /tmp/STDOUT_671_30 > /dev/null 2>&1
The files belonging to this database system will be owned by user “zs”.
This user must also own the server process.
The database cluster will be initialized with locale “en_US.UTF-8”.
The default database encoding has accordingly been set to “UTF8”.
The default text search configuration will be set to “english”.
Data page checksums are disabled.
creating directory /home/zs/data/dn_master.2 … ok
creating subdirectories … ok
selecting default max_connections … 100
selecting default shared_buffers … 128MB
selecting dynamic shared memory implementation … posix
creating configuration files … ok
running bootstrap script … ok
performing post-bootstrap initialization … creating cluster information … ok
syncing data to disk … ok
freezing database template0 … ok
freezing database template1 … ok
freezing database postgres … ok
WARNING: enabling “trust” authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
–auth-local and --auth-host, the next time you run initdb.
Success.
INFO: please do not close this session until you are done adding the new node
pgxc_lock_for_backup
t
(1 row)
Actual Command: ssh zs@datanode2 “( pg_ctl start -w -Z restoremode -D $dataDirRoot/dn_master.2 -o ‘-i -b’ ) > /tmp/bigdataA_STDOUT_671_32 2>&1” < /dev/null > /dev/null 2>&1
Bring remote stdout: scp zs@datanode2:/tmp/bigdataA_STDOUT_671_32 /tmp/STDOUT_671_33 > /dev/null 2>&1
2019-10-07 11:31:28.128 CST [1586] LOG: listening on IPv4 address “0.0.0.0”, port 40002
2019-10-07 11:31:28.128 CST [1586] LOG: listening on IPv6 address “::”, port 40002
2019-10-07 11:31:28.178 CST [1586] LOG: listening on Unix socket “/tmp/.s.PGSQL.40002”
2019-10-07 11:31:28.255 CST [1586] LOG: redirecting log output to logging collector process
2019-10-07 11:31:28.255 CST [1586] HINT: Future log output will appear in directory “pg_log”.
SET
SET
SET
binary_upgrade_set_next_pg_authid_oid
(1 row)
ALTER ROLE
UPDATE 1
UPDATE 1
REVOKE
GRANT
CREATE NODE
CREATE NODE
CREATE NODE
You are now connected to database “postgres” as user “zs”.
SET
SET
SET
SET
SET
SET
set_config
(1 row)
SET
SET
SET
UPDATE 1
UPDATE 1
COMMENT
You are now connected to database “template1” as user “zs”.
SET
SET
SET
SET
SET
SET
set_config
(1 row)
SET
SET
SET
UPDATE 1
UPDATE 1
COMMENT
Actual Command: ssh zs@datanode2 “( pg_ctl stop -w -Z restoremode -D $dataDirRoot/dn_master.2 ) > /tmp/bigdataA_STDOUT_671_34 2>&1” < /dev/null > /dev/null 2>&1
Bring remote stdout: scp zs@datanode2:/tmp/bigdataA_STDOUT_671_34 /tmp/STDOUT_671_35 > /dev/null 2>&1
Starting datanode master dn2.
2019-10-07 11:31:33.339 CST [1659] LOG: listening on IPv4 address “0.0.0.0”, port 40002
2019-10-07 11:31:33.339 CST [1659] LOG: listening on IPv6 address “::”, port 40002
2019-10-07 11:31:33.389 CST [1659] LOG: listening on Unix socket “/tmp/.s.PGSQL.40002”
2019-10-07 11:31:33.466 CST [1659] LOG: redirecting log output to logging collector process
2019-10-07 11:31:33.466 CST [1659] HINT: Future log output will appear in directory “pg_log”.
Done.
CREATE NODE
pgxc_pool_reload
t
(1 row)
CREATE NODE
pgxc_pool_reload
t
(1 row)
EXECUTE DIRECT
pgxc_pool_reload
t
(1 row)
EXECUTE DIRECT
pgxc_pool_reload
t
(1 row)
PGXC
可看到,所有節點均已正常啟動
PGXC monitor all
Running: gtm master
Running: coordinator master coord1
Running: coordinator master coord2
Running: datanode master dn1
Running: datanode master dn2
PGXC exit
2.3 操作大資料庫
zs@bigdataA:~$ psql -h datanode1 -p 30001 postgres zs //進入資料庫
psql (PGXL 10r1.1, based on PG 10.6 (Postgres-XL 10r1.1))
Type “help” for help.
postgres=# select * from pgxc_node;
node_name | node_type | node_port | node_host | nodeis_primary | nodeis_preferred | node_id
-----------±----------±----------±----------±---------------±-----------------±------------
coord1 | C | 30001 | gtm | f | f | 1885696643
coord2 | C | 30002 | datanode2 | f | f | -1197102633
dn1 | D | 40001 | gtm | f | f | -560021589
dn2 | D | 40002 | datanode2 | f | f | 352366662
(4 rows)
postgres=# CREATE TABLE t3(bid serial PRIMARY KEY,id integer,xm varchar(255),zh varchar(255),nr bytea,tjsj timestamp DEFAULT now()); //建立表t3
CREATE TABLE
postgres=# \d
List of relations
Schema | Name | Type | Owner
--------±-----------±---------±------
public | t1 | table | zs
public | t1_bid_seq | sequence | zs
public | t2 | table | zs
public | t2_bid_seq | sequence | zs
public | t3 | table | zs
public | t3_bid_seq | sequence | zs
(6 rows)
postgres=#\q
————————————————
版權宣告:本文為CSDN博主「wxh585」的原創文章,遵循 CC 4.0 BY-SA 版權協議,轉載請附上原文出處連結及本宣告。
原文連結:https://blog.csdn.net/wxh585/article/details/102297112
埠、ip配置見下表
大資料軟體postgresql-xl,ssh軟體作業系統已自帶,使用者zs(作業系統已建立),工作目錄/home/zs/
1.以下操作二臺伺服器均需配置
su zs
nano /etc/hosts //編輯檔案,加入以下行
192.168.1.125 gtm
192.168.1.125 coordinator1
192.168.1.125 datanode1
192.168.1.8 coordinator2
192.168.1.8 datanode2
vi .bashrc //配置環境變數
export PGHOME=/usr/local/pgxl10
export LD_LIBRARY_PATH=PGHOME/lib:PGHOME/lib:PGHOME/lib:LD_LIBRARY_PATH
export PATH=PGHOME/bin:PGHOME/bin:PGHOME/bin:PATH
export dataDirRoot=$HOME/data
su root //重啟伺服器,使配置生效
reboot
2.在gtm上操作
2.1設定ssh 二臺裝置無密碼登陸
su zs
ssh-keygen -t rsa
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
ssh zs@datanode1 mkdir -p .ssh
cat .ssh/id_rsa.pub | ssh zs@datanode1 ‘cat >> .ssh/authorized_keys’
ssh zs@datanode2 mkdir -p .ssh
cat .ssh/id_rsa.pub | ssh zs@datanode2 ‘cat >> .ssh/authorized_keys’
以上操作,提問全部回車。
2.2 建立大資料庫
zs@bigdataA:~$pgxc_ctl
/bin/bash
Installing pgxc_ctl_bash script as /home/zs/pgxc_ctl/pgxc_ctl_bash.
Installing pgxc_ctl_bash script as /home/zs/pgxc_ctl/pgxc_ctl_bash.
Reading configuration using /home/zs/pgxc_ctl/pgxc_ctl_bash --home /home/zs/pgxc_ctl --configuration /home/zs/pgxc_ctl/pgxc_ctl.conf
Finished reading configuration.
******** PGXC_CTL START ***************
Current directory: /home/zs/pgxc_ctl
PGXC prepare config empty
PGXC exit
zs@bigdataA:~$ nano /home/zs/pgxc_ctl/pgxc_ctl.conf
zs@bigdataA:~$ cp /home/zs/pgxc_ctl/pgxc_ctl.conf /home/zs/pgxc_ctl.conf-all-in-2-init
zs@bigdataA:~$ pgxc_ctl
/bin/bash
Installing pgxc_ctl_bash script as /home/zs/pgxc_ctl/pgxc_ctl_bash.
Installing pgxc_ctl_bash script as /home/zs/pgxc_ctl/pgxc_ctl_bash.
Reading configuration using /home/zs/pgxc_ctl/pgxc_ctl_bash --home /home/zs/pgxc_ctl --configuration /home/zs/pgxc_ctl/pgxc_ctl.conf
Finished reading configuration.
******** PGXC_CTL START ***************
Current directory: /home/zs/pgxc_ctl
PGXC add gtm master gtm gtm 20001 $dataDirRoot/gtm
Initialize GTM master
The files belonging to this GTM system will be owned by user “zs”.
This user must also own the server process.
fixing permissions on existing directory /home/zs/data/gtm … ok
creating configuration files … ok
creating control file … ok
Success.
Done.
Start GTM master
server starting
PGXC add coordinator master coord1 gtm 30001 30011 $dataDirRoot/coord_master.1 none none
Actual Command: ssh zs@gtm “( PGXC_CTL_SILENT=1 initdb -D $dataDirRoot/coord_master.1 --nodename coord1 ) > /tmp/bigdataA_STDOUT_671_7 2>&1” < /dev/null > /dev/null 2>&1
Bring remote stdout: scp zs@gtm:/tmp/bigdataA_STDOUT_671_7 /tmp/STDOUT_671_8 > /dev/null 2>&1
The files belonging to this database system will be owned by user “zs”.
This user must also own the server process.
The database cluster will be initialized with locale “en_US.UTF-8”.
The default database encoding has accordingly been set to “UTF8”.
The default text search configuration will be set to “english”.
Data page checksums are disabled.
creating directory /home/zs/data/coord_master.1 … ok
creating subdirectories … ok
selecting default max_connections … 100
selecting default shared_buffers … 128MB
selecting dynamic shared memory implementation … posix
creating configuration files … ok
running bootstrap script … ok
performing post-bootstrap initialization … creating cluster information … ok
syncing data to disk … ok
freezing database template0 … ok
freezing database template1 … ok
freezing database postgres … ok
WARNING: enabling “trust” authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
–auth-local and --auth-host, the next time you run initdb.
Success.
Starting coordinator master coord1
2016-11-04 01:22:10.335 CST [1005] LOG: listening on IPv4 address “0.0.0.0”, port 30001
2016-11-04 01:22:10.336 CST [1005] LOG: listening on IPv6 address “::”, port 30001
2016-11-04 01:22:10.377 CST [1005] LOG: listening on Unix socket “/tmp/.s.PGSQL.30001”
2016-11-04 01:22:10.435 CST [1005] LOG: redirecting log output to logging collector process
2016-11-04 01:22:10.435 CST [1005] HINT: Future log output will appear in directory “pg_log”.
Done.
ALTER NODE
pgxc_pool_reload
t
(1 row)
vacuumdb: vacuuming database “postgres”
vacuumdb: vacuuming database “template1”
PGXC
PGXC add coordinator master coord1 gtm 30001 30011 $dataDirRoot/coord_master.1 none none
Actual Command: ssh zs@gtm “( PGXC_CTL_SILENT=1 initdb -D $dataDirRoot/coord_master.1 --nodename coord1 ) > /tmp/bigdataA_STDOUT_671_7 2>&1” < /dev/null > /dev/null 2>&1
Bring remote stdout: scp zs@gtm:/tmp/bigdataA_STDOUT_671_7 /tmp/STDOUT_671_8 > /dev/null 2>&1
The files belonging to this database system will be owned by user “zs”.
This user must also own the server process.
The database cluster will be initialized with locale “en_US.UTF-8”.
The default database encoding has accordingly been set to “UTF8”.
The default text search configuration will be set to “english”.
Data page checksums are disabled.
creating directory /home/zs/data/coord_master.1 … ok
creating subdirectories … ok
selecting default max_connections … 100
selecting default shared_buffers … 128MB
selecting dynamic shared memory implementation … posix
creating configuration files … ok
running bootstrap script … ok
performing post-bootstrap initialization … creating cluster information … ok
syncing data to disk … ok
freezing database template0 … ok
freezing database template1 … ok
freezing database postgres … ok
WARNING: enabling “trust” authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
–auth-local and --auth-host, the next time you run initdb.
Success.
Starting coordinator master coord1
2016-11-04 01:22:10.335 CST [1005] LOG: listening on IPv4 address “0.0.0.0”, port 30001
2016-11-04 01:22:10.336 CST [1005] LOG: listening on IPv6 address “::”, port 30001
2016-11-04 01:22:10.377 CST [1005] LOG: listening on Unix socket “/tmp/.s.PGSQL.30001”
2016-11-04 01:22:10.435 CST [1005] LOG: redirecting log output to logging collector process
2016-11-04 01:22:10.435 CST [1005] HINT: Future log output will appear in directory “pg_log”.
Done.
ALTER NODE
pgxc_pool_reload
t
(1 row)
vacuumdb: vacuuming database “postgres”
vacuumdb: vacuuming database “template1”
PGXC add coordinator master coord2 datanode2 30002 30012 $dataDirRoot/coord_master.2 none none
Actual Command: ssh zs@datanode2 “( PGXC_CTL_SILENT=1 initdb -D $dataDirRoot/coord_master.2 --nodename coord2 ) > /tmp/bigdataA_STDOUT_671_11 2>&1” < /dev/null > /dev/null 2>&1
Bring remote stdout: scp zs@datanode2:/tmp/bigdataA_STDOUT_671_11 /tmp/STDOUT_671_12 > /dev/null 2>&1
The files belonging to this database system will be owned by user “zs”.
This user must also own the server process.
The database cluster will be initialized with locale “en_US.UTF-8”.
The default database encoding has accordingly been set to “UTF8”.
The default text search configuration will be set to “english”.
Data page checksums are disabled.
creating directory /home/zs/data/coord_master.2 … ok
creating subdirectories … ok
selecting default max_connections … 100
selecting default shared_buffers … 128MB
selecting dynamic shared memory implementation … posix
creating configuration files … ok
running bootstrap script … ok
performing post-bootstrap initialization … creating cluster information … ok
syncing data to disk … ok
freezing database template0 … ok
freezing database template1 … ok
freezing database postgres … ok
WARNING: enabling “trust” authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
–auth-local and --auth-host, the next time you run initdb.
Success.
INFO: please do not close this session until you are done adding the new node
pgxc_lock_for_backup
t
(1 row)
Actual Command: ssh zs@datanode2 “( pg_ctl start -w -Z restoremode -D $dataDirRoot/coord_master.2 -o ‘-i -b’ ) > /tmp/bigdataA_STDOUT_671_14 2>&1” < /dev/null > /dev/null 2>&1
Bring remote stdout: scp zs@datanode2:/tmp/bigdataA_STDOUT_671_14 /tmp/STDOUT_671_15 > /dev/null 2>&1
2019-10-07 11:26:12.056 CST [1370] LOG: listening on IPv4 address “0.0.0.0”, port 30002
2019-10-07 11:26:12.056 CST [1370] LOG: listening on IPv6 address “::”, port 30002
2019-10-07 11:26:12.106 CST [1370] LOG: listening on Unix socket “/tmp/.s.PGSQL.30002”
2019-10-07 11:26:12.183 CST [1370] LOG: redirecting log output to logging collector process
2019-10-07 11:26:12.183 CST [1370] HINT: Future log output will appear in directory “pg_log”.
SET
SET
SET
binary_upgrade_set_next_pg_authid_oid
(1 row)
ALTER ROLE
UPDATE 1
UPDATE 1
REVOKE
GRANT
CREATE NODE
You are now connected to database “postgres” as user “zs”.
SET
SET
SET
SET
SET
SET
set_config
(1 row)
SET
SET
SET
UPDATE 1
UPDATE 1
COMMENT
You are now connected to database “template1” as user “zs”.
SET
SET
SET
SET
SET
SET
set_config
(1 row)
SET
SET
SET
UPDATE 1
UPDATE 1
COMMENT
Actual Command: ssh zs@datanode2 “( pg_ctl stop -w -Z restoremode -D $dataDirRoot/coord_master.2 ) > /tmp/bigdataA_STDOUT_671_16 2>&1” < /dev/null > /dev/null 2>&1
Bring remote stdout: scp zs@datanode2:/tmp/bigdataA_STDOUT_671_16 /tmp/STDOUT_671_17 > /dev/null 2>&1
Starting coordinator master coord2
2019-10-07 11:26:17.231 CST [1443] LOG: listening on IPv4 address “0.0.0.0”, port 30002
2019-10-07 11:26:17.231 CST [1443] LOG: listening on IPv6 address “::”, port 30002
2019-10-07 11:26:17.282 CST [1443] LOG: listening on Unix socket “/tmp/.s.PGSQL.30002”
2019-10-07 11:26:17.358 CST [1443] LOG: redirecting log output to logging collector process
2019-10-07 11:26:17.358 CST [1443] HINT: Future log output will appear in directory “pg_log”.
Done.
CREATE NODE
t
(1 row)
ALTER NODE
pgxc_pool_reload
t
(1 row)
vacuumdb: vacuuming database “postgres”
vacuumdb: vacuuming database “template1”
PGXC add datanode master dn1 gtm 40001 40011 $dataDirRoot/dn_master.1 none none none
Actual Command: ssh zs@gtm “( PGXC_CTL_SILENT=1 initdb -D $dataDirRoot/dn_master.1 --nodename dn1 ) > /tmp/bigdataA_STDOUT_671_20 2>&1” < /dev/null > /dev/null 2>&1
Bring remote stdout: scp zs@gtm:/tmp/bigdataA_STDOUT_671_20 /tmp/STDOUT_671_21 > /dev/null 2>&1
The files belonging to this database system will be owned by user “zs”.
This user must also own the server process.
The database cluster will be initialized with locale “en_US.UTF-8”.
The default database encoding has accordingly been set to “UTF8”.
The default text search configuration will be set to “english”.
Data page checksums are disabled.
creating directory /home/zs/data/dn_master.1 … ok
creating subdirectories … ok
selecting default max_connections … 100
selecting default shared_buffers … 128MB
selecting dynamic shared memory implementation … posix
creating configuration files … ok
running bootstrap script … ok
performing post-bootstrap initialization … creating cluster information … ok
syncing data to disk … ok
freezing database template0 … ok
freezing database template1 … ok
freezing database postgres … ok
WARNING: enabling “trust” authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
–auth-local and --auth-host, the next time you run initdb.
Success.
INFO: please do not close this session until you are done adding the new node
pgxc_lock_for_backup
t
(1 row)
Actual Command: ssh zs@gtm “( pg_ctl start -w -Z restoremode -D $dataDirRoot/dn_master.1 -o ‘-i -b’ ) > /tmp/bigdataA_STDOUT_671_23 2>&1” < /dev/null > /dev/null 2>&1
Bring remote stdout: scp zs@gtm:/tmp/bigdataA_STDOUT_671_23 /tmp/STDOUT_671_24 > /dev/null 2>&1
2016-11-04 01:26:13.536 CST [1328] LOG: listening on IPv4 address “0.0.0.0”, port 40001
2016-11-04 01:26:13.536 CST [1328] LOG: listening on IPv6 address “::”, port 40001
2016-11-04 01:26:13.580 CST [1328] LOG: listening on Unix socket “/tmp/.s.PGSQL.40001”
2016-11-04 01:26:13.622 CST [1328] LOG: redirecting log output to logging collector process
2016-11-04 01:26:13.622 CST [1328] HINT: Future log output will appear in directory “pg_log”.
SET
SET
SET
binary_upgrade_set_next_pg_authid_oid
(1 row)
ALTER ROLE
UPDATE 1
UPDATE 1
REVOKE
GRANT
CREATE NODE
CREATE NODE
You are now connected to database “postgres” as user “zs”.
SET
SET
SET
SET
SET
SET
set_config
(1 row)
SET
SET
SET
UPDATE 1
UPDATE 1
COMMENT
You are now connected to database “template1” as user “zs”.
SET
SET
SET
SET
SET
SET
set_config
(1 row)
SET
SET
SET
UPDATE 1
UPDATE 1
COMMENT
Actual Command: ssh zs@gtm “( pg_ctl stop -w -Z restoremode -D $dataDirRoot/dn_master.1 ) > /tmp/bigdataA_STDOUT_671_25 2>&1” < /dev/null > /dev/null 2>&1
Bring remote stdout: scp zs@gtm:/tmp/bigdataA_STDOUT_671_25 /tmp/STDOUT_671_26 > /dev/null 2>&1
Starting datanode master dn1.
2016-11-04 01:26:18.175 CST [1447] LOG: listening on IPv4 address “0.0.0.0”, port 40001
2016-11-04 01:26:18.176 CST [1447] LOG: listening on IPv6 address “::”, port 40001
2016-11-04 01:26:18.191 CST [1447] LOG: listening on Unix socket “/tmp/.s.PGSQL.40001”
2016-11-04 01:26:18.246 CST [1447] LOG: redirecting log output to logging collector process
2016-11-04 01:26:18.246 CST [1447] HINT: Future log output will appear in directory “pg_log”.
Done.
CREATE NODE
pgxc_pool_reload t
(1 row)
CREATE NODE
pgxc_pool_reload
t
(1 row)
EXECUTE DIRECT
pgxc_pool_reload
t
(1 row)
PGXC add datanode master dn2 datanode2 40002 40012 $dataDirRoot/dn_master.2 none none none
Actual Command: ssh zs@datanode2 “( PGXC_CTL_SILENT=1 initdb -D $dataDirRoot/dn_master.2 --nodename dn2 ) > /tmp/bigdataA_STDOUT_671_29 2>&1” < /dev/null > /dev/null 2>&1
Bring remote stdout: scp zs@datanode2:/tmp/bigdataA_STDOUT_671_29 /tmp/STDOUT_671_30 > /dev/null 2>&1
The files belonging to this database system will be owned by user “zs”.
This user must also own the server process.
The database cluster will be initialized with locale “en_US.UTF-8”.
The default database encoding has accordingly been set to “UTF8”.
The default text search configuration will be set to “english”.
Data page checksums are disabled.
creating directory /home/zs/data/dn_master.2 … ok
creating subdirectories … ok
selecting default max_connections … 100
selecting default shared_buffers … 128MB
selecting dynamic shared memory implementation … posix
creating configuration files … ok
running bootstrap script … ok
performing post-bootstrap initialization … creating cluster information … ok
syncing data to disk … ok
freezing database template0 … ok
freezing database template1 … ok
freezing database postgres … ok
WARNING: enabling “trust” authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
–auth-local and --auth-host, the next time you run initdb.
Success.
INFO: please do not close this session until you are done adding the new node
pgxc_lock_for_backup
t
(1 row)
Actual Command: ssh zs@datanode2 “( pg_ctl start -w -Z restoremode -D $dataDirRoot/dn_master.2 -o ‘-i -b’ ) > /tmp/bigdataA_STDOUT_671_32 2>&1” < /dev/null > /dev/null 2>&1
Bring remote stdout: scp zs@datanode2:/tmp/bigdataA_STDOUT_671_32 /tmp/STDOUT_671_33 > /dev/null 2>&1
2019-10-07 11:31:28.128 CST [1586] LOG: listening on IPv4 address “0.0.0.0”, port 40002
2019-10-07 11:31:28.128 CST [1586] LOG: listening on IPv6 address “::”, port 40002
2019-10-07 11:31:28.178 CST [1586] LOG: listening on Unix socket “/tmp/.s.PGSQL.40002”
2019-10-07 11:31:28.255 CST [1586] LOG: redirecting log output to logging collector process
2019-10-07 11:31:28.255 CST [1586] HINT: Future log output will appear in directory “pg_log”.
SET
SET
SET
binary_upgrade_set_next_pg_authid_oid
(1 row)
ALTER ROLE
UPDATE 1
UPDATE 1
REVOKE
GRANT
CREATE NODE
CREATE NODE
CREATE NODE
You are now connected to database “postgres” as user “zs”.
SET
SET
SET
SET
SET
SET
set_config
(1 row)
SET
SET
SET
UPDATE 1
UPDATE 1
COMMENT
You are now connected to database “template1” as user “zs”.
SET
SET
SET
SET
SET
SET
set_config
(1 row)
SET
SET
SET
UPDATE 1
UPDATE 1
COMMENT
Actual Command: ssh zs@datanode2 “( pg_ctl stop -w -Z restoremode -D $dataDirRoot/dn_master.2 ) > /tmp/bigdataA_STDOUT_671_34 2>&1” < /dev/null > /dev/null 2>&1
Bring remote stdout: scp zs@datanode2:/tmp/bigdataA_STDOUT_671_34 /tmp/STDOUT_671_35 > /dev/null 2>&1
Starting datanode master dn2.
2019-10-07 11:31:33.339 CST [1659] LOG: listening on IPv4 address “0.0.0.0”, port 40002
2019-10-07 11:31:33.339 CST [1659] LOG: listening on IPv6 address “::”, port 40002
2019-10-07 11:31:33.389 CST [1659] LOG: listening on Unix socket “/tmp/.s.PGSQL.40002”
2019-10-07 11:31:33.466 CST [1659] LOG: redirecting log output to logging collector process
2019-10-07 11:31:33.466 CST [1659] HINT: Future log output will appear in directory “pg_log”.
Done.
CREATE NODE
pgxc_pool_reload
t
(1 row)
CREATE NODE
pgxc_pool_reload
t
(1 row)
EXECUTE DIRECT
pgxc_pool_reload
t
(1 row)
EXECUTE DIRECT
pgxc_pool_reload
t
(1 row)
PGXC
可看到,所有節點均已正常啟動
PGXC monitor all
Running: gtm master
Running: coordinator master coord1
Running: coordinator master coord2
Running: datanode master dn1
Running: datanode master dn2
PGXC exit
2.3 操作大資料庫
zs@bigdataA:~$ psql -h datanode1 -p 30001 postgres zs //進入資料庫
psql (PGXL 10r1.1, based on PG 10.6 (Postgres-XL 10r1.1))
Type “help” for help.
postgres=# select * from pgxc_node;
node_name | node_type | node_port | node_host | nodeis_primary | nodeis_preferred | node_id
-----------±----------±----------±----------±---------------±-----------------±------------
coord1 | C | 30001 | gtm | f | f | 1885696643
coord2 | C | 30002 | datanode2 | f | f | -1197102633
dn1 | D | 40001 | gtm | f | f | -560021589
dn2 | D | 40002 | datanode2 | f | f | 352366662
(4 rows)
postgres=# CREATE TABLE t3(bid serial PRIMARY KEY,id integer,xm varchar(255),zh varchar(255),nr bytea,tjsj timestamp DEFAULT now()); //建立表t3
CREATE TABLE
postgres=# \d
List of relations
Schema | Name | Type | Owner
--------±-----------±---------±------
public | t1 | table | zs
public | t1_bid_seq | sequence | zs
public | t2 | table | zs
public | t2_bid_seq | sequence | zs
public | t3 | table | zs
public | t3_bid_seq | sequence | zs
(6 rows)
postgres=#\q
————————————————
版權宣告:本文為CSDN博主「wxh585」的原創文章,遵循 CC 4.0 BY-SA 版權協議,轉載請附上原文出處連結及本宣告。
原文連結:https://blog.csdn.net/wxh585/article/details/102297112
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/23102655/viewspace-2659318/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 大資料分析平臺如何構建大資料
- 構建大資料平臺的必要性大資料
- 構建大資料平臺(二)準備工作大資料
- 江西加快智慧防汛建設構建防汛大資料平臺大資料
- 構建實時資料整合平臺時,在技術選型上的考量點
- 大資料平臺建設經驗大資料
- 基於Apache Hudi在Google雲構建資料湖平臺ApacheGo
- 在海之舟大資料平臺上搭建mysql+php開發平臺大資料MySqlPHP
- 構建煤礦物聯網大資料平臺思路(1)大資料
- DataPipeline丨構建實時資料整合平臺時,在技術選型上的考量點API
- 大資料平臺架構設計探究大資料架構
- 大資料平臺核心架構圖鑑大資料架構
- 企業資料平臺建設的基石:構建統一的資料存算能力
- JuiceFS 在大搜車資料平臺的實踐UI
- 中通大資料平臺在大促中的進化大資料
- 資料平臺、大資料平臺、資料中臺……還分的清不?大資料
- 大資料平臺之大資料處理系統的架構大資料架構
- DataPipeline在大資料平臺的資料流實踐API大資料
- RocketMQ Connect 構建流式資料處理平臺MQ
- 使用 Flink Hudi 構建流式資料湖平臺
- 打造“資料金字塔”,小米大資料平臺建設之路大資料
- 案例|政務大資料平臺資料安全建設實踐大資料
- 美圖大資料平臺架構實踐大資料架構
- DKHadoop大資料平臺架構詳解Hadoop大資料架構
- TDS:標籤平臺+API平臺+資料共享平臺,助力資料運營平臺建設API
- 在國產處理器的伺服器+海之舟大資料作業系統上建立網站伺服器大資料作業系統網站
- 在國產晶片伺服器(海之舟伺服器+作業系統)上建立軟Raid晶片伺服器作業系統AI
- [平臺建設] 大資料平臺如何實現任務日誌採集大資料
- 嗶哩嗶哩大資料平臺建設之路——資料安全篇大資料
- 雲端計算平臺上的大資料技術解讀!大資料
- 大資料分析平臺建設需要注意什麼大資料
- 大資料治理——搭建大資料探索平臺大資料
- 剖析大資料平臺的資料處理大資料
- 一張圖剖析企業大資料平臺的核心架構大資料架構
- 大資料平臺的整體架構由哪些組成大資料架構
- 數棧產品分享:基於StreamWorks構建實時大資料處理平臺大資料
- 基於Go語言構建的萬億級流量大資料平臺架構Go大資料架構
- 大資料平臺是什麼?有哪些功能?如何搭建大資料平臺?大資料