中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

安裝redis(3.2.9)

發布時間:2020-03-31 15:52:23 來源:網絡 閱讀:1064 作者:Innocence_caosm 欄目:數據庫

安裝redis(3.2.9)

1.redis 官網地址:https://redis.io/

2.部署安裝redis3.2.9   實驗環境:centos 6.5

wget http://download.redis.io/releases/redis-3.2.9.tar.gz
yum install automake autoconf ruby rubygems -y #安裝依賴插件
make && make install  #這里使用的是默認安裝

3.創建相對應的目錄


mkdir -p /usr/local/redis/bin/
mkdir /usr/local/redis/ && mkdir -p /data/redis/

4.執行安裝腳本進行安裝

[root@caosm103 utils]# ./install_server.sh 
Welcome to the redis service installer
This script will help you easily set up a running redis server

Please select the redis port for this instance: [6379] 6379
Please select the redis config file name [/etc/redis/redis.conf] /usr/local/redis/redis_6378.conf  
Please select the redis log file name [/var/log/redis_6379.log] /usr/local/redis/redis_6378.log
Please select the data directory for this instance [/var/lib/redis/6379] /data/redis/
Please select the redis executable path [/usr/local/bin/redis-server] /usr/local/redis_6379/bin
Selected config:
Port           : 6379
Config file    : /usr/local/redis/redis.conf
Log file       : /usr/local/redis/redis_6379.log
Data dir       : /data/redis/
Executable     : /usr/local/bin/redis-server
Cli Executable : /usr/local/bin/redis-cli
Is this ok? Then press ENTER to go on or Ctrl-C to abort.

5.服務開啟狀態


[root@caosm103 redis]# redis-server  redis.conf  
#程序 配置文件配置文件這里bind ip 地址改成了本機的ip地址

6.修改啟動腳本


#! /bin/sh
### BEGIN INIT INFO
# Provides:     redis-server
# Required-Start:   $syslog
# Required-Stop:    $syslog
# Should-Start:     $local_fs
# Should-Stop:      $local_fs
# Default-Start:    2 3 4 5
# Default-Stop:     0 1 6
# Short-Description:    redis-server - Persistent key-value db
# Description:      redis-server - Persistent key-value db
### END INIT INFO
### 注意 需要創建 redis 用戶   redis.conf  redis_6379.pid redis_6379.log  /data/redis 所有者要改為redis,并賦予執行權限755  


PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/local/bin/redis-server
DAEMON_ARGS=/usr/local/redis/redis.conf
NAME=redis-server
DESC=redis-server
PIDFILE=/var/run/redis_6379.pid

test -x $DAEMON || exit 0
test -x $DAEMONBOOTSTRAP || exit 0

set -e

case "$1" in
 start)
   echo -n "Starting $DESC: "
   touch $PIDFILE
   chown redis:redis $PIDFILE
   if start-stop-daemon --start --quiet --pidfile $PIDFILE --chuid redis:redis --exec $DAEMON -- $DAEMON_ARGS
   then
     echo "[OK]"
   else
     echo "failed"
   fi
   ;;
 stop)
   echo -n "Stopping $DESC: "
   if start-stop-daemon --stop --retry 10 --quiet --oknodo --pidfile $PIDFILE --exec $DAEMON
   then
     echo "[OK]"
   else
     echo "failed"
   fi
   rm -f $PIDFILE
   ;;
 status)
   if [ ! -r $PIDFILE ] ; then
     echo "redis-server is stopped"
     exit 0
   fi

   PID=`cat $PIDFILE`
   if ps -p $PID | grep -q $PID; then
     echo "redis-server (pid $PID) is running..."
   else
     echo "redis-server dead but pid file exists"
   fi
   ;;
 restart|force-reload)
   ${0} stop
   ${0} start
   ;;
 *)
   echo "Usage: /etc/init.d/$NAME {start|stop|restart|status|force-reload}" >&2
   exit 1
   ;;
esac

exit 0

7.安裝start-stop-daemon


[root@caosm103 src]# wget http://developer.axis.com/download/distribution/apps-sys-utils-start-stop-daemon-IR1_9_18-2.tar.gz
[root@caosm103 src]# tar zxf apps-sys-utils-start-stop-daemon-IR1_9_18-2.tar.gz
[root@caosm103 src]# mv apps/sys-utils/start-stop-daemon-IR1_9_18-2/ ./
[root@caosm103 src]# ls
apps  apps-sys-utils-start-stop-daemon-IR1_9_18-2.tar.gz  nginx-1.8.0  redis-3.2.9  redis-3.2.9.tar.gz  start-stop-daemon-IR1_9_18-2
[root@caosm103 src]# rm -rf apps
[root@caosm103 src]# cd start-stop-daemon-IR1_9_18-2/
[root@caosm103 start-stop-daemon-IR1_9_18-2]# cc start-stop-daemon.c -o start-stop-daemon
[root@caosm103 start-stop-daemon-IR1_9_18-2]# cp start-stop-daemon /usr/local/bin/start-stop-daemon

start-stop-demo 參數介紹
root@caosm103 redis]# start-stop-daemon --help
start-stop-daemon 1.9.18 for Debian - small and fast C version written by
Marek Michalkiewicz <marekm@i17linuxb.ists.pwr.wroc.pl>, public domain.

Usage:
 start-stop-daemon -S|--start options ... -- arguments ...
 start-stop-daemon -K|--stop options ...
 start-stop-daemon -H|--help
 start-stop-daemon -V|--version

Options (at least one of --exec|--pidfile|--user is required):
 -x|--exec <executable>        program to start/check if it is running
 -p|--pidfile <pid-file>       pid file to check
 -c|--chuid <name|uid[:group|gid]>
       change to this user/group before starting process
 -u|--user <username>|<uid>    stop processes owned by this user
 -n|--name <process-name>      stop processes with this name
 -s|--signal <signal>          signal to send (default TERM)
 -a|--startas <pathname>       program to start (default is <executable>)
 -N|--nicelevel <incr>         add incr to the process's nice level
 -b|--background               force the process to detach
 -m|--make-pidfile             create the pidfile before starting
 -R|--retry <schedule>         check whether processes die, and retry
 -t|--test                     test mode, don't do anything
 -o|--oknodo                   exit status 0 (not 1) if nothing done
 -q|--quiet                    be more quiet
 -v|--verbose                  be more verbose
Retry <schedule> is <item>|/<item>/... where <item> is one of
-<signal-num>|[-]<signal-name>  send that signal
<timeout>                       wait that many seconds
forever                         repeat remainder forever
or <schedule> may be just <timeout>, meaning <signal>/<timeout>/KILL/<timeout>

Exit status:  0 = done      1 = nothing done (=> 0 if --oknodo)
             3 = trouble   2 = with --retry, processes wouldn't die

8.啟動測試:


[root@caosm103 redis]# /etc/init.d/redis-server stop
Stopping redis-server: [OK]
[root@caosm103 redis]# /etc/init.d/redis-server start
Starting redis-server: [OK]
[root@caosm103 redis]#
[root@caosm103 redis]# /etc/init.d/redis-server restart
Stopping redis-server: [OK]
Starting redis-server: [OK]
現在都能夠正常進行運行!

9.redis工具介紹

redis-benchmark  性能測試工具
redis-check-aof  日志文件檢測工(比如斷電造成日志損壞,可以檢測并修復)
redis-check-dump  快照文件檢測工具,效果類上
redis-cli  客戶端
redis-server 服務端


向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

江孜县| 安徽省| 阿瓦提县| 博乐市| 富川| 留坝县| 渭南市| 陕西省| 临高县| 涪陵区| 余干县| 呼图壁县| 许昌县| 田阳县| 吉林市| 镇原县| 永康市| 饶平县| 屏东县| 沛县| 远安县| 昭苏县| 乌鲁木齐市| 来安县| 竹溪县| 蚌埠市| 常州市| 阿城市| 安徽省| 合作市| 平南县| 鄱阳县| 泸水县| 田阳县| 南投县| 罗定市| 五峰| 来安县| 昌吉市| 宁海县| 石林|