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

sentinel is fully supported? #7

Closed
lixiaochun opened this issue Jan 18, 2019 · 6 comments
Closed

sentinel is fully supported? #7

lixiaochun opened this issue Jan 18, 2019 · 6 comments

Comments

@lixiaochun
Copy link

hi i want to know if sentinel is fully supported? thank you:)

@sewenew
Copy link
Owner

sewenew commented Jan 18, 2019

Hi redis-plus-plus does NOT support sentinel so far. Although you can use Redis object to connect to a sentinel, and send commands with the Generic Command Interface.

However, sentinel support is in progress, and the next release, i.e. 1.1.0, will support sentinel, and maybe Redis Stream. Once I have any progress, I'll let you know.

If you have any problem with redis-plus-plus, please feel free to let me know :)

Regards

@lixiaochun
Copy link
Author

lixiaochun commented Jan 23, 2019

thank you for your information and support, and I already found another easy way to connect sentinel cluster using single redis intance driver instead of sentinel pool, and read and write could be also fully seperated. the main idea is to connect redis using url instead of ip addr, meanwhile consul & dns needs to be used in this case to monitor and detect redis. this is temp way and could be working properly, and I will still use redis-plus-plus to connect sentinel using single redis intance driver, because consul and dns can simplfy redis sentinel as single instance , and once redis-plus-plus supports sentinel senario, i will remove consul and dns related components to make redis setup as easy as possible:)

@sewenew
Copy link
Owner

sewenew commented Apr 30, 2019

Hi @lixiaochun

Now sentinel is supported by redis-plus-plus. You can try the latest code of master branch.

With this feature, Redis can get master or slave address from Redis Sentinel. Even if a failover occurs, it can automatically get the address of the new master.

SentinelOptions sentinel_opts;
sentinel_opts.nodes = {{"127.0.0.1", 9000},
                        {"127.0.0.1", 9001},
                        {"127.0.0.1", 9002}};
auto sentinel = std::make_shared<Sentinel>(sentinel_opts);
ConnectionOptions connection_opts;
connection_opts.connect_timeout = std::chrono::milliseconds(100);   // Required.
connection_opts.socket_timeout = std::chrono::milliseconds(100);     // Required.
auto master = Redis(sentinel, "master_name", Role::MASTER, connection_opts);
auto slave = Redis(sentinel, "master_name", Role::SLAVE, connection_opts);
master.set("key", "value");
slave.get("key");

Please see the doc for detail. If you have any problem, feel free to let me know.

Regards

@lixiaochun
Copy link
Author

perfect, thank you very much for your information, I will try it ASAP:)

@lixiaochun
Copy link
Author

sentinel fully supported , good work:)

@sewenew
Copy link
Owner

sewenew commented Oct 18, 2019

Hi @lixiaochun ,

Recently, I find a bug which might make the Redis object created with Sentinel, not work properly. Please update your code to the latest master branch.

Sorry for the inconvenience...

Regards

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