Redis installation is not required./configure, this is better, simple!
The code is as follows |
Copy Code |
#下载 wget http://redis.googlecode.com/files/redis-2.6.14.tar.gz #解压 TAR-ZXVF redis-2.6.14.tar.gz #拷贝到目标目录 Mkdir-p/usr/local/redis Cp-r./redis-2.6.14/usr/local/redis Cd/usr/local/redis #安装 Make && make install |
After you've installed it,
./conf configuration file
./src/redis-server Redis's server
./src/redis-client Redis Client
"Change Configuration"
This time Redis is ready to start.
The interface is more beautiful, but it is inconvenient to use, we need to change it to run in the background:
Open redis.conf Find Daemonize no change to daemonize Yes on OK, other configuration first with the default bar!
Then you can start up:
View Sourceprint?
1/usr/local/redis/src/redis-server/usr/local/redis/redis.conf
Then look at the Redis process:
Has started up, using the default 6379 port.
Then it is best to add a boot start, at the bottom of the/etc/rc.d/rc.local add a line just to start the command, so that there will not be forgotten to start the accident
"Install PHP extensions"
After other PHP extensions have been installed, it is too easy to find a PHP extension, with each extension, using only phpize &&/configure && make && make install, and finally changing the ph P.ini's OK.
The code is as follows |
Copy Code |
1 wget https://github.com/owlient/phpredis/archive/master.zip 2 Unzip Master.zip 3/usr/local/php/bin/phpize 4./configure--with-php-config=/usr/local/php/bin/php-config 5 Make && make install |
Then add a line to the php.ini:
The code is as follows |
Copy Code |
[Redis] Extension=redis.so |
It's OK.
So PHP can use Redis-related classes.
Performance
Here is the official Bench-mark data:
The test completed 50 concurrent execution 100,000 requests.
The value set and gets is a 256-byte string.
Linux box is running Linux 2.6, which is X3320 Xeon 2.5 GHz.
Text execution uses the loopback interface (127.0.0.1).
Result: The speed of writing is 110,000 times/s, and the speed of reading is 81,000 times/s.