Linux Redis Installation and configuration startup __linux

Source: Internet
Author: User
Tags benchmark redis redis server
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 makes an error.

GCC class errors are required to install GCC

Such as:

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

This type of error

Zmalloc.h:50:31:error:jemalloc/jemalloc.h:no such file or directory Zmalloc.h:55:2: Error: #error "newer version of Jem Alloc required "make[1]: * * * [ADLIST.O] Error 1 make[1]: Leaving directory '/DATA0/SRC/REDIS-2.6.2/SRC ' make: * * * [ALL] Er Ror 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


Make a parameter after

Make cflags= "-march=i686"


2, after compiling, in the./src directory, there are three executable files 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, and then use the client test whether to start successfully.


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

---------------------------------------------------------------------------------------------------------
and make a redis. Startup scripts Facilitate 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 is in
Start
Start
;;
Stop
Stop
;;
Restart)
Restart
;;
List
List
;;

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


2, increase service and 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 you execute the script, you can start start|stop|restart|list your service.



Tips:

The default redis.conf file parameter is started by the foreground, and modifying Daemonize No to daemonize Yes is started in the background.


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

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.