Redis Usage Summary

Source: Internet
Author: User

1.Redis Installation

Redis is very easy to install, and Redis does not rely on other environments and standard libraries, which is easy to get started, which is probably one of the reasons why it is popular. For testing convenience, it is used in Windows environment testing. Download the Windows version of Redis.

The redis.windows.conf is a redis configuration file.

Redis-server.exe server side.

REDIS-CLI the command line client.

Redis-benchmark:redis Performance Testing tool to test the read and write performance of Redis in your system and in your configuration.

2. Start the service

Enter the following command at the command line: Redis-server redis.windows.conf.

You can also save the command as a file Startup.bat, and the next time you can start it directly.

If prompted Redis-server is not an internal command. Add the directory to the environment variable.

3. Redis-related configuration

1. Port port number, for example 6379

2. Bind instance binding access address 127.0.0.1

3. Password for requirepass access

4. Maxheap Remember to open this configuration node and the Redis service will not start. For example Maxheap 1024000000

5. Timeout: Request time-out

6. logfile:log File Location

7. Databases: Number of open databases

8. Dbfilename: Data Snapshot file name (only file name, excluding directory)

 4. Connection test

Enter the following command at the command line: Redis-cli–h 127.0.0.1–p 6379

The parameters are host, port, and if the password is set, you must add-a 123456,123456 as the login password. Otherwise, you are prompted to log on to the system without permission.

As shown in.

5. master-Slave configuration

Redis, like MySQL, has a very powerful master-slave replication feature, and it also supports a master that can have multiple slave, while a slave can have multiple slave to form a powerful multi-level server cluster architecture.
         
Redis's master-slave replication is asynchronous and does not affect master's operation, so it does not degrade the processing performance of Redis. In the master-slave architecture, you can consider turning off the data persistence feature of master and only allow slave to persist, which can improve the processing performance of the primary server. At the same time slave is read-only mode, which avoids slave cached data being modified by mistake.

In actual production, the master-slave architecture installs the appropriate Redis services on several different servers. For testing convenience, the configuration of the master and slave backup on my side is tested on my Windows native computer.

1. Install two Redis instances, master and slave. Set the master port to 6379,slave Port set to 6380. Bind is set to: 127.0.0.1.

2. in slave instance, add: slaveof 127.0.0.1 6380 configuration.

After the configuration is complete, start these two instances, if the output is as follows, the master-slave copy of the schema has been configured successfully.

Note: Test on the same computer, master and slave not the same port, otherwise it is not possible to start two instances at the same time.

3. At the command line, connect the master server and the slave server respectively. The master is then written to the cache and then read in the slave. As shown in the following:

Note: Slave can only read and cannot write data.

Redis Usage Summary

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.