Beckham _ redis installation and deployment, and Beckham _ redis deployment
Install Redis and expand php Redis
1. Download Redis-Related Files
Ii. Install Redis
Iii. phpredis extended Installation
1. download relevant files in this document
1. Redis: http://redis.io/download
2, php Redis expansion: http://pecl.php.net/package/redis
Php: http://php.net/downloads.php
(Note: This document downloads redisfor redis-3.0.2.tar.gz while php redis expands to redis-2.2.7.tgz)
4,The testing machine system is CentOS release 6.3 (Final)
The php environment isPhp-5.6.11
Ii. Install the redis Service
1. Install the Redis Service
A. tar-zxf redis-3.0.2.tar.gz
B. make & make install
2. After the installation is successful, the following executable files will appear in src:
(Remarks: mkreleasehdr. sh, redis-check-dump, redis-cli, redis-benchmark, redis-check-aof, redis-sentinel, redis-server, redis-trib.rb
Redis-server is the server that starts the redis service.
Redis-cli is the Client Connected to redis
)
3. Start the service and test redis
3.1 create directories bin and etc (bin stores redis executable files, etc stores redis configuration files)
[Root @ hadoop src] # mv mkreleasehdr. shredis-benchmark redis-check-aof redis-check-dump redis-cli redis-sentinelredis-server redis-trib.rb ../bin/
[Root @ hadoop redisd] # mv redis. conf etc/
3.2 start redis
[Root @ hadoop redisd] #./bin/redis-server./etc/redis. conf
3.3. Check whether redis is enabled (the default port of redis is 6379)
3.4 use a built-in client to operate redis
3.5 set redis to start automatically
Modify the/etc/rc. local file
/Usr/local/redisd/bin/redis-server/usr/local/redisd/etc/redis. conf>/dev/null &
3.6 disable redis
[Root @ hadoop redisd] #./bin/redis-clishutdown
4. Common exceptions and handling
Exception 1: make [2]: cc: Command not found
Cause of exception: gcc Is Not Installed
Solution: yum installgcc-c ++
Error 2: zmalloc. h: 51: 31: error: jemalloc/jemalloc. h: Nosuch file or directory
Cause of exception: Some compilation dependencies or issues left behind by the original compilation
Solution: make distclean. Clean up and then make.
Exception 3: make test is required after make is successful. An exception occurred in make test.
Couldn't execute "tclsh8.5": no such file or directory
Cause of exception: tcl is not installed
Solution: yum install-ytcl
3. Install the phpredis Service
1. decompress the compressed package
Tar-zxf php redis expanded to redis-2.2.7.tgz
2. Enter the decompressed directory and run phpize.
[Root @ hadoop phpredis] #/usr/local/php/bin/phpize
3. Install phpredis Extension
[Root @ hadoopphpredis] #./configure -- enable-redis-igbinary -- with-php-config =/usr/local/php/bin/php-config
[Root @ hadoopphpredis] # make & make install
4. Modify the php. ini file and load the corresponding redis Extension
5. Restart php to verify whether redis expansion is installed.
[Root @ hadoop etc] # pkill-9 php
[Root @ hadoop etc] # ../sbin/php-fpm
6. Use php to test the redis Service
<? Php
Echo 'xiaobei ';
$ Redis = new Redis ();
// Connect
$ Redis-> connect ('2017. 0.0.1 ', 127 );
$ Redis-> set ('name', 'redisis OK ');
Echo $ redis-> get ('name ');
?>
7. Common exceptions and handling
Exception 1:Checking for igbinary between des... configure: error: Cannot find igbinary. h
Solution
Download http://pecl.php.net/get/igbinary-1.1.1.tgz
Tar-xzvf igbinary-1.1.1.tgz
Cd igbinary-1.1.1
Phpize
./Configure -- with-php-config =/usr/local/php/bin/php-config -- enable-igbinary
Make
Make install
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.