Details
-
New Feature
-
Status: Done
-
High
-
Resolution: Done
-
None
-
3
-
Yes
-
Yes
Description
The problem: There are several reasons why a customer may want to restart a database server instance. For example, they are seeing issues with an instance and want to restart the database instance to see if that will help resolve their issue.
User Story: As an Admin, I want to be able to log into the Percona Enterprise Platform, select the existing database cluster, and execute restart action
After this Percona Enterprise Platform should restart the selected database cluster member instances. Because of Technical limitation, this must be a rolling restart for all DB instances
The status of the DB cluster should be telling the "restarting" when the action executed.
UI:
An additional action in DB Cluster menu = "Restart"
Suggested implementation:
- Define restart endpoint in pmm API to communicate UI -> pmm-managed.
- Define restart endpoint in dbaas-api to communicate pmm-managed -> dbaas-controller.
- Implement endpoint to receive type (PXC Cluster or PSMDB Cluster) and name of DBaaS in pmm-managed from UI.
- Implement endpoint in dbaas-controller to restart DB Cluster where execute
- pmm-managed calls dbaas-contoller to restart DB cluster.
kubectl rollout restart StatefulSets <PXC-name>-pxc kubectl rollout restart StatefulSets <PXC-name>-proxysql kubectl rollout restart StatefulSets <PSMDB-name>-rs0
How to test/demonstrate:
(For API test please use attached swagger.json )
docker cp api/swagger/swagger.json pmm-managed-server:/usr/share/pmm-server/swagger/
1. Create a DB cluster;
2. Wait for the cluster to be active;
3. Create table/collection in the cluster:
als@mbp pmm-managed % kubectl run -i --rm --tty percona-client --image=percona:8.0 --restart=Never -- bash -il If you don't see a command prompt, try pressing enter. bash-4.2$ mysql -h mypxc-proxysql -uroot -proot_password mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 304 Server version: 8.0.18 (ProxySQL)Copyright (c) 2009-2020 Percona LLC and/or its affiliates Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | +--------------------+ 4 rows in set (0.06 sec)mysql> create database mydb; Query OK, 1 row affected (0.02 sec)mysql> use mydb; Database changedmysql> create table mytbl (id int primary key); Query OK, 0 rows affected (0.05 sec)mysql> insert into mytbl values (1), (2); Query OK, 2 rows affected (0.01 sec) Records: 2 Duplicates: 0 Warnings: 0mysql> select * from mytbl; +----+ | id | +----+ | 1 | | 2 | +----+ 2 rows in set (0.00 sec) mysql> \s -------------- mysql Ver 8.0.20-11 for Linux on x86_64 (Percona Server (GPL), Release 11, Revision 5b5a5d2)Connection id: 304 Current database: mydb Current user: [email protected].default.svc.cluster.local SSL: Not in use Current pager: stdout Using outfile: '' Using delimiter: ; Server version: 8.0.18 (ProxySQL) Protocol version: 10 Connection: mypxc-proxysql via TCP/IP Server characterset: utf8mb4 Db characterset: utf8mb4 Client characterset: latin1 Conn. characterset: latin1 TCP port: 3306 Binary data as: Hexadecimal Uptime: 13 min 59 secThreads: 1 Questions: 19 Slow queries: 0 --------------
remember Uptime value Uptime: 13 min 59
3. Select restart action in the cluster;
4. Check that the cluster gets the status "Pending";
5. Wait for the cluster to be active again.
6. Check that inserted data is present and uptime value decreased Uptime: 5 min 16.
mysql> \s ERROR 2013 (HY000): Lost connection to MySQL server during query mysql> \s ERROR 2006 (HY000): MySQL server has gone away No connection. Trying to reconnect... Connection id: 263 Current database: mydb -------------- mysql Ver 8.0.20-11 for Linux on x86_64 (Percona Server (GPL), Release 11, Revision 5b5a5d2)Connection id: 263 Current database: mydb Current user: [email protected].default.svc.cluster.local SSL: Not in use Current pager: stdout Using outfile: '' Using delimiter: ; Server version: 8.0.18 (ProxySQL) Protocol version: 10 Connection: mypxc-proxysql via TCP/IP Server characterset: utf8mb4 Db characterset: utf8mb4 Client characterset: latin1 Conn. characterset: latin1 TCP port: 3306 Binary data as: Hexadecimal Uptime: 5 min 16 secThreads: 1 Questions: 5 Slow queries: 0 -------------- mysql> select * from mytbl; +----+ | id | +----+ | 1 | | 2 | +----+ 2 rows in set (0.00 sec)