Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Database \ Postgres-X2 deployment steps     - RHEL5.x RHEL6.x replace CentOS yum source (Linux)

- Linux modify environment variables method (Linux)

- dd command: do hard disk IO performance test (Linux)

- To establish a secure and reliable Linux operating system (Linux)

- VirtualBox modify the size of the virtual machine disk VDI (Linux)

- SVN hook code set to synchronize Web directory (Server)

- Talk Packages (Linux)

- How to create a cloud encrypted file system in Linux systems (Linux)

- How to create a remote (Linux)

- ORA-01839 error caused by incorrect system date setting (Database)

- Default permissions Linux file and directory permissions and hide - umask, chattr, lsattr, SUID, SGID, SBIT, file (Linux)

- Nodejs complete installation instructions for Express (Linux)

- Oracle how to maintain the consistency of read? (Database)

- Shell scripts to copy all directories under the current directory of a certain type of file to the same directory (Linux)

- Oracle 11g manually create a database (Database)

- Transfer MySQL database to MariaDB (Database)

- Is Linux the most secure operating system (Linux)

- Perl loop (Programming)

- Three binary tree traversal (recursive, non-recursive traversal and Morris) (Programming)

- CKEditor + SWFUpload achieve a more powerful editor (Linux)

 
         
  Postgres-X2 deployment steps
     
  Add Date : 2018-11-21      
         
         
         
  Postgre2015 elephants, we are concerned PostgreSQL cluster Currently, developers have turned to Postgres-X2, the process according to the recent deployment of their own and colleagues xl deployed about Postgres-X2. The deployment test is conducted using pgxc_ctl deployment, more flexible deployment cluster.

1, the overall summary:

    A total of four nodes, a gtm, a coordinator, two datanode.

 a. GTM node
        IP: 192.168.238.129
        nodename: gtm
        port: 6666
    b.coordinator
        IP: 192.168.238.130
        nodename: coord1
        port: 5432
        pooler_port: 6668
    c.datanode1
        IP: 192.168.238.131
        nodename: datanode1
        port: 15432
        pooler_port: 6669
    d.datanode2
        IP: 192.168.238.132
        nodename: datanode2
        port: 15432
        pooler_port: 6669

2. Preparation (Unless otherwise specified, four nodes do the same operation):

a. compile and install pgx2, while compiling contrib.

./configure --prefix = / opt / pgx2
make; make install
cd contrib
make; make install

b. to create a user postgres, the owner assigned to the installation directory postgres.

chown -R postgres: postgres pgx2

c. Configure ssh connection

[Postgres @ localhost ~] # ssh-keygen
Generating public / private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
ea: c9: 48: 2d: dc: 0d: ab: 9b: 3d: 99: cb: bd: db: 3b: ba: fa root@localhost.localdomain
The key's randomart image is:
+ - [RSA 2048] ---- +
| |
| |
| |
| |
|. S |
|. O = |
| + = O. |
|. X + o .. |
| = .O = E = oo |
+ ----------------- +
[Postgres @ localhost ~] #


cat ~ / .ssh / id_rsa.pub >> ~ / .ssh / authorized_keys
 
vi / etc / hosts
192.168.238.129 localhost.localdomain
 
- The distribution key, gtm distribution node to another node
scp ~ / .ssh / authorized_keys postgres@192.168.238.130
scp ~ / .ssh / authorized_keys postgres@192.168.238.131
scp ~ / .ssh / authorized_keys postgres@192.168.238.132

d. Configuration Environment Variables

[Postgres @ localhost ~] $ cat .bashrc
# .bashrc
 
# Source global definitions
if [-f / etc / bashrc]; then
    . / Etc / bashrc
fi
 
export PGHOME = / opt / pgx2 /
export PGUSER = postgres
export LD_LIBRARY_PATH = $ PGHOME / lib
export PATH = $ PGHOME / bin: $ PATH
 
# User specific aliases and functions
[Postgres @ localhost ~] $

Suggest:

When efficiency ssh connection is slow, you can use ssh -v detected here do not illustrate.
 
Modify / etc / ssh / sshd_config of GSSAPIAuthentication and UseDNS is no ssh connection speed can improve.

For convenience, I will shut down all the nodes of iptables, you can configure itself.

3, node deployment

a. Configure pgxc_ctl.conf

- In / home / postgres / pgxc_ctl under
 
--conf content
cat pgxc_ctl.conf
#user and path
pgxcOwner = postgres
pgxcUser = $ pgxcOwner
pgxcInstallDir = / opt / pgx2
 
#gtm and gtmproxy
gtmMasterDir = $ HOME / pgxc / nodes / gtm
gtmMasterPort = 6666
gtmMasterServer = 192.168.238.129
gtmSlave = n
 
#gtmproxy
gtmProxy = n
gtmProxyDir = $ HOME / pgxc / nodes / coord
gtmProxyNames = (gtm_pxy1)
gtmProxyServers = (192.168.238.130)
gtmProxyPorts = (20001)
gtmProxyDirs = ($ gtmProxyDir / gtm_pxy1)
gtmPxyExtraConfig = (none)
gtmPxySpecificExtraConfig = (none)
 
#coordinator
coordMasterDir = $ HOME / pgxc / nodes / coord
coordNames = (coord1)
coordPorts = (5432)
poolerPorts = (6668)
coordPgHbaEntries = (192.168.238.0/24)
coordMasterServers = (192.168.238.130)
coordMasterDirs = ($ coordMasterDir / coord1)
coordMaxWALsernder = 0
coordMaxWALSenders = ($ coordMaxWALsernder)
coordSlave = n
coordSpecificExtraConfig = (none)
coordSpecificExtraPgHba = (none)
 
#datanode
datanodeNames = (datanode1 datanode2)
datanodePorts = (15432 15432)
datanodePoolerPorts = (6669 6669)
datanodePgHbaEntries = (192.168.238.0/24)
datanodeMasterServers = (192.168.238.131 192.168.238.132)
datanodeMasterDir = $ HOME / pgxc / nodes / dn_master
datanodeMasterDirs = ($ datanodeMasterDir / datanode1 $ datanodeMasterDir / datanode2)
datanodeMaxWALsernder = 0
datanodeMaxWALSenders = ($ datanodeMaxWALsernder $ datanodeMaxWALsernder)
datanodeSlave = n
primaryDatanode = datanode1
datanodeSpecificExtraConfig = (none none)
datanodeSpecificExtraPgHba = (none none)

b. Using pgxc_ctl node deployment

pgxc_ctl init all
 
[Postgres @ localhost ~] $ pgxc_ctl init all
Installing pgxc_ctl_bash script as / home / postgres / pgxc_ctl / pgxc_ctl_bash.
Installing pgxc_ctl_bash script as / home / postgres / pgxc_ctl / pgxc_ctl_bash.
Reading configuration using / home / postgres / pgxc_ctl / pgxc_ctl_bash --home / home / postgres / pgxc_ctl --configuration /home/postgres/pgxc_ctl/pgxc_ctl.conf
Finished to read configuration.
  ******** PGXC_CTL START ***************
 
Current directory: / home / postgres / pgxc_ctl
Initialize GTM master
The files belonging to this GTM system will be owned by user "postgres".
This user must also own the server process.
 
 
fixing permissions on existing directory / home / postgres / pgxc / nodes / gtm ... ok
creating configuration files ... ok
 
. Success You can now start the GTM server using:
 
    gtm -D / home / postgres / pgxc / nodes / gtm
or
    gtm_ctl -Z gtm -D / home / postgres / pgxc / nodes / gtm -l logfile start
 
waiting for server to shut down ... done
server stopped
Done.
Start GTM master
gtm_ctl: PID file "/home/postgres/pgxc/nodes/gtm/gtm.pid" does not exist
Is server running?
server starting
Initialize all the coordinator masters.
Initialize coordinator master coord1.
The files belonging to this database system will be owned by user "postgres".
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.
 
fixing permissions on existing directory / home / postgres / pgxc / nodes / coord / coord1 ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
creating configuration files ... ok
creating template1 database in / home / postgres / pgxc / nodes / coord / coord1 / base / 1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
creating cluster information ... ok
loading system objects' descriptions ... ok
creating collations ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
loading PL / pgSQL server-side language ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... 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.
 You can now start the database server of the Postgres-XC coordinator using:
 
    postgres --coordinator -D / home / postgres / pgxc / nodes / coord / coord1
or
    pg_ctl start -D / home / postgres / pgxc / nodes / coord / coord1 -Z coordinator -l logfile
 
 You can now start the database server of the Postgres-XC datanode using:
 
    postgres --datanode -D / home / postgres / pgxc / nodes / coord / coord1
or
    pg_ctl start -D / home / postgres / pgxc / nodes / coord / coord1 -Z datanode -l logfile
 
Done.
Starting coordinator master.
Starting coordinator master coord1
Done.
Initialize all the datanode masters.
Initialize the datanode master datanode1.
Initialize the datanode master datanode2.
The files belonging to this database system will be owned by user "postgres".
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.
 
fixing permissions on existing directory / home / postgres / pgxc / nodes / dn_master / datanode1 ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
creating configuration files ... ok
creating template1 database in / home / postgres / pgxc / nodes / dn_master / datanode1 / base / 1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
creating cluster information ... ok
loading system objects' descriptions ... ok
creating collations ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
loading PL / pgSQL server-side language ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... 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.
 You can now start the database server of the Postgres-XC coordinator using:
 
    postgres --coordinator -D / home / postgres / pgxc / nodes / dn_master / datanode1
or
    pg_ctl start -D / home / postgres / pgxc / nodes / dn_master / datanode1 -Z coordinator -l logfile
 
 You can now start the database server of the Postgres-XC datanode using:
 
    postgres --datanode -D / home / postgres / pgxc / nodes / dn_master / datanode1
or
    pg_ctl start -D / home / postgres / pgxc / nodes / dn_master / datanode1 -Z datanode -l logfile
 
The files belonging to this database system will be owned by user "postgres".
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.
 
fixing permissions on existing directory / home / postgres / pgxc / nodes / dn_master / datanode2 ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
creating configuration files ... ok
creating template1 database in / home / postgres / pgxc / nodes / dn_master / datanode2 / base / 1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
creating cluster information ... ok
loading system objects' descriptions ... ok
creating collations ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
loading PL / pgSQL server-side language ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... 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.
 You can now start the database server of the Postgres-XC coordinator using:
 
    postgres --coordinator -D / home / postgres / pgxc / nodes / dn_master / datanode2
or
    pg_ctl start -D / home / postgres / pgxc / nodes / dn_master / datanode2 -Z coordinator -l logfile
 
 You can now start the database server of the Postgres-XC datanode using:
 
    postgres --datanode -D / home / postgres / pgxc / nodes / dn_master / datanode2
or
    pg_ctl start -D / home / postgres / pgxc / nodes / dn_master / datanode2 -Z datanode -l logfile
 
Done.
Starting all the datanode masters.
Starting datanode master datanode1.
Starting datanode master datanode2.
Done.
ALTER NODE coord1 WITH (HOST = '192.168.238.130', PORT = 5432);
ALTER NODE
CREATE NODE datanode1 WITH (TYPE = 'datanode', HOST = '192.168.238.131', PORT = 15432, PRIMARY);
CREATE NODE
CREATE NODE datanode2 WITH (TYPE = 'datanode', HOST = '192.168.238.132', PORT = 15432);
CREATE NODE
Done.

4, run the demo

[Postgres @ localhost ~] $ psql -h 192.168.238.130 -p 5432 -d postgres -U postgres
psql (PGXC 1.3devel, based on PG 9.4beta1)
Type "help" for help.
 
postgres = # create table test (id int, name text) distribute by replication;
CREATE TABLE
postgres = # insert into test values ​​(1, 'wang'), (2, 'shuo');
INSERT 0 2
postgres = # select * from test;
 id | name
---- + ------
  1 | wang
  2 | shuo
(2 rows)
 
postgres = # \ q
[Postgres @ localhost ~] $ psql -h 192.168.238.131 -p 15432 -d postgres -U postgres
psql (PGXC 1.3devel, based on PG 9.4beta1)
Type "help" for help.
 
postgres = # select * from test;
 id | name
---- + ------
  1 | wang
  2 | shuo
(2 rows)
 
postgres = # \ q
[Postgres @ localhost ~] $ psql -h 192.168.238.132 -p 15432 -d postgres -U postgres
psql (PGXC 1.3devel, based on PG 9.4beta1)
Type "help" for help.
 
postgres = # select * from test;
 id | name
---- + ------
  1 | wang
  2 | shuo
(2 rows)
 
postgres = #

to sum up:

Compared to manual deployment using pgxc_ctl deployment efficiency and accuracy is very high, welcome to try.
     
         
         
         
  More:      
 
- Secondary exponential smoothing prediction method implemented in Python (Programming)
- Simple comparison of MySQL and Oracle in a sql analytical details (Database)
- MongoDB slice simple example (Database)
- How to use the TF / SD card making Exynos 4412 u-boot boot disk in Ubuntu (Linux)
- Linux System Getting Started Learning: Statistical process a number of threads in Linux (Linux)
- VSFTPD Security (Linux)
- awk variables (Linux)
- Oracle 10g, 11g database silent installation of small differences (Database)
- The sublime into IDE (Linux)
- Linux NIC driver and version information (Linux)
- Hadoop vs spark (Server)
- Tor Browser: under Linux for anonymous Web browsing ultimate browser (Linux)
- jQuery plugin dynamic label generation (Linux)
- How do you turn on and off IPv6 address on Fedora (Linux)
- Slow update statement Performance Analysis (Database)
- numpy and SciPy installation under Python for scientific computing package (Linux)
- Linux use iptables ban Ping (Linux)
- Ora-00600 [fast hot Atkins soft _ that _ Oh, of course not _less_ profile] (Database)
- Brief Linux commands (Linux)
- PHP CURL get cookies simulated login (Database)
     
           
     
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.