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

[check-redis] add replication subcommand #261

Merged
merged 3 commits into from
Oct 26, 2018
Merged

Conversation

yuuki
Copy link
Contributor

@yuuki yuuki commented Oct 18, 2018

add replication subcommand insteam of slave
because it seems that the behavior that slave command returns OK if role is master is not intuitive in the PR(#259).

[y_uuki@redis01 ~]$ redis-cli info | grep role
role:master
[y_uuki@redis01 ~]$ ./check-redis replication
Redis Replication UNKNOWN: couldn't get master_link_status
[y_uuki@redis01 ~]$ ./check-redis replication --skip-master
Redis Replication OK: role is master
[y_uuki@redis002 ~]$ redis-cli info | grep role
role:slave
[y_uuki@redis002 ~]$ ./check-redis replication
Redis Replication OK: master_link_status: up

defer c.Close()

if role, ok := (*info)["role"]; ok {
if role != "slave" && opts.SkipMaster {
Copy link
Contributor

Choose a reason for hiding this comment

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

When role is "sentinel" and --skip-master is specified, this implementation reports as ok. but imo in that case it should return unknown?
https://redis.io/commands/role

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh sorry, role in info cannot be sentinel? If so, it's no problem.
https://redis.io/commands/INFO

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, role in info is 'master' or 'slave' or empty. A redis sentinel process returns role replication as an empty reply.

@yuuki yuuki merged commit b379c06 into master Oct 26, 2018
@yuuki yuuki deleted the check_redis_replication branch October 26, 2018 04:34
@yuuki yuuki mentioned this pull request Nov 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants