Distributed caching technology redis learning series (1) - introduction to redis and installation on linux

Introduction to redis

Redis is a type of NoSQL (No Only SQL, non-relational database). NoSQL stores data in the form of Key-Value. The current mainstream distributed cache technologies include redis, memcached, ssdb, mongodb, etc. Redis can be understood as a caching technology, because its data is cached in it; it can also be understood as a database, because redis can periodically write data to disk or append operations to record files. Personally, I prefer to understand it as caching technology, because the complex, high concurrency, and big data characteristics of today's Internet applications are the ultimate purpose of introducing various caching technologies.

The comparison between redis and traditional relational data, the comparison between redis and memcached, and the advantages and disadvantages of redis will not be introduced here, because each has its own advantages. Only by combining specific business scenarios can we deeply understand the differences between them. Differences and advantages and disadvantages. Let's start the installation of redis on linux.

Install redis under linux

Download the redis installation package

Download address: http://redis.io/

 

 

Compile the source program

 

[root@localhost ftpuser]# tar zxvf redis-3.2.0.tar.gz

[root@localhost ftpuser]# cd redis-3.2.0

[root@localhost redis-3.2.0]# make

[root@localhost redis-3.2.0]# cd src && make install

Create a directory to store redis commands and configuration files

[root@localhost redis-3.2.0]# mkdir -p /usr/local/redis/bin

[root@localhost redis-3.2.0]# mkdir -p /usr/local/redis/etc

move files

[root@localhost redis-3.2.0]# mv redis.conf /usr/local/redis/etc

[root@localhost redis-3.2.0]# cd src

[root@localhost src]# mv mkreleasehdr.sh redis-benchmark redis-check-aof redis-check-rdb redis-cli redis-server redis-sentinel redis-trib.rb /usr/local/redis/bin

start redis service

[root@localhost ~]# /usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf

 

As above, you need to specify a configuration file to start the redis service. If you start the redis service in the background, you need to modify the redis.conf file, daemonize no ---- >daemonize yes. The default link port of the redis server is 6379, and it is best to bind the IP to the local IP.

Verify that the startup was successful

[root @ localhost ~] # ps -ef | grep redis

#or

[root@localhost ~]# netstat -tunpl | grep 6379

 

Client connection

[root@localhost ~]# /usr/local/redis/bin/redis-cli -h 192.168.2.128 -p 6379

192.168.2.128:6379> info

# Server

redis_version:3.2.0

redis_git_sha1:00000000

...

stop redis service

[root@localhost ~]# /usr/local/redis/bin/redis-cli shutdown

#or

[root@localhost ~]# pkill redis-server

 

The installation of Redis on linux has been completed. In the next article, we will learn the common commands and data structures of redis.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324668848&siteId=291194637