Installation and configuration startup of Redis under Linux

Source: Internet
Author: User
Tags benchmark redis server

installation and Configuration startup of Redis under LinuxTags: redisnosql2014-10-24 14:04 19732 People read comments (0) favorite reports Classification:Data and performance ( in a)wget http://download.redis.io/releases/redis-2.8.6.tar.gz
Tar xzf redis-2.8.6.tar.gz
CD redis-2.8.6
Make

Yes, make will get an error.

GCC class errors are required to install GCC

Such as:

Yum install-y gcc g++ gcc-c++ make

此类错误

zmalloc.h:50:31: error: jemalloc/jemalloc.h: No such file or directory zmalloc.h:55:2: error: #error "Newer version of jemalloc required" make[1]: *** [adlist.o] Error 1 make[1]: Leaving directory `/data0/src/redis-2.6.2/src‘ make: *** [all] Error 2

The solution is:

Make MALLOC=LIBC

zmalloc.o:in function ' zmalloc_used_memory ':
/usr/local/src/redis-2.8.3/src/zmalloc.c:223:undefined reference to ' __sync_add_and_fetch_4 '
COLLECT2:LD return 1
MAKE[1]: * * [Redis-server] Error 1
MAKE[1]: Leaving directory '/USR/LOCAL/SRC/REDIS-2.8.3/SRC '
Make: * * * [ALL] Error 2


Add a parameter after make

Make cflags= "-march=i686"

2. After compiling, in the./src directory, there are three executables redis-server, Redis-benchmark, Redis-cli, and./redis.conf and then copied to a directory.

Mkdir/usr/redis
CP Redis-server/usr/redis
CP Redis-benchmark/usr/redis
CP Redis-cli/usr/redis
CP Redis.conf/usr/redis
Cd/usr/redis
3. Start Redis service.


Redis-server redis.conf
4, then use the client to test whether to start successfully.


Redis-cli
Redis> set Foo Bar
Ok
Redis> get foo
"Bar"

---------------------------------------------------------------------------------------------------------
Then make a self-made Redis startup script for easy management
1, VIM/ETC/RC.D/INIT.D/REDISD


#!/bin/sh
#chkconfig: 345 86 14
#description: Startup and shutdown script for Redis

Progdir=/usr/redis #安装路径
Progname=redis-server
daemon= $PROGDIR/$PROGNAME
Config=/usr/redis.conf
Pidfile=/var/run/redis.pid
desc= "Redis Daemon"
Scriptname=/etc/rc.d/init.d/redisd

Start ()
{
If Test-x $DAEMON
Then
Echo-e "Starting $DESC: $PROGNAME"
If $DAEMON $CONFIG
Then
Echo-e "OK"
Else
Echo-e "Failed"
Fi
Else
Echo-e "couldn ' t find Redis Server ($DAEMON)"
Fi
}

Stop ()
{
If Test-e $PIDFILE
Then
Echo-e "Stopping $DESC: $PROGNAME"
If kill ' cat $PIDFILE '
Then
Echo-e "OK"
Else
Echo-e "Failed"
Fi
Else
Echo-e "No Redis Server ($DAEMON) Running"
Fi
}

Restart ()
{
Echo-e "Restarting $DESC: $PROGNAME"
Stop
Start
}

List ()
{
PS aux | grep $PROGNAME
}

Case $ in
Start
Start
;;
Stop
Stop
;;
Restart
Restart
;;
List
List
;;

*)
echo "Usage: $SCRIPTNAME {start|stop|restart|list}" >&2
Exit 1
;;
Esac
Exit 0


2. Increase the service and start the boot
CP./REDISD/ETC/RC.D/INIT.D/REDISD
chmod +X/ETC/RC.D/INIT.D/REDISD
Chkconfig--add REDISD
Chkconfig--level 345 REDISD on
Chkconfig--list REDISD
After executing the script, you can start start|stop|restart|list your service.



Tips:

The default redis.conf file parameter is the foreground startup, and the Modify Daemonize No to daemonize Yes is the background boot.

Add: This is the first installation of the method used, and later found that someone used the method better and simpler, and another reprint click Open link

Installation and configuration startup of 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.