日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
Redis--------基于centos6源碼安裝

【引自asd1123509133的博客】1. 背景

前一章介紹了memecached安裝,此次介紹NoSQL另一款明星產(chǎn)品----->redis.

許多Web 應(yīng)用程序都將數(shù)據(jù)保存到RDBMS中,應(yīng)用服務(wù)器從中讀取數(shù)據(jù)并在瀏覽器中顯示。但隨著數(shù)據(jù)量的增大,訪問的集中,就會出現(xiàn)REBMS的負擔(dān)加重,數(shù)據(jù)庫響應(yīng)惡化,網(wǎng)站顯示延遲等重大影響。Memcached是高性能的分布式內(nèi)存緩存服務(wù)器。一般的使用目的是通過緩存數(shù)據(jù)庫查詢結(jié)果,減少數(shù)據(jù)庫的訪問次數(shù),以提高動態(tài)Web 應(yīng)用的速度、提高擴展性.

* redis比memcached優(yōu)勢

  • 豐富的數(shù)據(jù)類型: redis支持二進制的string list hashe set zset五大基礎(chǔ)數(shù)據(jù)類型存儲.
  • 原子性:redis的所有操作都是原子性的,同時redis還支持對幾個操作全并后的原子性執(zhí)行.
  • 消息訂閱: redis支持publish/subscribe。
  • 持久化存儲數(shù)據(jù): redis支持Aof與RDB兩種數(shù)據(jù)持久化支持.

2. 環(huán)境

3 安裝(/usr/local/src)

  • 下載: wget http://download.redis.io/releases/redis-3.2.8.tar.gz
  • 解壓: tar zxvf redis-3.2.8.tar.gz
  • 進入目錄: cd redis-3.2.8
  • 編譯并指定安裝目錄: make PREFIX=/usr/local/redis-3.2.8 install
  • 創(chuàng)建軟鏈接: ln -s /usr/local/redis-3.2.8 /usr/local/redis

4. 配置文件(當前還在redis源碼目錄[/usr/local/src/redis-3.2.8]內(nèi))

cp redis.conf /etc/redis.conf

編輯/etc/redis.conf

daemonize no ==> daemonize yes (設(shè)置redis為后臺daemon進程)

5. 創(chuàng)建redis用戶

 
 
 
 
  1. [root@redis-server ~]# useradd -r -s /sbin/nologin -M redis

6. 創(chuàng)建啟動腳本/etc/init.d/redis

 
 
 
 
  1. #!/bin/sh
  2. #
  3. # redis        init file for starting up the redis daemon
  4. #
  5. # chkconfig:   - 20 80
  6. # description: Starts and stops the redis daemon.
  7.  
  8. # Source function library.
  9. #!/bin/sh
  10. #
  11. # redis        init file for starting up the redis daemon
  12. #
  13. # chkconfig:   - 20 80
  14. # description: Starts and stops the redis daemon.
  15.  
  16. # Source function library.
  17. . /etc/rc.d/init.d/functions
  18.  
  19. name="redis-server"
  20. exec="/usr/local/redis/bin/$name"
  21. pidfile="/var/run/redis/redis.pid"
  22. REDIS_CONFIG="/etc/redis.conf"
  23.  
  24. [ -e /etc/sysconfig/redis ] && . /etc/sysconfig/redis
  25.  
  26. lockfile=/var/lock/subsys/redis
  27.  
  28. start() {
  29.     [ -f $REDIS_CONFIG ] || exit 6
  30.     [ -x $exec ] || exit 5
  31.     echo -n $"Starting $name: "
  32.     daemon --user ${REDIS_USER-redis} "$exec $REDIS_CONFIG"
  33.     retval=$?
  34.     echo
  35.     [ $retval -eq 0 ] && touch $lockfile
  36.     return $retval
  37. }
  38.  
  39. stop() {
  40.     echo -n $"Stopping $name: "
  41.     killproc -p $pidfile $name
  42.     retval=$?
  43.     echo
  44.     [ $retval -eq 0 ] && rm -f $lockfile
  45.     return $retval
  46. }
  47.  
  48. restart() {
  49.     stop
  50.     start
  51. }
  52.  
  53. reload() {
  54.     false
  55. }
  56.  
  57. rh_status() {
  58.     status -p $pidfile $name
  59. }
  60.  
  61. rh_status_q() {
  62.     rh_status >/dev/null 2>&1
  63. }
  64.  
  65.  
  66. case "$1" in
  67.     start)
  68.         rh_status_q && exit 0
  69.         $1
  70.         ;;
  71.     stop)
  72.         rh_status_q || exit 0
  73.         $1
  74.         ;;
  75.     restart)
  76.         $1
  77.         ;;
  78.     reload)
  79.         rh_status_q || exit 7
  80.         $1
  81.         ;;
  82.     force-reload)
  83.         force_reload
  84.         ;;
  85.     status)
  86.         rh_status
  87.         ;;
  88.     condrestart|try-restart)
  89.         rh_status_q || exit 0
  90.         restart
  91.         ;;
  92.     *)
  93.         echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart}"
  94.         exit 2
  95. esac
  96. exit $?

7. 修改腳本文件權(quán)限

 
 
 
 
  1. [root@redis-server ~]# chmod 755 /etc/init.d/redis

8. 添加進service服務(wù)管理并設(shè)置開機啟動

 
 
 
 
  1. [root@redis-server ~]# chkconfig --add redis
  2. [root@redis-server ~]# chkconfig redis on 

9. redis服務(wù)測試

 
 
 
 
  1. service redis start 

10. 連接測試(通過自帶redis-cli命令連接測試)

 
 
 
 
  1. [root@redis-server ~]# /usr/local/redis/bin/redis-cli -h 127.0.0.1 -p 6379 

連接測試成功

11. 總結(jié)

以需求驅(qū)動技術(shù),技術(shù)本身沒有優(yōu)略之分,只有業(yè)務(wù)之分。


標題名稱:Redis--------基于centos6源碼安裝
分享鏈接:http://www.5511xx.com/article/dpogohd.html