Detailed procedures for installing Redis under Linux

Source: Internet
Author: User
Tags redis version redis server

Install some components first:

Yum Install GCC gcc-c++ libstdc++-devel

Download and install:

wget http://download.redis.io/releases/redis-2.8.19.tar.gztar xzf redis-  2.8. . Tar . gz# CD Redis-2.8.  +  make makeinstall

If there is an error message:

Error 1:

[Email protected] redis-2.8. +]# Make&& Make InstallCD src&& Make All Make[1]: Entering directory '/data/software/redis-2.8. +/src'CC Adlist.oinfileIncluded from Adlist.c: the: zmalloc.h: -: to: Error:jemalloc/jemalloc.h:no Suchfileor directoryzmalloc.h: -:2: Error:#error"Newer version of Jemalloc required" Make[1]: * * * [ADLIST.O] Error1 Make[1]: Leaving directory '/data/software/redis-2.8. +/src' Make: * * * [ALL] Error2

Workaround:

 Make malloc=make makeinstall

Error 2:

[3116] +Jan the: +:46.366# Server started, Redis version2.8.19
[3116] Jan: 46.366 #WARNING overcommit_memory is Set to 0! Background save may fail under low memory condition. To fix the issue add 'vm.overcommit_memory = 1' to/etc/sysctl.conf and then Rebo OT or run the command 'sysctl vm.overcommit_memory=1' for that take effect .

Follow the prompts to edit the/etc/sysctl.conf file and add the following at the bottom of the file:
Vm.overcommit_memory = 1

Then execute the/sbin/sysctl vm.overcommit_memory=1 to make it effective.

You can use/sbin/sysctl-p to see if the add succeeds!

Error 3:

[3590] +Jan the: -:14.324# Server started, Redis version2.8. +[3590] +Jan the: -:14.324# warning:the TCP Backlog setting of511Cannot be enforced because/proc/sys/net/core/somaxconn are set to the lower value of -. [3590] +Jan the: -:14.324* DB loaded from disk:0.000seconds[3590] +Jan the: -:14.324* The server is now a ready-to-accept connections on port6379

Limits the size of the listening queue to receive new TCP connections. The default of 128 is too small for a high-load Web service environment that often handles new connections. Most environments this value is recommended to increase to 1024 or more.
The service process itself limits the size of the listening queue (for example, SendMail (8) or Apache), and often has the option to set the queue size in their configuration file. A large listening queue can also help prevent denial-of-service DoS attacks.
We can modify this parameter by.

Workaround:

Echo  >/proc/sys/net/core/somaxconn

Error 4:

[3234] .May Geneva: $:22.059# Server started, Redis version2.8. +[3234] .May Geneva: $:22.059# WARNING You has Transparent Huge Pages (THP) Support enabledinchYour kernel. This would create latency 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.localinchorder to retain the setting after a reboot. Redis must be restarted after THP is disabled. [3234] .May Geneva: $:22.059* DB loaded from disk:0.000seconds[3234] .May Geneva: $:22.059* The server is now a ready-to-accept connections on port6379

Workaround:

echo never >/sys/kernel/mm/transparent_hugepage/enabled

To start Redis:

# redis-server/data/redis/redis.conf

Test settings:

# redis-CLI127.0. 0.1:6379> set name Redisdevok127.0. 0.1:6379> get name"redisdev"

To turn off Redis:

# REDIS-CLI Shutdown

Join the service and boot from the boot:

# Vim/etc/init.d/redis

Add the following script:

# Chkconfig:2345  - Ten# Description:service of Redis forstart and stop add by Tomenerpath=/usr/local/bin:/sbin:/usr/bin:/Binredisport=6379EXEC=/usr/local/bin/redis-serverredis_cli=/usr/local/bin/redis-Clipidfile=/var/run/redis.pidconf="/data/redis/redis.conf"AUTH="1234" Case " $" inchstart)if[ -F $PIDFILE] Then                        Echo "$PIDFILE exists, process is already running or crashed."                Else                        Echo "starting Redis Server ..."$EXEC $CONFfi                if["$?"="0" ]                 Then                        Echo "Redis is running ..."                fi                ;; Stop)if[ ! -F $PIDFILE] Then                        Echo "$PIDFILE exists, process is not running."                ElsePID=$(Cat$PIDFILE)Echo "stopping ..."$REDIS _cli-P $REDISPORT SHUTDOWNSleep 2                        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}">&2Exit1Esac
chmod 0755 /etc/init.d//etc/init.d/--235  Redis on

#使用该命令能愉快的玩耍了 # service Redis start|stop|restart

To this installation is complete. Then you will definitely use the command , with a detailed command encyclopedia . I also take reference, prevent long time forget.

Http://www.cnblogs.com/xsi640/p/3755133.html

Detailed procedures for installing Redis under Linux

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.