日本综合一区二区|亚洲中文天堂综合|日韩欧美自拍一区|男女精品天堂一区|欧美自拍第6页亚洲成人精品一区|亚洲黄色天堂一区二区成人|超碰91偷拍第一页|日韩av夜夜嗨中文字幕|久久蜜综合视频官网|精美人妻一区二区三区

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

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
CentOS6.5安裝Redis及開機(jī)啟動(dòng)腳本

一:centos 6.5下載安裝Redis

10余年的曲靖網(wǎng)站建設(shè)經(jīng)驗(yàn),針對設(shè)計(jì)、前端、開發(fā)、售后、文案、推廣等六對一服務(wù),響應(yīng)快,48小時(shí)及時(shí)工作處理。成都全網(wǎng)營銷推廣的優(yōu)勢是能夠根據(jù)用戶設(shè)備顯示端的尺寸不同,自動(dòng)調(diào)整曲靖建站的顯示方式,使網(wǎng)站能夠適用不同顯示終端,在瀏覽器中調(diào)整網(wǎng)站的寬度,無論在任何一種瀏覽器上瀏覽網(wǎng)站,都能展現(xiàn)優(yōu)雅布局與設(shè)計(jì),從而大程度地提升瀏覽體驗(yàn)。成都創(chuàng)新互聯(lián)公司從事“曲靖網(wǎng)站設(shè)計(jì)”,“曲靖網(wǎng)站推廣”以來,每個(gè)客戶項(xiàng)目都認(rèn)真落實(shí)執(zhí)行。

1、下載源碼,解壓縮后編譯源碼

# wget http://download.redis.io/releases/redis-2.8.3.tar.gz
# tar xzf redis-2.8.3.tar.gz
# cd redis-2.8.3
# make

2、進(jìn)入安裝目錄的src文件夾下,有四個(gè)可執(zhí)行文件redis-server、redis-benchmark、redis-cli和redis.conf,復(fù)制到同一個(gè)目錄下

# mkdir /usr/redis
# cp redis-server  /usr/redis
# cp redis-benchmark /usr/redis
# cp redis-cli  /usr/redis
# cp redis.conf  /usr/redis
# cd /usr/redis

3、啟動(dòng)Redis服務(wù)。

# cd /usr/redis
# ./redis-server redis.conf

啟動(dòng)異常:
情況一:
[17496] 08 Oct 11:48:09.153 # Server started, Redis version 2.8.17
[17496] 08 Oct 11:48:09.153 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
[17496] 08 Oct 11:48:09.153 * The server is now ready to accept connections on port 6379

解決辦法:編輯 /etc/sysctl.conf , 添加一項(xiàng) vm.overcommit_memory = 1,重啟生效。

4、客戶端測試。

redis 127.0.0.1:6379>  #顯示此行意味著安裝成功。

二:設(shè)置redis開機(jī)啟動(dòng)

環(huán)境:Linux系統(tǒng)為CentOS 6.6

1.編寫啟動(dòng)腳本

注意:默認(rèn)的redis.conf文件參數(shù)是前臺啟動(dòng)的,修改daemonize no為daemonize yes則為后臺啟動(dòng)。

腳本的編碼格式在Windows上編碼放在Linux可能不識別,可以用UltraEdit轉(zhuǎn)換下格式“文件-->轉(zhuǎn)換-->DOS 轉(zhuǎn) UNIX“

#!/bin/sh
#chkconfig: 345 86 14
#description: Startup and shutdown script for Redis
 
PROGDIR=/usr/redis #安裝路徑
PROGNAME=redis-server
DAEMON=$PROGDIR/$PROGNAME
CONFIG=/usr/redis/redis.conf
PIDFILE=/var/run/redis.pid
DESC="redis daemon"
SCRIPTNAME=/etc/rc.d/init.d/redis
 
start()
{
        if test -x $DAEMON
        then
        echo -e "Starting $DESC: $PROGNAME"
                  if $DAEMON $CONFIG
                  then
                            echo -e "OK"
                  else
                            echo -e "failed"
                  fi
        else
                  echo -e "Couldn't find Redis Server ($DAEMON)"
        fi
}
 
stop()
{
        if test -e $PIDFILE
        then
                  echo -e "Stopping $DESC: $PROGNAME"
                  if kill `cat $PIDFILE`
                  then
                            echo -e "OK"
                  else
                            echo -e "failed"
                  fi
        else
                  echo -e "No Redis Server ($DAEMON) running"
        fi
}
 
restart()
{
    echo -e "Restarting $DESC: $PROGNAME"
    stop
        start
}
 
list()
{
        ps aux | grep $PROGNAME
}
 
case $1 in
        start)
                  start
        ;;
        stop)
        stop
        ;;
        restart)
        restart
        ;;
        list)
        list
        ;;
 
        *)
        echo "Usage: $SCRIPTNAME {start|stop|restart|list}" >&2
        exit 1
        ;;
esac
exit 0

把redis腳本文件放在 /etc/rc.d/init.d/ 目錄下

2、增加服務(wù)并開機(jī)啟動(dòng)

# chmod +x /etc/rc.d/init.d/redis
# chkconfig --add redis
# chkconfig --level 345 redis on
# chkconfig --list redis

3、重啟測試。


分享名稱:CentOS6.5安裝Redis及開機(jī)啟動(dòng)腳本
當(dāng)前路徑:http://www.dlmjj.cn/article/cdodjcp.html