[NoSQL] Verifying the master-slave replication of Redis

Source: Internet
Author: User

Installing the configuration Redis http://www.cnblogs.com/myrunning/p/4222385.html

1.1 View current Redis files

1.2 Modifying a configuration file

The copy configuration files are redis_master.conf and redis_slave.conf, respectively:

To view the current port configuration for redis_master.conf:

To modify the configuration of the redis_slave.conf:

1.3 Starting a master-slave Redis Service

1.4 Master-Slave replication test

Login to Master service:

Log in to the slave service, from the slave service to see if the value we put in the master service is available in the slave service, and if so, it proves that the master-slave copy of the configuration succeeds.

After the slave service test, we got the value of key, which indicates that Redis master-slave replication succeeded.

##===========================================

If you use Redis for shopping basket analysis, which is to record a supermarket or e-commerce site, each time a customer buys something in his shopping cart, and then calculates the purchase of a certain item (such as milk) of customers, his shopping cart and other goods (such as eggs) frequently appear, a improve shelf design and recommendation system.

Requirements: 1) data Model Design 2) is redis suitable for solving such problems? Give your opinion.

2.1 Database Model Design 2.1.1 Customer's design

Use the hash to represent the customer, among which client:1001 is the 1th customer's hash name, which contains a name, gender, age three keys.

Add a 2nd Customer:

Add a 3rd Customer:

Design of 2.1.2 Products

We will also use a hash method for the representation of the product:

Design of 2.1.3 Shopping cart

To design a shopping cart for each customer, the customer and the shopping cart are 1 to 1 relationship.

1th customer's shopping cart, Client:1001:bashet goods and quantity:

2nd customer's shopping cart goods and quantity:

3rd customer's shopping cart goods and quantity:

2.1.4 The correspondence between goods and customers

Here we will take a collection of ways:

2.2 Meeting specific needs 2.2.1 See what's in your shopping cart

View items from three shopping carts separately:

2.2.2 Calculate the customer who buys an item

People who buy eggs, milk and beer at the same time:

2.2.3 Product sales ranking recommended to customers

2.3 Redis is suitable for solving this kind of problem

The application of Redis is more used as a substitute for mecached, and he is similar to Mencached's applicable scenario, which is suitable for the high concurrency and fast response requirements in the Internet system, and it is generally suitable for high-speed read and write access when the small amount of data is in the large amount of data. Ideal for mitigating access to hotspot data. For e-commerce sites, the amount of data in each commodity will be very large, for a period of hot products, may be a lot of users visit, will cause a part of the hot data, access to hot products can be placed in Redis to solve, improve the user's query speed, Also because the business site shopping cart data is the need for frequent data exchange, user action Hotspot is also here, so it is more appropriate to use Redis to process this part of the data, and the Redis processing set and hash data is also the key to the scene of the shopping cart, in the Reids, You can think of a shopping cart as a set or hash, which reduces the level of application processing.

[NoSQL] Verifying the master-slave replication of Redis

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.