Installing Redis and PHP Redis extensions

Source: Internet
Author: User
Tags benchmark php redis redis download redis server

1. Installing Redis

Redis download can download the latest stable version on http://redis.io/website.

wget http://download.redis.io/releases/redis-3.0.5.tar.gz

TAR-ZXVF redis-3.0.5.tar.gz

CD redis-3.0.5

Make

CD src/

Copy the executable files under SRC to/usr/local/bin/.

CP redis-benchmark redis-check-aof redis-check-dump redis-cli redis-server redis-sentinel redis-trib . rb/usr/local/bin/

    • Redis-server:redis Server Daemon Startup program

    • REDIS-CLI:REdis command line operation tool.

    • Redis-benchmark:redis Performance testing tools to test the read and write performance of Redis in your system and in your configuration

Create a Redis Data Catalog

Mkdir-p/home/redis/data

Copy the default redis.conf file to the Redis directory

CP redis.conf/home/redis/data/

-----------------------------------------------

Vim redis.conf

Modify

Daemonize Yes

Pidfile /home/redis/data/redis.pid

LogFile /home/redis/data/redis.log

-----------------------------------------------

redis.conf file each parameter meaning:

    • Daemonize: Whether to run daemon mode later

    • Pidfile:pid File Location

    • Port: Port number for listening

    • Timeout: Request time-out

    • Loglevel:log Information level

    • Logfile:log File Location

Databases: number of open databases

Save *: How often the snapshot is saved, the first * indicates how long, and the second * indicates how many times the write operation was performed. Snapshots are automatically saved when a certain number of writes are performed within a certain amount of time. Multiple conditions can be set

Rdbcompression: Whether to use compression

Dir: Save directory for data snapshots

----------------------------------------------

Start Redis

Redis-server /home/redis/data/redis.conf

To see if the port is open

Netstat-nlpt | grep 6379

Stop Redis

Killall resid-server or Kill ' cat /home/redis/data/redis.pid'

Attention:

After the installation is complete, Redis does not have a password, so exposing it to the public is dangerous, so we need to turn on password authentication in the configuration file.

Vim redis.conf

Find Requirepass foobared

Modified to: Requirepass test12345 (test12345 is the password you set)

And then you can go through the REDIS-CLI certification.

Redis-cli-p 6379

127.0.0.1:6379> Auth test12345

127.0.0.1:6379> Info

=================================================================

2. Installing the Redis PHP extension

Cd/usr/local/src

wget https://github.com/nicolasff/phpredis/archive/2.2.4.tar.gz

TAR-ZXVF 2.2.4.tar.gz

CD phpredis-2.2.4

Phpize #用phpize生成configure配置文件 If you cannot find phpize This command, perform the Yum install Php-devel installation

./configure--with-php-config=/usr/bin/php-config

Make

Make install

A redis.so is generated in the/usr/lib64/php/modules/directory after execution is completed

Vim/etc/php.ini

Add to

extension= "Redis.so"

Then execute php-m to see the loaded Redis module.

Installing Redis and PHP Redis extensions

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.