Method 1: run the command to install EPEL ).
Install redis:
Yum-y install redis
Start/Stop/restart Redis
Start the service:
1
Systemctl start redis. service
Stop service:
Systemctl stop redis. service
Restart the service:
Systemctl restart redis. service
Check Status:
[Root @ idoseek ~] # Systemctl status redis. service
Redis. service-Redis persistent key-value database
Loaded: loaded (/usr/lib/systemd/system/redis. service; enabled)
Active: active (running) since 2 21:37:22 EDT; 5 h 26 min ago
Main PID: 30413 (redis-server)
CGroup:/system. slice/redis. service
2017-30413/usr/bin/redis-server 127.0.0.1: 6379
October 21 21:37:22 idoseek.com systemd [1]: Started Redis persistent key-value database.
Start the service with the system:
[Root @ idoseek ~] # Systemctl enable redis. service
Ln-s '/usr/lib/systemd/system/redis. Service'/etc/systemd/system/multi-user.target.wants/redis. Service'
Disable random start:
[Root @ idoseek ~] # Systemctl disable redis. service
Rm '/etc/systemd/system/multi-user.target.wants/redis. Service'
Method 2: compile and install
Download, install, and compile:
# Wget http://download.redis.io/releases/redis-2.8.17.tar.gz
# Tar xzf redis-2.8.17.tar.gz
# Cd redis-2.8.17
# Make
# Make install
Set the configuration file path:
# Mkdir-p/etc/redis & cp redis. conf/etc/redis
Modify the configuration file:
# Vim/etc/redis. conf
Change to: daemonize yes
Start Redis:
#/Usr/local/bin/redis-server/etc/redis. conf
# Close the service
Redis-cli shutdown
Or run shutdown in cli.
Redis 127.0.0.1: 6379> shutdown
Clear Cache
Redis-cli flushall
For more information, see the "README" file in the software package.
View Status:
# Ss-nlp | grep redis
Or
# Ps-ef | grep redis
The following describes how to add a redis plug-in for PHP..
Download the latest extensions from the official website at http://pecl.php.net/package/redis?https://github.com/phpredis/phpredis
# Wget http://pecl.php.net/get/redis-2.2.5.tgz
# Phpize
#./Configure -- prefix =/opt/redis -- enable-redis -- with-php-config =/opt/php/bin/php-config
# Make & make install
Add the extension to php. ini and restart php-fpm:
Service php-fpm restart