Redis Introduction
Redis essentially a key/value database, similar to the memcached NoSQL database, but his data can be persisted on disk, solve the service restart after the data is not lost, his value can be string (string), Lists (list), sets (set), or ordered sets (sorted collection), all data types have Push/pop, Add/remove, execute service-side sets, intersections, two-sets sets of differences, and so on, all of which are atomic , Redis also supports a variety of different sorting capabilities
Redis 2.0 Adds a number of new features, such as improved performance, new data types, and less memory usage (AOF and VM)
Redis supports most mainstream development languages, such as C, Java, C #, PHP, Perl, Python, Lua, Erlang, Ruby, etc.
Official website: http://code.google.com/p/redis/
installation Process
the latest stable version, Redis 2.0.4 stable
wgethttp://redis.googlecode.com/files/redis-2.0.4.tar.gz
tar zxf redis-2.0.4.tar.gz
CD redis-2.0.4
Unlike other software, configure is not required.
Make
finished.
Create a directory
Mkdir/usr/local/redis2
CP redis-server Redis-benchmark redis-cli Redis.conf/usr/local/redis2
Start:
./redis-server >/dev/null &
Test:
stored value:
./REDIS-CLI Set HX Value
Take value:
./REDIS-CLI Get HX
Installing the Phpredis module
Https://github.com/owlient/phpredis
Download Phpredis
Decompression
shell> CD Phpredis
shell>/usr/local/php/bin/phpize This phpize is the installation of the PHP module
shell>./configure–with-php-config=/usr/local/php/bin/php-config
shell> Make
shell> make install
Next in php.ini add extension=redis.so first to see if there is extension_dir=/ ....
Restart Apache or Nginx
PHP Code Test
$redis = new Redis ();
$redis->connect (' 127.0.0.1′,6379);
$redis->set (' Test ', ' Hello world! ');
echo $redis->get (' test ');
?>
Output Hello world!
http://code.google.com/p/php-redis/
Redis master and slave configuration
Redis Master and subordinate configuration is quite simple, some articles wordy wrote a large article, in fact, two words:
Open the redis.conf from the machine
Port 6381 (Note: cannot be the same as the host)
Sleverof10.0.0.149 6383 (Note: IP for host ip,6383 for host Redis port number)
Reboot the host before restarting the machine
run./redis-server redis.conf
if present:
, indicating that the configuration was successful.