w3resource

Adding a New Node to Group Replication


Add New Member to Group Replication

Write MySQL commands to add a new server to an existing Group Replication.

Solution:

-- On the new server:
INSTALL PLUGIN group_replication SONAME 'group_replication.so';

-- Create replication user if not already done:
CREATE USER 'gr_user'@'%' IDENTIFIED BY 'password';
GRANT REPLICATION SLAVE ON *.* TO 'gr_user'@'%';

-- Configure and start group replication:
SET GLOBAL group_replication_group_name="your_group_name";
SET GLOBAL group_replication_local_address= "ip_address:port";
SET GLOBAL group_replication_group_seeds= "ip1:port,ip2:port";
START GROUP_REPLICATION;

Explanation:

  • Purpose of the Query:
    • Integrates a new member into an existing Group Replication setup.
  • Key Components:
    • Plugin installation, user setup, and configuration of group details.
  • Real-World Application:
    • Scaling up replication for increased performance or redundancy.

Notes:

  • Ensure the new server has the same data state or use state transfer methods.

For more Practice: Solve these Related Problems:

  • Write SQL commands to add a new server to Group Replication with state transfer from a specific member.
  • Write SQL to integrate a new node into Group Replication with custom flow control settings.


Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous MySQL Exercise: Change Primary in Group Replication.
Next MySQL Exercise: Remove Member from Group Replication.

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.



Follow us on Facebook and Twitter for latest update.