Online Operations sequoiadb Cluster reduction

Source: Internet
Author: User

Before my company on the line a new application, the bottom of the database using a domestic named SEQUOIADB NoSQL database as storage. In the original plan, the SEQUOIADB cluster was composed of 6 PC servers, each of which deployed coordination nodes and CM cluster management nodes.

The SDB1, SDB2 and sdb3 machines together form the catalogue node group Syscataloggroup and the Data node group Datagroup1.

The SDB4, SDB5, and sdb6 machines form a different group of data nodes datagroup2.

The following illustrations are specifically deployed:


But recently due to some internal reasons, 6 servers of which two are recycled, so the database needs to implement scale reduction operations. Since the previous project has been online, there is no way to stop the business, to the cluster to perform database reduction operations, considering a long time, finally found a way to reduce the online.

The idea is this:

Since SEQUOIADB's logical data set has a feature that allows you to specify up to 7 data nodes to form a logical data group, consider that we now have only 3 data nodes on the line, and we can take advantage of this feature to synchronize data to other machines for the data group to migrate. Then remove the data nodes that need to be removed from the original data set, so that we can ensure that the business is not interrupted, the purpose of the cluster reduction achieved.

The approximate method is shown below:


After downsizing, the catalog node groups and data node groups that have been deployed on the SDB1, SDB2, and sdb3 three machines are datagroup1 unchanged, while the SDB4, DB5, and SDB6 data node groups deployed by the three machines are migrated to Datagroup2, SDB2 and SDB3 machines, to maintain the original database structure, reduce the size of the machine.

Because the current application chooses the coordination node of the connection as SDB4, the coordination node on the SDB4 machine and the CM Cluster management node are reserved temporarily.

After the cluster reduction is complete, the deployment becomes the following:

Operation Command

Connection Coordination Node

sdb> db = new SDB ("SDB4", 11810);

Get objects for the DATAGROUP2 group

sdb> var rg =db.getrg ("datagroup2");

When extending to the DATAGROUP2 Data group, first determine whether the 11830 ports of the SDB1, SDB2, and sdb3 machines are occupied, and whether the SDBCM process has write permission to the/var/sequoiadb/data path.

$> Netstat-nap | grep 11830;

$> ls-l/var/sequoiadb/|grep data;

Extending data nodes for datagroup2 groups

sdb> var node =rg.createnode ("Sdb1", 11830, "/var/sequoiadb/data/11830");

Start new Data node

Sdb> Node.start ();

Extending data nodes for datagroup2 groups

sdb> node =rg.createnode ("Sdb2", 11830, "/var/sequoiadb/data/11830");

Start new Data node

Sdb> Node.start ();

Extending data nodes for datagroup2 groups

sdb> node =rg.createnode ("Sdb3", 11830, "/var/sequoiadb/data/11830");

Start new Data node

Sdb> Node.start ();

Print the current database topology, check that the DATAGROUP2 group is correctly adding sdb1:11830, sdb2:11830, sdb3:11830 three data nodes, check which machine the primary data node of the DATAGROUP2 group is deployed on (see Groupname= " Datagroup2 "Primarynode" field)

Sdb> db.listreplicagroups ();

Connect the primary Data node of the DATAGROUP2 group, assuming that the DATAGROUP2 group's old primary data node is the 11820 process of the SDB5 machine

sdb> datadbm = new SDB ("SDB5", 11820);

View and record the LSN number of the primary data node for the DATAGROUP2 group

sdb> var masterlsn = {};

sdb> Masterlsn.offset = Datadbm.snapshot (Sdb_snap_system). Next (). Toobj () ["Currentlsn"] ["offset"];

Sdb> masterlsn.version =datadbm.snapshot (Sdb_snap_system). Next (). Toobj () ["Currentlsn"] ["version"];

Connecting the new data nodes of the DATAGROUP2 group separately

sdb> datadb1 = Newsdb ("sdb1", 11830);

sdb> datadb2 = Newsdb ("Sdb2", 11830);

sdb> datadb3 = Newsdb ("sdb3", 11830);

View the new data node LSN number for the datagroup2 group, respectively

sdb> var d1lsn = {};

Sdb> d1lsn.offset =datadb1.snapshot (Sdb_snap_system). Next (). Toobj () ["Currentlsn"] ["offset"];

Sdb> d1lsn.version =datadb1.snapshot (Sdb_snap_system). Next (). Toobj () ["Currentlsn"] ["version"];

sdb> var d2lsn = {};

Sdb> d2lsn.offset =datadb2.snapshot (Sdb_snap_system). Next (). Toobj () ["Currentlsn"] ["offset"];

Sdb> d2lsn.version =datadb2.snapshot (Sdb_snap_system). Next (). Toobj () ["Currentlsn"] ["version"];

sdb> var d3lsn = {};

Sdb> d3lsn.offset =datadb3.snapshot (Sdb_snap_system). Next (). Toobj () ["Currentlsn"] ["offset"];

Sdb> d3lsn.version =datadb3.snapshot (Sdb_snap_system). Next (). Toobj () ["Currentlsn"] ["version"];

Wait for the DATAGROUP2 group's new data node LSN number to stop growing and the same as the LSN number of the DATAGROUP2 group master data node.

After the LSN number of the new data node is consistent with the LSN number of the main data node, the connection of the coordination node is used to view the data reading and writing of the whole database for several consecutive times, and if the data read and write operation index is still unchanged, the new data node has completed the log synchronization.

Sdb> Db.snapshot (6);

Sdb> Db.snapshot (6);

Sdb> Db.snapshot (6);

Remove the old primary data node of the DATAGROUP2 group, assuming that the DATAGROUP2 group's old primary data node is the 11820 process of the SDB5 machine

Sdb> Rg.removenode ("SDB5", 11820);

Check the selection of the DATAGROUP2 group to determine the DATAGROUP2 Group selection Master Success (view the Primarynode field groupname= "Datagroup2")

Sdb> db.listreplicagroups ();

According to Primarynode's Nodeid, we can know primarynode hostname, assuming the 11830 process of the SDB3 machine, we connect directly to the 11830 process of the SDB3 machine, Check that it is actually selected as the primary data node for the DATAGROUP2 group (see "Isprimary" field is "True").

sdb> var datadbm = newsdb ("sdb3", 11830);

Sdb> Datadbm.snapshot (7);

After you determine the DATAGROUP2 group, remove the other two data nodes

Sdb> Rg.removenode ("SDB4", 11820);

Sdb> Rg.removenode ("Sdb6", 11820);

In this way, we have completed the reduction of the database operation.


Hope to be able to use in a similar situation when you give a certain reference role.

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.