MySQL快取服務器-redis

來源:互聯網
上載者:User

標籤:hive   local   /usr   etc   資訊   技術   port   周期性   http   

Redis 是一個高效能的key-value資料庫。redis資料都是緩衝在記憶體中,會周期性的把更新的資料寫入磁碟或者把修改操作寫入追加的記錄檔案,並且在此基礎上實現了master-slave(主從)同步。

 

緩衝讀取流程:

1、先到緩衝中查資料

2、緩衝中不存在則到實際資料來源中取,取出來後放入緩衝

3、下次再來取同樣資訊時則可直接從緩衝中擷取

 

緩衝更新流程:

1、更新資料庫

2、使緩衝到期或失效,這樣會促使下次查詢資料時在緩衝中查不到而重新從資料庫去一次。

 

搭建lnmp見http://liang-yao.cnblogs.com/p/8448362.html在redis-server上安裝redis:

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

69 bind 192.168.200.102

92 port 6379

136 daemonize yes          #開啟守護進程

 

啟動服務:

./redis-server redis.conf

ss -ntlu

tcp LISTEN 0 128 192.168.200.102:6379 *:*

./redis-cli -h 192.168.200.102

192.168.200.102:6379> keys *

(empty list or set)

 

 

在lnmp-server上安裝php擴充

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

測試:

systemctl restart php-fpm

lnmp-server下載discuz測試:

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/

 

訪問lnmp-server安裝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地址

 

訪問lnmp-server類比使用者操作:

 

 

./redis-cli -h 192.168.200.102

192.168.200.102:6379> keys *

 

MySQL快取服務器-redis

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.