zoukankan      html  css  js  c++  java
  • redis运维手册

    版本采用:redis-3.2.11.tar.gz
    官网下载地址:https://redis.io/download

    1.redis服务器资源

    redis服务器基础配置CPU2核、内存按需分配,系统磁盘50G,数据盘100G 

    ```
    #1.安装
    cd /usr/local/src
    tar -xf redis-3.2.11.tar.gz -C /usr/local/redis-3.2.11/
    cd /usr/local/redis-3.2.11/
    make
    make install
    ln -s /usr/local/redis-3.2.11/ /usr/local/redis
    mkdir /usr/local/redis/bin
    mkdir /usr/local/redis/data
    cp /usr/local/bin/redis-* /usr/local/redis/bin/
    
    #2.配置更改
    #监听地址
    bind 0.0.0.0 
    #后台启动
    daemonize yes  
    #pid文件
    pidfile /usr/local/redis/redis_6379.pid  
    #日志
    logfile /usr/local/redis/redis.log  
    #数据存放路径
    dir /usr/local/redis/data/  
    #访问密码
    requirepass redis  
    
    #3.授权
    useradd redis -s /sbin/nologin -M
    chown -R redis.redis /usr/local/redis*
    
    #4.启动脚本
    [root@erpdev01 ~]# cat /etc/init.d/redis_6379 
    #!/bin/sh
    #Configurations injected by install_server below....
    
    EXEC=/usr/local/redis/bin/redis-server
    CLIEXEC=/usr/local/redis/bin/redis-cli
    PIDFILE=/usr/local/redis/redis_6379.pid
    CONF="/usr/local/redis/redis.conf"
    REDISPORT="6379"
    ###############
    # SysV Init Information
    # chkconfig: - 58 74
    # description: redis_6379 is the redis daemon.
    ### BEGIN INIT INFO
    # Provides: redis_6379
    # Required-Start: $network $local_fs $remote_fs
    # Required-Stop: $network $local_fs $remote_fs
    # Default-Start: 2 3 4 5
    # Default-Stop: 0 1 6
    # Should-Start: $syslog $named
    # Should-Stop: $syslog $named
    # Short-Description: start and stop redis_6379
    # Description: Redis daemon
    ### END INIT INFO
    
    
    case "$1" in
        start)
            if [ -f $PIDFILE ]
            then
                echo "$PIDFILE exists, process is already running or crashed"
            else
                echo "Starting Redis server..."
                sudo -u redis $EXEC $CONF
            fi
            ;;
        stop)
            if [ ! -f $PIDFILE ]
            then
                echo "$PIDFILE does not exist, process is not running"
            else
                PID=$(cat $PIDFILE)
                echo "Stopping ..."
                $CLIEXEC -p $REDISPORT shutdown
                while [ -x /proc/${PID} ]
                do
                    echo "Waiting for Redis to shutdown ..."
                    sleep 1
                done
                echo "Redis stopped"
            fi
            ;;
        status)
            PID=$(cat $PIDFILE)
            if [ ! -x /proc/${PID} ]
            then
                echo 'Redis is not running'
            else
                echo "Redis is running ($PID)"
            fi
            ;;
        restart)
            $0 stop
            $0 start
            ;;
        *)
            echo "Please use start, stop, restart or status as first argument"
            ;;
    esac
    

      

  • 相关阅读:
    【命令】set命令
    【命令】ln命令
    【命令】htop命令
    【命令】top命令
    【命令】ps命令
    【命令】kill命令
    【命令】pstree命令
    【进程/作业管理】篇章一:Linux进程及其管理(进程管理类工具)----pstree、ps、top、htop、kill、(killall、pkill、pgrep、pidof)
    【进程/作业管理】篇章四:Linux任务计划、周期性任务执行
    【进程/作业管理】篇章二:Linux系统作业控制(jobs)
  • 原文地址:https://www.cnblogs.com/luchuangao/p/11514713.html
Copyright © 2011-2022 走看看