Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Greenplum-data migration (exponentially increased computing power)

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Preface

GPDB data can be migrated through full recovery. If there are 3 machines with 2 Primary and 2 Mirror on each machine, then you can expand 3 machines to one Primary,1 Mirror on each machine. In the process of migration, you need to ensure:

The original machine can use Primary+Mirror to form a completed original cluster DB, which can be started normally, so that the data can be fully recovered and the data can be restored to the extended machine.

As shown in the figure below, if you migrate the P1/P2/P3/M0/M2/M3 of the original machine to the new machine, the original machine still retains P0/P2/P4/M1/M2/M3 and can start the entire database.

1. new machine preparation: 1.1. start setting some parameters of the new machine, which are the same as the previous installation of GPDB, including the new gpadmin group, gpadmin users, and turn off the new machine firewall.

[root@gpsegment2 ~] # systemctl stop firewalld.service

[root@gpsegment2 ~] # systemctl disable firewalld.service

1.2. modify the hosts files of all machines and establish ssh mutual trust-free password login at the same time

[gpadmin@gpsegment2 ~] $vim / etc/hosts # modify hosts file

192.168.56.103 gpmaster

192.168.56.101 gpsegment3

192.168.56.104 gpsegment1

192.168.56.105 gpsegment2

192.168.56.102 gpsegment4

192.168.56.106 gpsegment5

192.168.56.107 gpsegment6

[gpadmin@gpmaster conf] $gpssh-exkeys-f hostlist # add the new machine domain name to the hostlist file and run it to establish ssh mutual trust

1.3.Create the GPDB installation directory / opt/greenplum on all new machines (this directory needs to be consistent with other old machines, while giving folder ownership to gpadmin users)

1.4. as with the previous installation of GPDB, compress and copy the / opt/greenplum/greenplum-db-4.3.17.0 installation package on the master machine to the new machine, decompress it, and establish a soft connection after decompression

[gpadmin@localhost greenplum] $ln-s greenplum-db-4.3.17.0/ greenplum-db

Start migrating data

The purpose of the migration setting is to set the original machine to Primary and asynchronous data temporarily by combining half of the Primary+Mirror, and then set the state of the other half of the Primary+Mirror to be migrated to downtime, both to Mirror and to synchronized data. In this way, the database is started first, and the database check finds that half of the Mirror nodes are down, so it is ignored, and then the other nodes are started first. At this time, the database can still be used. We use the recovery tool that comes with GPDB to let him automatically restore all the down Mirror, so that the data migration can be completed.

2.1.Boot GPDB in host mode only

[gpadmin@gpmaster] $gpstart-m

[gpadmin@gpmaster ~] $PGOPTIONS='-c gp_session_role=utility' psql # utility mode enters interaction

Testdb=# set allow_system_table_mods='dml' # is set to allow modification of the system configuration table

2.2.Modification gp_segment_configuration modifies the DB hostname/address to be migrated to the corresponding target machine, and sets status to d state and role role to m

2.3.Modification gp_segment_configuration to set the DB role role that does not need to be migrated to pMagazine mode to cMagazine status to u

Shut down the database, gpstop, and restart the data gpstart-a

Six machines could not be started and were ignored, but six machines were started normally, so they can be used.

[gpadmin@gpmaster] $gpstart-a

2.5. you can view the Mirror status through gpstate-m

Three Mirror are Fail, and the other three are started as hosts

2.6. Perform full recovery of the database

[gpadmin@gpmaster] $gprecoverseg-F

You can see that the database has started the recovery.

Open another window and run gpstate-m to check the recovery progress

You need to wait until all the nodes return to Synchronized state.

After all the new machines are fully synchronized, because the new machines are set to Mirror, some of the Mirror of the old machines are used for Primary, so you need to run gprecoverseg-r to get Mirror and Primary back to normal.

[gpadmin@gpmaster] $gprecoverseg-r

2.8. Finally, run it to check that all the machine nodes are working.

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.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report