Redis Publish Subscription Mode

Source: Internet
Author: User
Tags redis install redis

Publish and subscribe mechanism

When a client sends a message to the subscriber via the PUBLISH command, we call the client Publisher.

When a client uses the SUBSCRIBE or Psubscribe command to receive information, we call the client a Subscriber (subscriber).

To understand the relationship between a decoupling publisher (publisher) and a Subscriber (subscriber), Redis uses the channel (channel) as an intermediary--the publisher publishes the information directly to channel, and the channel is responsible for sending the information to the appropriate subscriber, There is no relationship between the publisher and the Subscriber, and there is no knowledge of the other.

The following figure is suitable for batch management, each client's server must have a redis-cli, install Redis naturally have, and then define sub, in the management end can be published through pub Some instructions, the client received, you can perform, you can do some other operations.

Some of the more practical examples:

Crawling Information clusters:

Http://www.starming.com/index.php?action=plugin&v=wave&tpl=t&nav=76&pg=1&gid=73&tid= 20964

Online chat Room:

Https://github.com/lzyy/chat

Monitoring and processing of the server:

Http://tech.ddvip.com/2013-05/1368026505195115.html

This article is from the "Technology Achievement Dream" blog, please be sure to keep this source http://weipengfei.blog.51cto.com/1511707/1215417

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.