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

Possible to use multiple sentinels in config.yml #4

Open
vishalsharma13 opened this issue Apr 13, 2017 · 4 comments
Open

Possible to use multiple sentinels in config.yml #4

vishalsharma13 opened this issue Apr 13, 2017 · 4 comments

Comments

@vishalsharma13
Copy link

@yak0

Hi,

I am facing problem that sometime event not captured at sentinel like +convert to slave event not captured by sentinel that i used due to this twemsentinel unable to update the the nutcracker conf.
So please suggest the way to solve out this problem.

@yak0
Copy link
Owner

yak0 commented Apr 13, 2017

Hi @vishalsharma13 What exactly is the problem you are facing?

If twemproxy didnt change master-slave servers check your config.xml (nutracker_restart_command)

@vishalsharma13
Copy link
Author

@yak0
Thanks for your prompt reply.
My architecture is 3 redis 3 sentinel and twemproxy as proxy and twemsentinel to update twemproxy configuration.
In config.yml of twemsentinel i am using sentinel 1 to capture the sentinel events like (switch-master and convert to slave) but my problem is that some time event not capture in sentinel that i have used in config.yml.

Like in below logs +convert to slave event at sentinel 3 but not in others 2 sentinels and i am using sentinel1 in config.yml and due to this +convert to slave event not capture from sentinel and nutcracker.yml file not updated through twemsentinel.py.

Following are sentinel logs :-

Sentinel1(That i am used in congig.yml)

23197:X 13 Apr 11:52:13.499 * +slave slave X.X.X.X:6381 X.X.X.X 6381 @ mymaster X.X.X.X 6380
23197:X 13 Apr 11:52:13.503 * +slave slave X.X.X.X:0 127.0.0.1 0 @ mymaster X.X.X.X 6380
23197:X 13 Apr 11:52:13.507 * +slave slave X.X.X.X:6382 10.247.74.97 6382 @ mymaster X.X.X.X 6380
23197:X 13 Apr 11:52:18.571 # +sdown slave X.X.X.X:0 X.X.X.X 0 @ mymaster X.X.X.X 6380

Sentinel2

8336:X 13 Apr 11:52:14.573 * +slave slave X.X.X.X:6381 X.X.X.X 6381 @ mymaster X.X.X.X 6380
8336:X 13 Apr 11:52:14.577 * +slave slave X.X.X.X:6382 X.X.X.X 6382 @ mymaster X.X.X.X 6380

Sentinel3

15499:X 13 Apr 11:52:12.798 * +slave slave 127.0.0.1:0 127.0.0.1 0 @ mymaster X.X.X.X 6380
15499:X 13 Apr 11:52:12.803 * +slave slave X.X.X.X:6381 X.X.X.X 6381 @ mymaster X.X.X.X 6380
15499:X 13 Apr 11:52:12.806 * +slave slave X.X.X.X:6382 X.X.X.X 6382 @ mymaster X.X.X.X 6380
15499:X 13 Apr 11:52:17.836 # +sdown slave 127.0.0.1:0 127.0.0.1 0 @ mymaster X.X.X.X 6380
15499:X 13 Apr 11:52:22.885 * +convert-to-slave slave X.X.X.X:6382 X.X.X.X 6382 @ mymaster X.X.X.X 6380

@yak0
Copy link
Owner

yak0 commented Apr 13, 2017

Did you listen "+switch-master" channel in a redis-cli ?
You are receiving messages, but twemsentinel does not update nutcracker.yml?
If there isn't a message probably it's a redis problem i dont know how do you solve this.

@vishalsharma13
Copy link
Author

I am listening this event through redis pubsub . Below is the code

      self.redis = redis.StrictRedis(host=self.sentinel_ip, port=self.sentinel_port, db=0)
        self.pubsub = self.redis.pubsub()
        self.pubsub.subscribe(['+switch-master'])
        self.pubsub.subscribe(['+convert-to-slave'])
        self.pubsub.subscribe(['-sdown'])
        self.log.info(self.pubsub)
        self.log.info(self)
        self.log.info("Redis sentinel connection successfull")
    except:
        self.log.info("Redis sentinel connection error")

In twemsentinel.py

and below is my config.yml

sentinel_ip: "X.X.X.X"
sentinel_port: "26381"
twemproxy_config_file: "nutcracker.yml"
nutcracker_restart_command: "supervisorctl restart nutcracker1"
log_file: "twemsentinel.log"

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

No branches or pull requests

2 participants