Try redisInstallation, PHPEnvironment connection and Testing
RedisIntroduction
RedisEssentiallyKey/valueDatabase, andMemcachedSimilarNosqlType database, but its data can be stored on the disk persistently. This solves the problem of no data loss after the service is restarted. Its value can beString(String ),List(List ),Sets(SET) orOrderedSets(Sorted set), all data types havePush/pop,Add/RemoveThe Union, intersection, and twoSetsThese operations are atomic,RedisDifferent sorting capabilities are also supported.
Apsaradb hybriddb for redis 2.0It also adds many new features, such as improved performance, new data types, and less memory utilization (AofAndVM)
RedisSupports most mainstream development languages, such:C,Java,C#,PHP,Perl,Python,Lua,Erlang,RubyAnd so on.
Official Website:Http://code.google.com/p/redis/
Installation Process
Latest stable version,Redis 2.0.4 stable
Wget
Http://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 softwareConfigure.
Make
Installed.
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:
Storage value:
./Redis-cli set HX Value
Valid value:
./Redis-cli get HX
InstallPhpredisModule
Https://github.com/owlient/phpredis
DownloadPhpredis
Extract
Shell> Cd phpredis
Shell>/usr/local/PHP/bin/phpizeThisPhpizeYesPHPModule
Shell>./configure
-With-PHP-Config =/usr/local/PHP/bin/PHP-config
Shell> make
Shell> make install
NextPHP. iniAddExtension = redis. So
First, check whetherExtension_dir =/.......
RestartApacheOrNginx
PHPCodeTest
$ Redis = new redis ();
$ Redis-> connect ('127.0.0.1′, 6379 );
$ Redis-> set ('test', 'Hello world! ');
Echo $ redis-> get ('test ');
?>
OutputHello world!
Http://code.google.com/p/php-redis/
RedisMaster/Slave Configuration
RedisMaster/Slave configuration is quite simple,SomeArticleRarryo wrote a large article, but there are actually two sentences.:
EnableRedis. conf
Port 6381 (Note: it cannot be the same as the host)
Sleverof
10.0.0.149 6383 (Note:IPHostIP,6383HostRedisPort Number)
Restart the host first, and then restart the slave
Run./Redis-server redis. conf
If:
The configuration is successful.