Construction of single-server availability redis 1- Construction

First upload redis-3.2.8.tar.gz, tcl8.6.1-src.tar.gz to / usr / local folder below

takes -zxvf Redis-3.2.8.tar.gz

tar -zxvf tcl8.6.1-src.tar.gz

Create two folders

mkdir /etc/redis

mkdir / var / redis / 6379

cd tcl8.6.1/unix

./configure

make&&make install

cd-repeat 3.2.8

make&&make test&&make install

2, redis production environment Start Program

If the general course of study, you just start with redis-server at redis, do some experiments, in which case, no meaning

As a daemon process should redis system to run each time the system is started, the process starts with redis

(1) Under redis utils directory, there is a redis_init_script script
(2) a copy of the script to the /etc/init.d directory redis_init_script of linux, the redis_init_script rename redis_6379,6379 is our hope that this redis instance is listening port number
( 3) REDISPORT line 6 changes redis_6379 script, set to the same port number (default is 6379)
(4) create two directories: / etc / redis (redis storage configuration file), / var / redis / 6379 ( storing persistent files redis)
(5) redis modify the configuration file (by default in the root directory, redis.conf), copied to the / etc / redis directory, change the name of 6379.conf

(6) the modified portion redis.conf configuration for production environments

daemonize yes redis to make daemon processes running
pidfile /var/run/redis_6379.pid redis set the pid file location
port 6379 is set redis listening port number
dir / var / redis / 6379 set the storage location of persistent files

(7) starts redis, execute cd /etc/init.d, chmod 777 redis_6379,. / Redis_6379 start

(8) redis confirm whether the process started, ps -ef | grep redis

(9) so that the system starts automatically start to follow redis

In redis_6379 script, top, adding two line comment

# chkconfig: 2345 90 10

# description: Redis is a persistent key-value database

chkconfig redis_6379 on

------------------------------------------------------------------------

3, redis cli use

redis-cli SHUTDOWN, 6379 port to connect the machine to stop the process redis

redis-cli -h 127.0.0.1 -p 6379 SHUTDOWN, develop ip and port number to connect to

redis-cli PING, ping redis port to see if normal

redis-cli, enter the interactive command line

SET k1 v1
GET k1

Guess you like

Origin www.cnblogs.com/xiaofeiyang/p/11502607.html