Zero-downtime database upgrade
Systems, devices, and methods are disclosed to create a second subcluster in a sandbox, wherein the second subcluster corresponds to a first subcluster that requires an upgrade. The first subcluster is currently in use by a client executing an application. A second subcluster is created in a sandbox, which mirrors the first sandbox. The second subcluster is upgraded and, when complete, the first subcluster is paused, and state information is obtained from the first subcluster and copied to the second subcluster. Once the state information is uploaded to the second subcluster, communications between the client and database are set to use the second subcluster. As a result, the client experiences only a minor delay rather than any unavailability of the accessed databases.
1 . A method, comprising:
creating a second subcluster in a sandbox, wherein the second subcluster corresponds to a first subcluster, and wherein the first subcluster comprises a connection to a client;
upgrading the second subcluster,
wherein upgrading the second subcluster comprises applying a schema to the second subcluster that is different from a schema of the first subcluster;
starting the second subcluster;
replicating first state values, associated with the first subcluster, to second state values, associated with the second subcluster; and
before replicating the first state values to the second state values, pausing the connection between the client and the first subcluster.
2 . The method of claim 1 , further comprising redirecting the connection with the client to the second subcluster.
3 . The method of claim 2 , further comprising, after the connection has been redirected to the second subcluster, closing a session with the first subcluster.
4 . The method of claim 1 , wherein upgrading the second subcluster comprises modifying at least one row of a table of the first subcluster.
5 . The method of claim 2 , further comprising, after redirecting the connection with the client to the second subcluster, terminating the first subcluster.
6 . The method of claim 1 , wherein the first subcluster and the second subcluster are each database subclusters.
7 . The method of claim 1 , wherein the first subcluster and the second subcluster are each a collection of nodes, each node comprising a network address and a Kubernetes node.
8 . A system, comprising:
a network interface to a network; and
at least one microprocessor, each of which are coupled to a computer memory having stored thereon instructions that, when read by any one or more of the at least one microprocessor, cause the at least one microprocessor to perform:
creating a second subcluster in a sandbox, wherein the second subcluster corresponds to a first subcluster, and wherein the first subcluster comprises a connection to a client;
upgrading the second subcluster,
wherein upgrading the second subcluster comprises applying a schema to the second subcluster that is different from a schema of the first subcluster;
starting the second subcluster;
replicating first state values, associated with the first subcluster, to second state values, associated with the second subcluster; and
before replicating the first state values to the second state values, pausing the connection between the client and the first subcluster.
9 . The system of claim 8 , wherein the instructions further cause the at least one microprocessor to perform redirecting the connection with the client to the second subcluster.
10 . The system of claim 9 , wherein the instructions further cause the at least one microprocessor to perform redirecting the connection with the client to the second subcluster, after the connection has been redirected to the second subcluster, and closing a session with the first subcluster.
11 . The system of claim 8 , wherein upgrading the second subcluster comprises modifying at least one row of a table of the second subcluster.
12 . The system of claim 8 , wherein the instructions further cause the at least one microprocessor to perform, after redirecting the connection with the client to the second subcluster, terminating the first subcluster.
13 . The system of claim 8 , wherein the first subcluster and the second subcluster are each database clusters.
14 . The system of claim 8 , wherein the first subcluster and the second subcluster are each a collection of nodes, each node comprising a network address and a Kubernetes node.
15 . A computer-readable memory comprising instructions that, when read by a microprocessor, cause the microprocessor to perform:
creating a second subcluster in a sandbox, wherein the second subcluster corresponds to a first subcluster, and wherein the first subcluster comprises a connection to a client;
upgrading the second subcluster,
wherein upgrading the second subcluster comprises applying a schema to the second subcluster that is different from a schema of the first subcluster;
starting the second subcluster;
replicating first state values, associated with the first subcluster, to second state values, associated with the second subcluster; and
before replicating the first state values to the second state values, pausing the connection between the client and the first subcluster.
16 . The computer-readable memory of claim 15 , further comprising instructions to cause the microprocessor to perform redirecting the connection with the client to the second subcluster.
17 . The computer-readable memory of claim 16 , further comprising instructions to cause the microprocessor to perform redirecting the connection with the client to the second subcluster, after the connection has been redirected to the second subcluster, and closing a session with the first subcluster.
18 . The computer-readable memory of claim 15 , wherein upgrading the second subcluster comprises modifying at least one row of a table of the first subcluster.
19 . The computer-readable memory of claim 15 , wherein the first subcluster and the second subcluster are each database subclusters.
20 . The computer-readable memory of claim 15 , wherein the first subcluster and the second subcluster are each a collection of nodes, each node comprising a network address and a Kubernetes node.