Installing using Redis

Source: Internet
Author: User

The latest version of Redis is 2.8.19

Cd/data/app_software/

wget http://download.redis.io/releases/redis-2.8.19.tar.gz

Tar zxvf redis-2.8.19.tar.gz

Make

Mkdir-p/data/app_platform/redis/{bin,conf}

CP src/redis-server/data/app_platform/redis/bin/

CP src/redis-cli/data/app_platform/redis/bin/

CP src/redis-benchmark/data/app_platform/redis/bin/

CP src/redis-check-dump/data/app_platform/redis/bin/

CP src/redis-check-aof/data/app_platform/redis/bin/

CP redis.conf/data/app_platform/redis/conf/


Modify the/data/app_platform/redis/conf/redis.conf configuration, configure the configuration according to their needs

Newly added configuration in Redis 2.8

# tcp listen ()  backlog.## In high  requests-per-second environments you need an high backlog in order#  to avoid slow clients connections issues. Note that the  linux kernel# will silently truncate it to the value of / Proc/sys/net/core/somaxconn so# make sure to raise both the value  of somaxconn and tcp_max_syn_backlog# in order to get the  desired effect.tcp-backlog 511 
$ grep -e -v  ' ^#|^$ '  /data/app_platform/redis/conf/redis.conf daemonize  Yespidfile /var/run/redis.pidport 6379tcp-backlog 511timeout 0tcp-keepalive 0loglevel  noticelogfile /data/app_data/redis/logs/redis.logdatabases 16save 900 1save 300  10save 60 10000stop-writes-on-bgsave-error yesrdbcompression yesrdbchecksum  yesdbfilename dump.rdbdir /data/app_data/redis/data slave-serve-stale-data  Yesslave-read-only yesrepl-diskless-sync norepl-diskless-sync-delay 5repl-disable-tcp-nodelay  noslave-priority 100appendonly noappendfilename  "Appendonly.aof" appendfsync  everysecno-appendfsync-on-rewrite noauto-aof-rewrite-percentage 100auto-aof-rewrite-min-size  64mbaof-load-truncated yeslua-time-limit 5000slowlog-log-slower-than 10000slowlog-max-len  128latency-monitor-threshold 0notify-keyspace-events  "" Hash-max-ziplist-entries 512hash-max-ziplist-value 64list-max-ziplist-entries  512list-max-ziplist-value 64set-max-intset-entries 512zset-max-ziplist-entries  128zset-max-ziplist-value 64hll-sparse-max-bytes 3000activerehashing  yesclient-output-buffer-limit normal 0 0 0client-output-buffer-limit slave 256mb  64mb 60client-output-buffer-limit pubsub 32mb 8mb 60hz  10aof-rewrite-incremental-fsync yes


Add startup File/etc/init.d/redis

#!/bin/bash## redis - this script starts and stops the  redis-server daemon## chkconfig:   - 80 12# description:   redis is a persistent key-value database# processname: redis-server#  config:      /etc/redis/redis.conf# pidfile:     / Var/run/redis.pidsource /etc/init.d/functionsbin= "/data/app_platform/redis/bin" CONFIG= "/data/app_platform /redis/conf/redis.conf "pidfile="/var/run/redis.pid "### read configuration[ -r " $SYSCONFIG "  ] && source  "$SYSCONFIG" retval=0prog= "Redis-server" desc= "Redis server" Start ( )  {        if [ -e  $PIDFILE  ];then              echo  "$desc  already  Running .... "             exit 1         fi        echo -n $ "Starting  $desc: "         daemon  $BIN/$prog   $CONFIG          RETVAL=$?        echo         [  $RETVAL  -eq 0 ] && touch /var/lock/subsys /$prog         return  $RETVAL}stop ()  {         echo -n $ "stop  $desc: "          killproc  $prog         RETVAL=$?         echo        [  $RETVAL  -eq  0 ] && rm -f /var/lock/subsys/$prog   $PIDFILE         return   $RETVAL}restart ()  {    stop    start}case  "$"  in   start)         start         ;;   stop)         stop         ;;   restart)         restart         ;;   condrestart)         [ -e /var/lock/subsys/$prog  ] && restart        RETVAL=$?         ;;   status)         status  $prog          RETVAL=$?        ;;    *)         echo $ "Usage: $0 {start| Stop|restart|condrestart|status} "        RETVAL=1esacexit  $RETVAL


View the next log after starting Redis

Chkconfig--level Redis on

Service Redis Start



cat  /data/app_data/redis/logs/redis.log [16854] 24 jan 22:31:27.113 *  Increased maximum number of open files to 10032  (It was  originally set to 1024) .                 _._                                                                _.-' __  '-._                                                      _.-'      ' .   ' _.   '-._            Redis 2.8.19  (00000000/0)  64  bit  .-'  .-' .   ' \/    _.,_  '-._                                       (      '       ,       .-'   |   ',    )      running in stand alone mode  | '-._ '-...-'  __...-. '-._| ' '  _.-' |     port: 6379 |     '-._    '. _    /     _.-'     | &Nbsp;   pid: 16854   '-._     '-._   '-./  _ .-'     _.-'                                       | '-._ '-._     '-.__.-'     _.-' _.-' |                                     |      '-._ '-._        _.-' _.-'     |            http://redis.io            '-._     '-._ '-.__.-' _.-'     _.-'                                       | '-._ '-._      '-.__.-'     _.-' _.-' |                                     |     '-._ '-._         _.-' _.-'     |                                       '-._     '-._ '-.__.-' _.-'      _.-'                                             '-._     '-.__.-'     _.-'                                                      '-._        _.-'                                                               '-.__.-'                                                  [16854] 24 Jan 22:31:27.114 #  server started, redis version 2.8.19[16854] 24 jan 22:31:27.114 #  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. [16854] 24 jan 22:31:27.114 # warning you have transparent huge  Pages  (THP)  support enabled in your kernel. This will  Create latency&nbSp;and memory usage issues with redis. to fix this issue run  the command  ' echo never > /sys/kernel/mm/transparent_hugepage/enabled '   as root, and add it to your /etc/rc.local in order to  retain the setting after a reboot. redis must be restarted  After thp is disabled. [16854] 24 jan 22:31:27.114 # warning: the tcp backlog setting  of 511 cannot be enforced because /proc/sys/net/core/somaxconn is  set to the lower value of 128. [16854] 24 jan 22:31:27.115 * the server is now ready to  accept connections on port 6379


Adjust system configuration based on log prompts

echo "vm.overcommit_memory = 1" >>/etc/sysctl.conf; sysctl-p

echo never >/sys/kernel/mm/transparent_hugepage/enabled and adding this line to the/etc/rc.local will still take effect after the host restarts


echo "Net.core.somaxconn = 2048" >>/etc/sysctl.conf;sysctl-p


And then restart Redis



This article is from the Linux SA John blog, so be sure to keep this source http://john88wang.blog.51cto.com/2165294/1607834

Installing using Redis

Related Article

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.