Greenplum experiment to dynamically add nodes

Source: Internet
Author: User
Tags psql

Greenplum experiment to dynamically add nodes

1. I initialized a greenplum cluster on the hadoop4-hadoop6.

2. All primary and mirror are started. I connect to the master and insert records in the two tables:

Aligputf8 = # insert into pg_catalog.pg_filespace_entry values (3052,15, '/home/gpadmin1/cxf/gpdata/gpdb_p1/gp6 ');

Insert 0 1

Aligputf8 = # insert into pg_catalog.pg_filespace_entry values (3052,16, '/home/gpadmin1/cxf/mgpdata/gpdb_p1/gp6 ');

Insert 0 1

 

Aligputf8 = # insert into gp_segment_configuration values (40000, 'P', 'P', 's', 'U', 41000, 'hadoop3', 'hadoop3, null );

Insert 0 1

Aligputf8 = # insert into gp_segment_configuration values (50000, 'M', 'M', 's', 'U', 51000, 'hadoop3', 'hadoop3, null );

Insert 0 1

I have created a new node on hadoop3. both primary and mirror are on hadoop3.

Directory:/home/gpadmin1/cxf/gpdata/gpdb_p1/GP6 and/home/gpadmin1/cxf/mgpdata/gpdb_p1/GP6

3. SCP the data folder of the 40000primary node on hadoop4 and the 50000mirror node on hadoop5 to hadoop3.

[Gpadmin1 @ hadoop4 cxf] $ SCP-r gpdata hadoop3:/home/gpadmin1/cxf

[Gpadmin1 @ hadoop5 cxf] $ SCP-r mgpdata hadoop3:/home/gpadmin1/cxf

Rename the folder on hadoop3. Make the folder name consistent with the configuration table just inserted

4. Start the primary and mirror nodes.

$ Gphome/bin/pg_ctl-D/home/gpadmin1/cxf/gpdata/gpdb_p1/GP6-L/home/gpadmin1/cxf/gpdata/gpdb_p1/GP6/pg_log/startup. log-o '-I-P 40000 -- silent-mode = true-M quiescent-B 15-C 6-Z 7' start

$ Gphome/bin/pg_ctl-D/home/gpadmin1/cxf/mgpdata/gpdb_p1/GP6-L/home/gpadmin1/cxf/mgpdata/gpdb_p1/GP6/pg_log/startup. log-o '-I-P 50000 -- silent-mode = true-M quiescent-B 16-C 6-Z 7' start

5. Run the gp_primarymirror command to set the primary and secondary nodes of the new ipvs (run mirror and then run primary)

Because it was just SCP from hadoop4 and hadoop5, You need to modify it:

/Home/gpadmin1/cxf/gpdata/gpdb_p1/GP6/gp_pmtransition_args

/Home/gpadmin1/cxf/mgpdata/gpdb_p1/GP6/gp_pmtransition_args

The two parameter files used by gp_primarymirror

[Gpadmin1 @ hadoop3 gpdb_p1] $ CAT/home/gpadmin1/cxf/mgpdata/gpdb_p1/GP6/gp_pmtransition_args

Mirror

S

Hadoop5

51000

Hadoop4

41000

40000

[Gpadmin1 @ hadoop3 gpdb_p1] $ VI/home/gpadmin1/cxf/mgpdata/gpdb_p1/GP6/gp_pmtransition_args

Mirror

S

Hadoop3

51000

Hadoop3

41000

40000

Modify another file and run the gp_primarymirror command.

$ Gphome/bin/gp_primarymirror-H 127.0.0.1-P 50000-I/home/gpadmin1/cxf/mgpdata/gpdb_p1/GP6/gp_pmtransition_args &

$ Gphome/bin/gp_primarymirror-H 127.0.0.1-P 40000-I/home/gpadmin1/cxf/gpdata/gpdb_p1/GP6/gp_pmtransition_args &

Try Psql connection to see if the node is normal

[Gpadmin1 @ hadoop3 gpdb_p1] $ pgoptions = "-C gp_session_role = utility" Psql-P 40000

Psql (8.2.14)

Type "help" for help.

 

Aligputf8 = #

Normal connection, node initialization successful

 

6. Start the master node on hadoop4: Modify two parameters and change "-x 14" to "-x 16" and "-Z 6" to "-Z 7"

$ Gphome/bin/pg_ctl-w-D/home/gpadmin1/cxf/gpdb_p1/GP-1-L/home/gpadmin1/cxf/gpdb_p1/GP-1/pg_log/startup. log-o "-E-I-m master-P 5432-B 1-x 16-C-1-Z 7 -- silent-mode = true" Start

Start successfully. Next, try to insert a record directly to primary on hadoop3.

[Gpadmin1 @ hadoop3 gpdb_p1] $ pgoptions = "-C gp_session_role = utility" Psql-P 40000

Psql (8.2.14)

Type "help" for help.

 

Aligputf8 = # insert into cxf values ('scutshuxu', 7 );

Insert 0 1

Aligputf8 = #

Next, connect to the master node on hadoop4 and query the record just inserted,

PS: cxf is a previously created table. aligputf8 = # create table cxf (A varchar (100), B INT) distributed randomly;

[Gpadmin1 @ hadoop4 cxf] $ Psql

Psql (8.2.14)

Type "help" for help.

 

Aligputf8 = # select * From cxf;

A | B

------------ + ---

Feng | 3

Wang | 5

Scutshuxue | 7

Xiao | 2

Chen | 1

(5 rows)

You can find the record you just inserted and add the node successfully.

7. Use gpstop to disable greenplum.

Run the gpstart command to start greenplum. nodes on hadoop3 can be started successfully and added successfully.

 

 

 

Delete nodes dynamically:

Aligputf8 = # Delete from gp_segment_configuration where dbid in (16, 15 );

Delete 2

Aligputf8 = # Delete from pg_filespace_entry where fsedbid in (15, 16 );

Delete 2

If you do not restart the master, an error is returned.

[Gpadmin1 @ hadoop4 cxf] $ Psql

Psql (8.2.14)

Type "help" for help.

 

Aligputf8 = # select * From cxf;

Error: greenplum Database Number of segments inconsistency: Count is 7 from pg_catalog.gp_id table, but 6 from getcdbcomponentdatabases ()

Aligputf8 = #

 

Restart the master.

[Gpadmin1 @ hadoop4 cxf] $ gpstop-m

[Gpadmin1 @ hadoop4 cxf] $ gphome/bin/pg_ctl-w-D/home/gpadmin1/cxf/gpdb_p1/GP-1-L/home/gpadmin1/cxf/gpdb_p1/GP-1/ pg_log/startup. log-o "-E-I-m master-P 5432-B 1-x 14-C-1-Z 6 -- silent-mode = true" Start

[Gpadmin1 @ hadoop4 cxf] $ Psql

Notice: Master synchronization ing synchronizing

Psql (8.2.14)

Type "help" for help.

 

Aligputf8 = # select * From cxf;

A | B

------ + ---

Chen | 1

Xiao | 2

(2 rows)

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.