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:
- Rich data structure
- Supporting simple transactions
- Master-slave configuration is convenient
Compared redis with memcached
- Redis can be used for storage, while memccached can only be used for cache. This feature is mainly due to its “persistence” function.
- 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)
wget http://download.redis.io/releases/redis-3.0.7.tar.gz 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)
- Search pecl. php. net for redis
- Download stable extensions
- Unzip in and execute / PHP / path / bin / phpize (to detect the PHP kernel version and generate the corresponding compilation configuration for the extension)
make && make install
- The last line after compilation
Installing shared extensions: /usr/lib/php/modules/Tell where the extension is; then add both in php.ini;
[info] can also use the compose package directly
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:
/ 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