十二月 17, 2015 | 後端和Drupal

drupal安裝redis

快速安裝方式 sudo apt-get install software-properties-common python-software-properties sudo add-apt-repository ppa:chris-lea/redis-server sudo apt-get update sudo apt-get install redis-server 啟動關閉 redis-server start  啟動 redis-server stop  關閉 redis-server restart 重新啟動 移除 sudo apt-get remove redis-server 關於drupal上使用請看步驟7   手動安裝方式

快速安裝方式

sudo apt-get install software-properties-common python-software-properties
sudo add-apt-repository ppa:chris-lea/redis-server
sudo apt-get update
sudo apt-get install redis-server

啟動關閉

  • redis-server start  啟動
  • redis-server stop  關閉
  • redis-server restart 重新啟動

移除

sudo apt-get remove redis-server

關於drupal上使用請看步驟7   手動安裝方式

  1. 安裝編譯工具
sudo apt-get install build-essential
sudo apt-get install tcl8.5
  1. 下載與編譯
cd /root/
wget http://download.redis.io/releases/redis-2.8.6.tar.gz  (也有最近redis 3.0.0的版本,安裝方式是一樣的)
tar xvf redis-2.8.6.tar.gz
cd redis-2.8.6
#檢查
ls -tlr
  1. 編譯測試
make test
  1. 安裝redis
make install
  1. 啟動ununtu設定
cd utils/
sudo ./install_server.sh 

依照他給的預設就行   6. 複製文件至/etc/init.d/ 使ubuntu可以直接用指令service 啟用redis

mkdir /etc/redis
cd /root/redis-2.8.6
cp redis.conf /etc/redis/6379.conf 
cd /root/redis-2.8.6/utils/
cp redis_init_script /etc/init.d/redisd

# 測試
service redisd stop
service redisd start
  1. drupal的配置   predis庫 https://github.com/nrk/predis

  2. 下載predis 庫到drupal的 sites/all/libraries/

cd sites/all/libraries/
git clone https://github.com/nrk/predis.git

  9. 下載並啟用drupal redis模組

https://www.drupal.org/project/redis
drush dl redis
drush en redis
  1. 在settings.php 給設定
$conf['redis_client_interface'] = 'Predis';
$conf['redis_client_host'] = '127.0.0.1';
$conf['lock_inc'] = 'sites/all/modules/redis/redis.lock.inc';
$conf['cache_backends'][] = 'sites/all/modules/redis/redis.autoload.inc';
$conf['cache_default_class'] = 'Redis_Cache';

 

資料來源

http://www.darrenmothersele.com/blog/2014/02/25/drupal-redis/http://sarc.io/index.php/nosql/156-redis-3-0-0-beta-3http://www.ithome.com.tw/news/96023

hashtags:

使用我們的服務即表示您同意Cookie政策。了解更多