MySQL Cache server-redis

Source: Internet
Author: User
Tags redis

Redis is a high-performance Key-value database. Redis data is cached in memory and periodically writes the updated data to disk or writes the modification to the appended record file, and Master-slave (master/Slave) synchronization is implemented on this basis.

Cache Read Process:

1, first to the cache to check the data

2, the cache does not exist in the actual data source fetch, take out and put into the cache

3, the next time to retrieve the same information can be directly from the cache

Cache update Process:

1. Update the database

2. Make the cache expire or fail, which will cause the next query data to be detected in the cache and re-run from the database.

Building LNMP See http://liang-yao.cnblogs.com/p/8448362.html Installing Redis on Redis-server:

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

Tar xzvf redis-4.0.1.tar.gz

CD REDIS-4.0.1/

Make

Mkdir/usr/local/redis

CP redis.conf sentinel.conf/usr/local/redis/

CD src/

CP redis-server Redis-sentinel Redis-benchmark redis-check-aof Redis-cli/usr/local/redis

cd/usr/local/redis/

Vim redis.conf

192.168.200.102 bind

Port 6379

136 Daemonize Yes #开启守护进程

Start the service:

./redis-server redis.conf

Ss-ntlu

TCP LISTEN 0 192.168.200.102:6379 *:*

./redis-cli-h 192.168.200.102

192.168.200.102:6379> keys *

(empty list or set)

Installing the PHP extension on Lnmp-server

wget Https://github.com/phpredis/phpredis/archive/develop.zip

Unzip Develop.zip

CD phpredis-develop/

Phpize

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

Make && make install

Vim/etc/php.ini

Extension_dir= "/usr/lib64/php/modules/"

Extension=redis.so

Test:

Systemctl Restart PHP-FPM

Lnmp-server Download Discuz Test:

wget Http://download.comsenz.com/DiscuzX/3.3/Discuz_X3.3_SC_UTF8.zip

Unzip Discuz_x3.3_sc_utf8.zip

MV upload/*/usr/share/nginx/html/

To access the Lnmp-server installation discuz:

vim/usr/share/nginx/html/config/config_global.php

--------------------------CONFIG MEMORY---------------------------//

$_config[' memory ' [' prefix '] = ' discuz_ ';

$_config[' memory ' [' Redis '] [' server '] = ' 192.168.200.102 ';

$_config[' memory ' [' Redis '] [' port '] = 6379;

#redis-serverip Address

To access Lnmp-server analog user actions:

./redis-cli-h 192.168.200.102

192.168.200.102:6379> keys *

MySQL Cache server-redis

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.