Deploy adbmgr
1.Initialize adbmgr.
initmgr -D $mgrdata
Where $mgrdata is the user-specified installation directory for adbmgr (this file directory needs to be created in advance). After initialization, the following files are generated in the specified directory.
[gd@INTEL175 ~]$ cd /data/antdb/mgr1
[gd@INTEL175 mgr1]$ ll
total 112
drwx------ 5 gd gd 4096 Oct 17 17:28 base
drwx------ 2 gd gd 4096 Oct 17 17:28 global
drwx------ 2 gd gd 4096 Oct 17 17:28 pg_clog
drwx------ 2 gd gd 4096 Oct 17 17:28 pg_commit_ts
drwx------ 2 gd gd 4096 Oct 17 17:28 pg_dynshmem
-rw------- 1 gd gd 4450 Oct 17 17:28 pg_hba.conf
-rw------- 1 gd gd 1636 Oct 17 17:28 pg_ident.conf
drwx------ 4 gd gd 4096 Oct 17 17:28 pg_logical
drwx------ 4 gd gd 4096 Oct 17 17:28 pg_multixact
drwx------ 2 gd gd 4096 Oct 17 17:28 pg_notify
drwx------ 2 gd gd 4096 Oct 17 17:28 pg_replslot
drwx------ 2 gd gd 4096 Oct 17 17:28 pg_serial
drwx------ 2 gd gd 4096 Oct 17 17:28 pg_snapshots
drwx------ 2 gd gd 4096 Oct 17 17:28 pg_stat
drwx------ 2 gd gd 4096 Oct 17 17:28 pg_stat_tmp
drwx------ 2 gd gd 4096 Oct 17 17:28 pg_subtrans
drwx------ 2 gd gd 4096 Oct 17 17:28 pg_tblspc
drwx------ 2 gd gd 4096 Oct 17 17:28 pg_twophase
-rw------- 1 gd gd 4 Oct 17 17:28 PG_VERSION
drwx------ 3 gd gd 4096 Oct 17 17:28 pg_xlog
-rw------- 1 gd gd 88 Oct 17 17:28 postgresql.auto.conf
-rw------- 1 gd gd 22234 Oct 17 17:28 postgresql.conf
2. Modify the adbmgr configuration parameters.
a. Modify postgresql.conf.
cat >> ${mgrdata}/postgresql.conf << EOF
port = 6432
listen_addresses = '*'
log_directory = 'pg_log'
log_destination ='csvlog'
logging_collector = on
log_min_messages = error
max_wal_senders = 3
hot_standby = on
wal_level = replica
EOF
The default port for adbmgr is 6432, and the user can set an available port according to the planning.
b. Modify pg_hba.conf.
cat >> ${mgrdata}/pg_hba.conf << EOF
host replication all 10.0.0.0/8 trust
host all all 10.0.0.0/8 trust
EOF
The IP in hba needs to be modified according to the actual situation.
3. Start adbmgr; After adbmgr is initialized successfully, you can start it.
mgr_ctl start -D /data/antdb/mgr1
/data/antdb/mgr
To be consistent with the initialization path, both are the values of the variable mgrdata.
[gd@INTEL175 ~]$ mgr_ctl start -D /data/antdb/mgr
server starting
[gd@INTEL175 ~]$ LOG: database system was shut down at 2017-10-17 17:38:15 CST
LOG: MultiXact member wraparound protections are now enabled
LOG: database system is ready to accept connections
LOG: autovacuum launcher started
LOG: adb monitor launcher started
If adbmgr reports that the port is occupied during startup, the reason is that the current port number is already used by another process (adbmgr uses port 6432 by default). You need to change the value of the variable port in /data/antdb/mgr/postgresql.conf file so that it does not conflict with other processes. After starting, ps can view the processes of mgr as follows.
67456 ? S 0:00 /data/antdb/app/bin/adbmgrd -D mgr
67458 ? Ss 0:00 \_ adbmgr: checkpointer process
67459 ? Ss 0:00 \_ adbmgr: writer process
67460 ? Ss 0:00 \_ adbmgr: wal writer process
67461 ? Ss 0:00 \_ adbmgr: autovacuum launcher process
67462 ? Ss 0:00 \_ adbmgr: stats collector process
67463 ? Ss 0:00 \_ adbmgr: adb monitor launcher process
4. Configure standby adbmgr (optional); In a real production environment, adbmgr also needs to be highly available, so it is also necessary to configure a standby for adbmgr. The standby for adbmgr may not be added during the feature verification phase, and will be added later when high availability is verified. On the selected host where the adbmgr standby is deployed, use the antdb user to execute:
pg_basebackup -h 10.20.16.175 -p 6432 -U antdb -D /data/antdb/mgr --
nodename mgr -Xs -Fp -R
Where:
• -h adb05 in adb05 is the hostname of the adbmgr master, where the IP can also be used.
• -p 6432 for the port of the adbmgr master.
• -U antdb means use antdb user to connect to adbmgr master.
• -D specifies the data directory of the adbmgr slave on the execution host, ensuring that the permissions are correct.
• Other parameters remain the same; after execution is complete, start adbmgr slave.
mgr_ctl start -D /data/antdb/mgr_standby
The value of adbhome here should match the value of ADBHOME in .bashrc.