Installation and Start-up of [redis (1)]


brief introduction

REmote DIctionary Server (Redis) is a key-value storage system written by Salvatore Sanfilippo (father of redis).
Redis provides a number of rich data structures, including lists, sets, ordered sets, hashes, and strings like Memcached.
Redis also includes rich manipulation of these data structures, of course.

In short, it has the following characteristics:

  1. Rich data structure
  2. Persistence
  3. Supporting simple transactions
  4. Master-slave configuration is convenient

Compared redis with memcached

  1. Redis can be used for storage, while memccached can only be used for cache. This feature is mainly due to its “persistence” function.
  2. For memcached, there is only one type of data stored – “string”, while redis can store strings, linked lists, hash structures, sets, ordered sets.


Installing redis under Linux (centOS)

tar zxvf redis-3.0.7.tar.gz
cd redis-3.0.7
# The source code is officially configured. This place can skip configure and make directly, but it may encounter time errors when making. The reason is that when the source code is officially configure, the generated file has time stamp information. Make can only occur after configure. If the virtual machine time is not right, it must rewrite the time.
# date -s 'yyyy-mm-dd hh:mm:ss'
# clock -w
Make PREFIX=/usr/local/redis install # Note that PREFIX is capitalized
# Optional step make test to test compilation

After installation, the following files are obtained:

Redis-benchmark performance testing tool
Redis-check-aof log file detection tool (for example, log damage caused by power failure can be detected and repaired)
Redis-check-dump snapshot file detection tool, on effect class
Redis-cli client
Redis-server server server

Extended compilation of php-redis under Linux (centOS)

  1. Search pecl. php. net for redis
  2. Download stable extensions
  3. Unzip in and execute / PHP / path / bin / phpize (to detect the PHP kernel version and generate the corresponding compilation configuration for the extension)
  4. ./configure --with-php-config=/usr/bin/php-config
  5. make && make install
  6. The last line after compilationInstalling shared extensions: /usr/lib/php/modules/Tell where the extension is; then add both in php.ini;

[info] can also use the compose package directlypredis/predis

Installation under Windows

Redis is not recommended for Windows. If you really need to install because of development and other factors, you can refer to the following links for installation.

The installation of redis under windows:…

Installation of php-redis extension:…

GitHub of redis…

GitHub of php-redis.dll…


Start up service

Let redis run as a background process, edit the conf configuration file, and modify the following:
daemonize yes

/ path/redis-server/path/redis.conf# Here conf can be freely specified, you can first see through -- help

Start the client

Path / to / redis / bin / redis - cli [- h localhost - P 6379] # If you want to display Chinese in redis shell, you can add - ray boot