PHP Installation Configuration

Source: Internet
Author: User
Tags redis server

Content

0. Order

1. How to install?

2. Configuration parameters and their significance

3. Set as Linux service

0. Order

This article mainly records the installation configuration of Redis under CentOS. If not specifically stated in this article. Represents the redis-3.2.10 code directory.

1. How to Install

123456789101112

2. configuration parameters and their significance

Modifying a configuration file vi/usr/local/redis/etc/redis.conf

123456789101112131415161718192021222324252627282930 #是否只允许本机客户端连接,这样可以避免将redis服务暴露于危险的网络环境中bind 127.0.0.1#是否以守护进程方式运行daemonize yes#pid文件位置pidfile /usr/local/redis/var/run/redis_6379.pid#监听端口port 6379#请求超时时间timeout 0#是否为长连接,非 0时为长连接tcp-keepalive 300#log信息级别loglevel notice#log位置 logfile /usr/local/redis/log/redis.log#开启数据的数量databases 16#保存快照的频率,第一个*表示多长时间,第三个*表示执行多少次写操作。在一定时间内执行一定数量的写操作时,自动保存快照。可设置多个条件save * *#是否使用压缩rdbcompression yes#数据快照文件名(只是文件名,不包括目录)dbfilename dump.rdb#数据快照保存目录 dir /usr/local/redis/data/#是否开启appendonlylog,开启的话每次写操作会记一条log,这会提高数据抗风险能力,但影响效率。appendonly no#如何同步到磁盘(三个选项,分别是每次写都强制调用fsync、每秒启用一次fsync、不调用fsync等待系统自己同步)appendfsync everysec

3. Set as Linux service

Copy the Redis service script file to the/ETC/RC.D/INIT.D directory;

1 $ cp./utils/redis_init_script/etc/rc.d/init.d/redis

Modify the Redis service script, Vi/etc/rc.d/init.d/redis; modified/etc/rc.d/redis as follows:

12345678910111213141516171819202122232425262728293031323334353637383940414243 #!/bin/sh  # chkconfig: 2345 80 90  # Simple Redis init.d script conceived to work on Linux systems  # as it does use of the /proc filesystem.    REDISPORT=6379  EXEC=/usr/local/redis/bin/redis-serverCLIEXEC=/usr/local/redis/bin/redis-cli  PIDFILE=/usr/local/redis/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        ;;      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                 done                echo "Redis stopped"        fi        ;;      *)          echo "Please use start or stop as first argument"        ;;  esac

Add the/etc/rc.d/init.d/redis script to the service with the following command:

1 $ chkconfig -add redis

Set boot up

1 $ chkconfig redis on

PHP Installation Configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.