Bug #115095 Make MySQL shell be able to "clone" a server (including setting up replication)
Submitted: 23 May 2024 8:58 Modified: 23 May 2024 9:03
Reporter: Simon Mudd (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:Shell Dump & Load Severity:S4 (Feature request)
Version:8.4 OS:Any
Assigned to: CPU Architecture:Any

[23 May 2024 8:58] Simon Mudd
Description:
MySQL shell has quite a few options to dump, load and also copy an instance from one place to another.  However, as far as I know it doesn't have a single command equivalent to native cloning to clone the local server from a remote server, including setting up replication.  If this is possible it's not clearly documented.

What would be good is a simple command requiring as few settings as possible which allows the shell to connect to the local server, prepare it for native cloning and then kicks off the native cloning from that server.

There may be situations where this does not work such as cross-architecture, see https://bugs.mysql.com/115094, and here it would be good if the shell can reset the local instance as much as needed and then copy over the files from the remote server (without needing to dump them first locally) after which it would setup replication, using provided replication credentials.

There may also be other environments where you want to clone an instance where you do not have full access to the destination server. Here native cloning won't be allowed but the shell could handle the differences and clone as much of the source instance as possible to make replication work.

Cloud environments typically have more restricted access so this would be a good way to provide a similar cloning functionality to that provided by native cloning.

How to repeat:
Check documentation and see there are many shell settings for dumping and loading an instance but there's no clear description of how to setup a new "replica" from another "source server".

Suggested fix:
Improve the shell copy instance documentation to provide more sample commands of how to copy an instance from one place to another, under different scenarios.

Provide new functionality for "cloning" from another server, including the option to setup replication from the server that was being cloned from.
- this could be done natively if native cloning allows this
- this could be done by copying the instance data using existing methods when this is not possible at the moment, such as cross architecture.
- optionally setup replication using provided credentials
- optionally setup replication providing credentials which would be added to the source server (and clarify which permissions would be needed to do this).
[23 May 2024 9:03] MySQL Verification Team
Hello Simon,

Thank you for the feature request!

regards,
Umesh