Details of the installation steps for Linux Redis

  • 2020-06-01 11:15:50
  • OfStack

Details of the installation steps for Linux Redis

Preface:

Redis is an open source (BSD license), in-memory data structure storage system that can be used as a database, cache, and message-oriented middleware. It supports multiple types of data structures, such as string (strings), hash (hashes), list (lists), collection (sets), ordered collection (sorted sets) with range queries, bitmaps, hyperloglogs and geospatial (geospatial) index radius queries.

redis is completely open source and free. It is a high performance key-value database. Redis and other key-value caching products have the following features:

Redis supports persistence of data, which can be stored in memory on disk and reloaded for use when restarted. Redis not only supports the simple key-value type of data, but also provides storage of list, set, zset, hash and other data structures. Redis supports data backup, that is, data backup in master-slave mode. High performance: Redis reads 110,000 times /s and writes 81,000 times /s.

Let's take a look at how to install Redis.

1. Download Redis

Download redis and unzip it.


$ wget http://download.redis.io/releases/redis-3.2.4.tar.gz
$ tar xzf redis-3.2.4.tar.gz

2. make compilation


$ cd redis-3.2.4
$ make

The following errors may occur


/bin/sh: cc: command not found
make[1]: *** [adlist.o] Error 127
make[1]: Leaving directory `/data/program/redis-3.2.8/src'
make: *** [all] Error 2

The gcc build tool is not installed, use the following command to install gcc.


$ yum -y install make gcc gcc-c++ ncurses-devel

3, make install

After successful compilation, enter the src folder and execute make install for Redis installation


$ cd src
$ make install

Using make install, you can make /usr/local/bin directory have the following command:


redis-server
redis-cli
redis-check-aof
redis-check-dump

Just set the redis command to the system command instead of starting these services in the {redis_home}/src directory. You can use the following command to check that the installation was successful.


redis-server  � v

4. Install redis

Create /data/program/ redis-test for later redis installation and copy redis conf file to redis-test file.


$ mkdir /data/program/redis-test
$ cp /data/program/redis-3.2.4/redis.conf /data/program/redis-test/
$ cd /data/program/redis-test

Modify the following properties in the configuration file (redis.conf) :


#  Modify the bind IP
bind 192.168.74.128
#  Modify the port number 
port 1000
#  Start as a daemon redis
daemonize yes
#  Modify the pid The file path 
pidfile /data/program/redis-test/redis_1000.pid
#  Modify log level 
loglevel debug
#  Modify the log file path 
logfile /data/program/redis-test/redis_1000.log

5. Start Redis

Specify the configuration file to start redis and detect successful startup.


$ redis-server redis.conf
$ ps -ef|grep redis

The following screen will appear:


$ cd redis-3.2.4
$ make
0

6. Operate Redis

Use the redis-cli command to enter redis and operate.


$ cd redis-3.2.4
$ make
1

If you have any questions, please leave a message or come to the site community to exchange discussion, thank you for reading, hope to help you, thank you for your support of the site!


Related articles: