Streaming database cloning using cluster live mounts
A database can be instantly cloned from a source device to a target device by a cluster mapped to a database to be cloned. Nodes of the cluster are mapped over channels to directories of the database. Scripts are generated from one or more templates that specify the order and values to be executed to perform a database job, such as cloning the database to the target device using the mappings. To clone the database, a template can be executed that generates and populates scripts, which can be executed on the target device to provide a functioning cloned database using the mapped cluster.
1. A method comprising:
identifying a database on a source host;
storing, in file nodes of a remote cluster, directories of the database, each of the file nodes mapped to a directory of the database;
receiving an instruction to clone the database to a target host;
storing, in a script node of the remote cluster, a plurality of scripts for execution on the target host to clone the database to the target host;
processing, by a remote agent on the target host, the plurality of scripts to clone the database to the target host using the directories mapped to the file nodes; and
processing one or more requests received by the target host using the target host as mapped to the file nodes of the remote cluster.
2. The method of claim 1 , further comprising:
generating a preconfigured template comprising a plurality of placeholder values of configuration parameters of the database, the preconfigured template specifying an order of execution of the plurality of scripts; and
executing the preconfigured template to generate the plurality of scripts on the target host.
3. The method of claim 2 , wherein the script node comprises a script repository and the plurality of scripts are a subset of scripts available in the script repository, which scripts to include from the script repository in the plurality of scripts being specified by the preconfigured template.
4. The method of claim 2 , further comprising:
retrieving the configuration parameters and replacing the plurality of placeholder values to generate the plurality of scripts, the plurality of scripts being in a format that is natively executable on the target host.
5. The method of claim 1 , wherein the file nodes are mapped to the directory of the database using Network File System (NFS) mounting.
6. The method of claim 1 , wherein the one or more requests are received from end-users of a network service that interfaces with the database.
7. The method of claim 1 , wherein the remote cluster is a non-SQL database cluster.
8. The method of claim 1 , further comprising:
causing display of a user interface comprising a user interface element for specifying a target host device as the target host.
9. The method of claim 8 , further comprising:
receiving, from the user interface element, specification of the target host device; and
setting a target host value in the plurality of scripts based at least in part on the specification of the target host device.
10. The method of claim 1 , wherein the target host is a target host device that is automatically selected from one or more available target host devices.
11. The method of claim 10 , further comprising:
installing a test application on the database of the target host; and
storing error data generated by the test application operating on the target host.
12. The method of claim 1 , wherein the remote agent on the target host accesses the plurality of scripts on the script node through an NFS mount, and the plurality of scripts are executed by the remote agent on the target host.
13. The method of claim 1 , wherein the plurality of scripts are executable code portions in a script data file.
14. A system comprising:
one or more processors of a machine; and
a memory storing instructions that, when executed by the one or more processors, cause the machine to perform operations comprising:
identifying a database on a source host;
storing, in file nodes of a remote cluster, directories of the database, each of the file nodes mapped to a directory of the database;
receiving an instruction to clone the database to a target host;
storing, in a script node of the remote cluster, a plurality of scripts for execution on the target host to clone the database to the target host;
processing, by a remote agent on the target host, the plurality of scripts to clone the database to the target host using the directories mapped to the file nodes; and
processing one or more requests received by the target host using the target host as mapped to the file nodes of the remote cluster.
15. The system of claim 14 , the operations further comprising:
generating a preconfigured template comprising a plurality of placeholder values of configuration parameters of the database, the preconfigured template specifying an order of execution of the plurality of scripts; and
executing the preconfigured template to generate the plurality of scripts on the target host.
16. The system of claim 15 , wherein the script node comprises a script repository and the plurality of scripts are a subset of scripts available in the script repository, which scripts to include from the script repository in the plurality of scripts being specified by the preconfigured template.
17. The system of claim 15 , the operations further comprising:
retrieving the configuration parameters and replacing the plurality of placeholder values to generate the plurality of scripts, the plurality of scripts being in a format that is natively executable on the target host.
18. The system of claim 14 , wherein the file nodes are mapped to the directory of the database using Network File System (NFS) mounting.
19. A machine-readable storage medium embodying instructions that, when executed by a machine, cause the machine to perform operations comprising:
identifying a database on a source host;
storing, in file nodes of a remote cluster, directories of the database, each of the file nodes mapped to a directory of the database;
receiving an instruction to clone the database to a target host;
storing, in a script node of the remote cluster, a plurality of scripts for execution on the target host to clone the database to the target host;
processing, by a remote agent on the target host, the plurality of scripts to clone the database to the target host using the directories mapped to the file nodes; and
processing one or more requests received by the target host using the target host as mapped to the file nodes of the remote cluster.
20. The method of claim 1 , wherein identifying the database on the target host comprises:
identifying that the directories of the database are mounted to the source host and files of the database are stored in the file nodes of the remote cluster and accessible via the source host, wherein after processing the plurality of scripts stored in the script node of the remote cluster, the directories of the database are mounted to the target host such that the files stored in the file nodes of the remote cluster are accessible via the target host.