Installing Redis under Linux

Source: Internet
Author: User
Tags download redis redis server

Record the installation steps under Linux, or the more complex

1. Download redis-2.8.19.tar.gz:

FTP upload to linux01;

Extract:

TAR–ZXVF redis-2.8.19.tar.gz

     

2. Install related software

Command: Yum install wget make gcc gcc-c++

3. After the installation in the redis-2.8.19 directory src make, the following error should occur

    

Cause analysis

      

There is this passage in the README.

allocator  
--------- 
 
Selecting a non-default memory allocator when building Redis is do by setting 
The ' MALLOC ' environment variable. Redis is compiled and linked against libc 
malloc by default, with the exception of Jemalloc the default on linux 
Systems. This default is picked because Jemalloc has proven to having fewer 
fragmentation problems than libc malloc.  
 
to force compiling against libc malloc, use:  
 
    percent make MALLOC=LIBC &nbs P
 
to compile against Jemalloc in Mac OS X systems, use:  
 
   % make Malloc=j Emalloc


Said about the allocator allocator, if there is MALLOC this environment variable, it will be useful for this environment variable to establish Redis.

And libc is not the default allocator, the default is Jemalloc, because Jemalloc is proven to have fewer fragmentation problems than libc.

But if you don't have a jemalloc and only libc of course make a mistake. So add such a parameter.

Solutions

Make MALLOC=LIBC

Continue in Src,make

Possible error:

Continue to resolve:

1, Jemalloc may want to run first./configure, then make ( I didn't run this step, there might be a need for this step, depending on the situation)

2, respectively into the Redis under the Deps under the Hiredis, Lua run make

3. Go back to the SRC directory to run make make test

The following error may occur:

    

Workaround:

Install TCL command: yum-y install TCL

  

4. Continue to Redis directory Src under make and make test

    

5. Use the Redis command line:

redis/src directory: make install and make test

, enter the/usr/local/bin/directory to view LS, appeared, installed successfully!

6. Configure the Startup service

  1), edit redis.conf file

Command: VI redis.conf

2), modify Daemonize no change to Yes.

  

3), we manually copy the redis.conf to/etc directory

Command: CP redis.conf/etc

4). Enter the/ETC/INIT.D directory to create the REDISD file and paste in the following content

Vim REDISD

    

########################### #chkconfig:2345 Ten  -#description: Start and Stop Redispath=/usr/local/bin:/sbin:/usr/bin:/bin Redisport=6379EXEC=/usr/local/bin/redis-serverredis_cli=/usr/local/bin/redis-CLI Pidfile=/var/run/redis.pidconf="/etc/redis.conf"    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 does not exist, process was not running"        ElsePID=$(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}">&2Exit1Esac##############################

Modify permissions, you can run

Command: chmod +x/etc/init.d/redis//u can omit

Set up start-up service automatically

Command: Chkconfig REDISD on//open from Start

Service Redis start//start

Service Redis stop//Shutdown services

  

To this configure Redis under Linux is basically complete, the extranet connection needs to shut down the firewall

 Test Redis

    

service Redis start    Test command: •    redis10000     sends 100,000 requests to the Redis server, 60 concurrent clients per request

  

  Client connections

  In the SRC directory of the Redis unzip directory./redis–cli–p 6379 | ./REDIS-CLI (Enter the default Redis client)

      

OK, finish!

  

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.