Redis installation and configuration tutorial and phpredis extension installation test
1. Download redis-2.8.17.tar.gz: http://download.redis.io/releases/redis-2.8.17.tar.gz;
2. The compilation and installation configurations are as follows:
# Make
[Redis-2.8.17] # make PREFIX =/usr/local/redis-2.8.17 install
[Redis-2.8.17] # ln-s/usr/local/redis-2.8.17/bin/redis-benchmark/usr/bin/redis-benchmark
[Redis-2.8.17] # ln-s/usr/local/redis-2.8.17/bin/redis-check-aof/usr/bin/redis-check-aof
[Redis-2.8.17] # ln-s/usr/local/redis-2.8.17/bin/redis-check-dump/usr/bin/redis-check-dump
[Redis-2.8.17] # ln-s/usr/local/redis-2.8.17/bin/redis-cli/usr/bin/redis-cli
[Redis-2.8.17] # ln-s/usr/local/redis-2.8.17/bin/redis-server/usr/bin/redis-server
The [redis-2.8.17] # cd utils
[Utils] #./install_server.sh
Welcome to the redis service installer
This script will help you easily set up a running redis server
Please select the redis port for this instance: [6379]
Selecting default: 6379
Please select the redis config file name [/etc/redis/6379. conf]/usr/local/redis-2.8.17/conf/redis_62.16.conf
Please select the redis log file name [/var/log/redis_62.16.log]/usr/local/redis-2.8.17/log/redis_62.16.log
Please select the data directory for this instance [/var/lib/redis/6379]/usr/local/redis-2.8.17/data/6379
Please select the redis executable path [/usr/bin/redis-server]
Selected config:
Port: 6379
Config file:/usr/local/redis-2.8.17/conf/redis_62.16.conf
Log file:/usr/local/redis-2.8.17/log/redis_62.16.log
Data dir:/usr/local/redis-2.8.17/data/6379
Executable:/usr/bin/redis-server
Cli Executable:/usr/bin/redis-cli
Is this OK? Then press ENTER to go on or Ctrl-C to abort. Enable the AOF mode: appendonly yes:
############################# Append only mode ####### ########################
# By default Redis asynchronously dumps the dataset on disk. This mode is
# Good enough in your applications, but an issue with the Redis process or
# A power outage may result into a few minutes of writes lost (depending on
# The configured save points ).
#
# The Append Only File is an alternative persistence mode that provides
# Much better durability. For instance using the default data fsync policy
# (See later in the config file) Redis can lose just one second of writes in
# Dramatic event like a server power outage, or a single write if something
# Wrong with the Redis process itself happens, but the operating system is
# Still running correctly.
#
# AOF and RDB persistence can be enabled at the same time without problems.
# If the AOF is enabled on startup Redis will load the AOF, that is the file
# With the better durability guarantees.
#
# Please check http://redis.io/topics/persistence for more information.
Appendonly yes
# The name of the append only file (default: "appendonly. aof ")
Appendfilename "appendonly_62.16.aof" restart redis using the redis service command:
[Redis-2.8.17] #/etc/init. d/redis_6379 -- help
Please use start, stop, restart or status as first argument
[Redis-2.8.17] #/etc/init. d/redis_6379 restart
Please use start, stop, restart or status as first argument3. download the igbinary extension package (redis extension package-enable-redis-igbinary dependent igbinary extension package): http://pecl.php.net/get/igbinary-1.2.1.tgz
[Redis-2.8.17] #/usr/local/php/bin/phpize
[Redis-2.8.17] #./configure -- with-php-config =/usr/local/php/bin/php-config -- enable-igbinary
[Redis-2.8.17] # make & make install4. download redis extension package: http://download.redis.io/releases/redis-2.8.17.tar.gz
[Redis-2.8.17] #/usr/local/php/bin/phpize
[Redis-2.8.17] #./configure -- with-php-config =/usr/local/php/bin/php-config -- enable-redis-igbinary
[Redis-2.8.17] # make & make install5. modify php. ini configuration:
;/Usr/local/php/etc/php. ini
Extension = igbinary. so
Extension = redis. so6. test whether the extension is loaded normally:
[Redis-2.8.17] #/usr/local/php/bin/php-m
[PHP Modules]
...
Igbinary
...
Redis
...
[Zend Modules] 7. The test code is as follows:
<? Php
$ Redis = new Redis ();
$ Redis-> connect ('2017. 0.0.1 ', 127 );
$ Count = $ redis-> dbSize ();
Echo "Redis has $ count keys \ n ";
$ Ret = $ redis-> get ('test5 ');
Var_dump ($ ret); 8. install and configure Redis WEB management tool phpRedisAdmin: https://github.com/ErikDubbelboer/phpRedisAdmin
[Phpredisadmin] # git clone https://github.com/ErikDubbelboer/phpRedisAdmin.git
[Phpredisadmin] # cd phpRedisAdmin
[Phpredisadmin] # git clone https://github.com/nrk/predis.git vendor and then configure the corresponding nginx configuration to see the current Redis service status:
Now the redis environment configuration is complete.
Install and test Redis in Ubuntu 14.04
Redis cluster details
Install Redis in Ubuntu 12.10 (graphic explanation) + Jedis to connect to Redis
Redis series-installation, deployment, and maintenance
Install Redis in CentOS 6.3
Learning notes on Redis installation and deployment
Redis. conf
Redis details: click here
Redis: click here
This article permanently updates the link address: