Detailed steps for installing Redis in CentOS7/RHEL7

Source: Internet
Author: User
Tags fpm redis install redis

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.