1. XenForo 1.5.14 中文版——支持中文搜索!现已发布!查看详情
  2. Xenforo 爱好者讨论群:215909318 XenForo专区

centos7 编译 redis

本帖由 admin2016-02-25 发布。版面名称:应用交流

  1. admin

    admin 管理员 管理成员

    注册:
    2011-11-01
    帖子:
    3,662
    赞:
    2,422
    下载安装编译:
    代码:
    wget http://download.redis.io/releases/redis-stable.tar.gz
    tar xzf redis-stable.tar.gz
    cd redis-stable
    make
    make install
    设置配置文件路径:
    代码:
    mkdir -p /usr/local/redis/bin  #命令目录
    mkdir -p /usr/local/redis/etc  #配置文件目录
    mv ./redis.conf /usr/local/redis/etc/
    cd src
    mv   mkreleasehdr.sh   redis-benchmark   redis-check-aof  redis-check-rdb  redis-cli  redis-sentinel  redis-server redis-trib.rb  /usr/local/redis/bin/
    修改配置文件:
    # vim /usr/local/redis/etc/redis.conf
    修改为: daemonize yes

    最后将其注册为系统服务
    在/etc/init.d/目录下建立redis 文件
    vim /etc/init.d/redis
    代码:
    ###########################
    #!/bin/sh
    #chkconfig: 2345 10  90
    #description:auto_run
    PATH=/usr/local/bin:/sbin:/usr/bin:/bin
    
    REDISPORT=6379
    EXEC=/usr/local/redis/bin/redis-server
    REDIS_CLI=/usr/local/redis/bin/redis-cli
    
    PIDFILE=/var/run/redis_${REDISPORT}.pid
    CONF="/usr/local/redis/etc/redis.conf"
    
    case "$1" in
        start)
            if [ -f $PIDFILE ]
            then
                    echo "$PIDFILE exists, process is already running or crashed"
            else
                    echo "Starting Redis server..."
                    $EXEC $CONF
            fi
            if [ "$?"="0" ]
            then
                  echo "Redis is running..."
            fi
            ;;
        stop)
            if [ ! -f $PIDFILE ]
            then
                    echo "$PIDFILE does not exist, process is not running"
            else
                    PID=$(cat $PIDFILE)
                    echo "Stopping ..."
                    $REDIS_CLI -p $REDISPORT SHUTDOWN
                    while [ -x ${PIDFILE} ]
                   do
                        echo "Waiting for Redis to shutdown ..."
                        sleep 1
                    done
                    echo "Redis stopped"
            fi
            ;;
       restart|force-reload)
            ${0} stop
            ${0} start
            ;;
      *)
        echo "Usage: /etc/init.d/redis {start|stop|restart|force-reload}" >&2
            exit 1
    esac
    ###########################
    设置权限
    chmod +x /etc/init.d/redis
    设置自动启动:
    chkconfig redis on
    启动Redis:
    # /usr/local/bin/redis-server /usr/local/redis/etc/redis.conf
    #关闭服务
    redis-cli shutdown
    或者在cli中执行shutdown
    redis 127.0.0.1:6379> shutdown
    清除缓存
    redis-cli flushall
    查看状态 :
    # ps -ef | grep redis

    下面介绍为PHP添加redis插件

    从官网下载最新的拓展,地址:http://pecl.php.net/package/redis或者https://github.com/phpredis/phpredis
    代码:
    wget http://pecl.php.net/get/redis-4.0.1.tgz
    tar xzf redis-4.0.1.tgz
    cd redis-4.0.1
    /usr/local/php/bin/phpize
    ./configure --prefix=/usr/local/redis/ --enable-redis --with-php-config=/usr/local/php/bin/php-config
    #make && make install
    把拓展添加至php.ini,重启php
    代码:
    extension=redis.so
    
    session.save_handler = redis
    session.save_path = "tcp://localhost:6379"
     
    最后编辑: 2018-04-24
  2. Audrey

    Audrey 入门会员

    注册:
    2018-11-06
    帖子:
    2
    赞:
    0
    what is a transformer?
    Transformer is also a kind of inductance component. It is a component made of electromagnetic induction principle of inductor.
    In the circuit, it is represented by the letter "work". The transformer is made use of secondary (primary) and two (secondary) winding loops.
    The number (turns) ratio is different to change the voltage ratio or current ratio, so as to realize the transmission and distribution of electric energy or signal. Figure 3-3
    The principle of the transformer is shown.

    Question 8. how can the transformer be classified?
    The transformer can be classified according to its working frequency, usage and core switch.
    According to the working frequency, it can be divided into high frequency transformer, intermediate frequency transformer and low frequency transformer, and can be divided into power transformer (including power transformer), audio transformer, pulse transformer, constant voltage transformer, coupling transformer, autotransformer, boost transformer, isolation transformer, transmission transformer, output transformer and so on. A variety of; according to the core (Ci Xin) form, it can be divided into "EI" shaped transformer (or "E" shaped transformer), "C" deformed musical instrument and hill shaped voltage regulator.

    Q9. What are the main functions of the transformer? 1 buck or boost, a large number of applications is the AC mains buck, this transformer is called the power transformer. 2 signal coupling, in the process of signal coupling can be boosted or step-down, in order to obtain the appropriate output signal. 3 impedance transformation, in many cases require circuit impedance matching, at this time can use the transformer to complete.

    This article is from ALLICDATA ELECTRONICS LIMITED.
     
正在加载...