Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*: health check enhancement #743

Merged
merged 1 commit into from
Dec 26, 2022
Merged

Conversation

zhl003
Copy link
Collaborator

@zhl003 zhl003 commented Nov 28, 2022

What type of PR is this?

/enhancement

Which issue(s) this PR fixes?

Fixes #739

What this PR does?

Summary:

  1. Add a parameter to control the delay from the replica to primary, If the current latency exceeds the expected value ,the pod while be not ready

  2. move all mysql pod health check and other checks to mysqlchecker in mysql container

Special notes for your reviewer?

how to verify

  1. Use chaos to inject a disk delay error to create master-slave delay
kind: IOChaos
apiVersion: chaos-mesh.org/v1alpha1
metadata:
  namespace: default
  name: disk-latency
  annotations:
    experiment.chaos-mesh.org/pause: 'false'
spec:
  selector:
    namespaces:
      - default
    labelSelectors:
      app.kubernetes.io/instance: sample
    pods:
      default:
        - sample-mysql-1
  mode: all
  action: latency
  delay: 3000ms
  path: /var/lib/mysql
  percent: 100
  volumePath: /var/lib/mysql
  1. sysbench load alarge amount data to cluster ,observe the lagency ,and the pod state
 kubectl exec -it sample-mysql-0 -c xenon -- xenoncli cluster mysql
+------------------------------------------+----------+-------+-----------+------------------------------+----------------+----------------+------------+
|                    ID                    |   Raft   | Mysql |  Option   |     Master_Log_File/Pos      | IO/SQL_Running | Seconds_Behind | Last_Error |
+------------------------------------------+----------+-------+-----------+------------------------------+----------------+----------------+------------+
| sample-mysql-0.sample-mysql.default:8801 | LEADER   | ALIVE | READWRITE | [mysql-bin.000005/406456643] | [true/true]    |              0 |            |
+------------------------------------------+----------+-------+-----------+------------------------------+----------------+----------------+------------+
| sample-mysql-1.sample-mysql.default:8801 | FOLLOWER | ALIVE | READONLY  | [mysql-bin.000005/406456643] | [true/true]    |             50 |            |
+------------------------------------------+----------+-------+-----------+------------------------------+----------------+----------------+------------+
| sample-mysql-2.sample-mysql.default:8801 | FOLLOWER | ALIVE | READONLY  | [mysql-bin.000005/406456643] | [true/true]    |              0 |            |
+------------------------------------------+----------+-------+-----------+------------------------------+----------------+----------------+------------+

kubectl get po -Lrole,healthy -l app.kubernetes.io/instance=sample
NAME             READY   STATUS    RESTARTS        AGE     ROLE       HEALTHY
sample-mysql-0   3/3     Running   0               2d23h   LEADER     yes
sample-mysql-2   3/3     Running   0               2d23h   FOLLOWER   yes
sample-mysql-1   2/3     Running   1 (2m38s ago)   2d23h   FOLLOWER   no

kubectl describe  po sample-mysql-1
time="2022-11-28T14:43:17+08:00" level=fatal msg="readiness failed: slave is too far behind master"
  Warning  Unhealthy  2m47s (x55 over 2d21h)  kubelet  (combined from similar events): Readiness probe failed: time="2022-11-28T14:45:17+08:00" level=info msg="output=[{\"state\":\"FOLLOWER\",\"leader\":\"sample-mysql-0.sample-mysql.default:8801\",\"nodes\":[\"sample-mysql-0.sample-mysql.default:8801\",\"sample-mysql-1.sample-mysql.default:8801\",\"sample-mysql-2.sample-mysql.default:8801\"]}]"
time="2022-11-28T14:45:17+08:00" level=info msg="stderr=[]"
time="2022-11-28T14:45:17+08:00" level=fatal msg="readiness failed: slave is too far behind master

@zhl003 zhl003 added the enhancement New feature or request label Nov 28, 2022
@zhl003 zhl003 added this to the v3.0.0 milestone Nov 28, 2022
@zhl003 zhl003 self-assigned this Nov 28, 2022
@zhl003 zhl003 merged commit 2396497 into radondb:main Dec 26, 2022
@acekingke
Copy link
Contributor

need rebuild the mysql image

acekingke pushed a commit to acekingke/radondb-mysql-kubernetes that referenced this pull request May 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants