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

*: Support more role labels. #334

Merged
merged 2 commits into from
Dec 29, 2021

Conversation

runkecheng
Copy link
Collaborator

What type of PR is this?

/enhancement

Which issue(s) this PR fixes?

Fixes #330

What this PR does?

execute xenoncli raft disable in leader sample-mysql-2. then sample-mysql-2 become IDLE, Cluster re-electing.

xenoncli cluster status
+------------------------------------------+-------------------------------+--------+---------+--------------------------+---------------------+----------------+------------------------------------------+
|                    ID                    |             Raft              | Mysqld | Monitor |          Backup          |        Mysql        | IO/SQL_RUNNING |                 MyLeader                 |
+------------------------------------------+-------------------------------+--------+---------+--------------------------+---------------------+----------------+------------------------------------------+
| sample-mysql-2.sample-mysql.default:8801 | [ViewID:4 EpochID:2]@IDLE     | UNKNOW | OFF     | state:[NONE]␤            | [ALIVE] [READONLY]  | [true/true]    | sample-mysql-0.sample-mysql.default:8801 |
|                                          |                               |        |         | LastError:               |                     |                |                                          |
+------------------------------------------+-------------------------------+--------+---------+--------------------------+---------------------+----------------+------------------------------------------+
| sample-mysql-0.sample-mysql.default:8801 | [ViewID:4 EpochID:2]@LEADER   | UNKNOW | OFF     | state:[NONE]␤            | [ALIVE] [READWRITE] | [true/true]    | sample-mysql-0.sample-mysql.default:8801 |
|                                          |                               |        |         | LastError:               |                     |                |                                          |
+------------------------------------------+-------------------------------+--------+---------+--------------------------+---------------------+----------------+------------------------------------------+
| sample-mysql-1.sample-mysql.default:8801 | [ViewID:4 EpochID:2]@FOLLOWER | UNKNOW | OFF     | state:[NONE]␤            | [ALIVE] [READONLY]  | [true/true]    | sample-mysql-0.sample-mysql.default:8801 |
|                                          |                               |        |         | LastError:               |                     |                |                                          |
+------------------------------------------+-------------------------------+--------+---------+--------------------------+---------------------+----------------+------------------------------------------+

You can see that the role tag has been set to a corresponding role.

# all pods
kubectl get pod -o wide | grep sample
sample-mysql-0                         3/3     Running   0          40m     10.233.96.114   node2    <none>           <none>
sample-mysql-1                         3/3     Running   0          39m     10.233.90.108   node1    <none>           <none>
sample-mysql-2                         3/3     Running   0          37m     10.233.70.59    master   <none>           <none>
# leader
kubectl get -l role=LEADER pod
NAME             READY   STATUS    RESTARTS   AGE
sample-mysql-0   3/3     Running   0          30m
# follower
kubectl get -l role=FOLLOWER pod
NAME             READY   STATUS    RESTARTS   AGE
sample-mysql-1   3/3     Running   0          29m
# idle (disable raft)
kubectl get -l role=IDLE pod
NAME             READY   STATUS    RESTARTS   AGE
sample-mysql-2   3/3     Running   0          28m
kubectl describe svc sample-mysql
Name:              sample-mysql
...
Port:              mysql  3306/TCP
TargetPort:        3306/TCP
Endpoints:         10.233.70.59:3306,10.233.90.108:3306,10.233.96.114:3306
...

kubectl describe svc sample-follower
Name:              sample-follower
...
Port:              mysql  3306/TCP
TargetPort:        3306/TCP
Endpoints:         10.233.90.108:3306
...

kubectl describe svc sample-leader
Name:              sample-leader
...
Port:              mysql  3306/TCP
TargetPort:        3306/TCP
Endpoints:         10.233.96.114:3306
...

Special notes for your reviewer?

@runkecheng runkecheng added the enhancement New feature or request label Dec 13, 2021
@runkecheng runkecheng added this to the v2.1.2 milestone Dec 13, 2021
@runkecheng runkecheng self-assigned this Dec 13, 2021
@runkecheng runkecheng force-pushed the support_more_role_labels branch from a3e7f64 to f168e76 Compare December 13, 2021 06:05
@acekingke
Copy link
Contributor

LGTM

@runkecheng runkecheng force-pushed the support_more_role_labels branch from f168e76 to ddd5ac0 Compare December 27, 2021 07:40
@runkecheng runkecheng force-pushed the support_more_role_labels branch from ddd5ac0 to 7ab7fbb Compare December 27, 2021 07:43
Copy link
Contributor

@andyli029 andyli029 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@andyli029 andyli029 merged commit 248c18a into radondb:main Dec 29, 2021
zhl003 pushed a commit to zhl003/radondb-mysql-kubernetes that referenced this pull request Aug 17, 2022
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
Development

Successfully merging this pull request may close these issues.

[bug] Pod Label do not support INVALID/IDLE/LEARNER/STOPPED/UNKNOW
3 participants