Installation and deployment of Redis (Linux)

Source: Internet
Author: User
Tags install redis

Installation and deployment of Redis (Linux)

I. Redis Introduction

Redis is one of the most popular NOSQL systems. It is a key-value storage system. Similar to Memcache, But it largely compensates for the shortcomings of Memcache. It supports more storage value types, including string, list, set, zset, and hash. These data types support push/pop, add/remove, intersection union and difference sets, and richer operations. On this basis, Redis supports sorting in different ways.

Like Memcache, Redis data is cached in computer memory. The difference is that Memcache can only cache data to the memory and cannot automatically write data to the hard disk on a regular basis, when a power failure or restart occurs, the memory is cleared and data is lost. Therefore, the Application Scenario of Memcache is suitable for caching data without persistence. What is different from Redis is that it periodically writes updated data to the disk or writes modifications to the append record file to achieve data persistence.

Ii. Redis Installation

The following describes how to install and deploy Redis in Linux.

1. Download The Redis compressed package on the official website at http://redis.io/downloaddownload stable version 3.0.7.

2. Use a remote management tool to copy the compressed package to a Linux server and decompress the package.

3. Execute make to decompress Redis and compile the file

After the compilation is complete, you can see that the decompressed file redis-3.0.7 will have the corresponding src, conf and other folders, which is the same as the installation of decompressed files in windows, most installation packages have corresponding class files, configuration files, and some command files.

4. After compilation, go to the src folder and run makeinstall to install Redis.

5. The installation is complete. The interface is as follows:

Iii. Redis deployment

After the installation is successful, deploy Redis

1. First, to facilitate management, move the conf configuration file and Common commands in the Redis file to the Unified File.

A) Create the bin and redis. conf files.

Mkdir-p/usr/local/redis/bin

Mkdir-p/usr/local/redis/ect

B) run the Linux File migration command:

Mv/lamp/redis-3.0.7/redis. conf/usr/local/redis/etc

Cd/lamp/redis-3.0.7/src

Mvmkreleasdhdr. shredis-benchmarkredis-check-aofredis-check-dumpredis-cliredis-server/usr/local/redis/bin

2. Run the Redis-server command to start the Redis service.

Note: The Redis service started by the Redis-server is directly run on the front-end (for example, the effect). That is to say, if the current session is closed after the command is executed, then the Redis service is closed immediately. Under normal circumstances, you need to start the Redis service from the background and specify the startup configuration file.

3. Start the redis service in the background

A) First edit the conf file and change the daemonize attribute to yes (indicating that you need to run it in the background)

Cdetc/

Viredis. conf

B) Start the redis service again and specify the startup service configuration file

Redis-server/usr/local/redis/etc/redis. conf

4. After the server starts successfully, run redis-cli to start the Redis client and check the port number.

Iv. Summary of common Linux and Redis commands

Linux:

Cd/usr enter the upper-level folder usr from the sub-Folder

Cdlocal from parent to child

Mv/A/B Move file A to file B

Viusr/local/redis. conf edit the redis. conf file

: Wq: Save the modification and exit.

Redis:

Start the Redis service in redis-server/usr.../redis. conf and specify the configuration file

Start the Redis client using redis-cli

Pkillredis-server shut down the redis Service

Redis-clishutdown shut down the redis Client

Netstat-tunpl | grep6379 check the usage of redis default port 6379

 

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.