2. redis stand-alone production environment and deploy

Course Outline

  1. Install the standalone version redis
  2. redis production environment Start Program
  3. Use of redis cli

Install the standalone version redis

  1. Install tcl
wget http://downloads.sourceforge.net/tcl/tcl8.6.1-src.tar.gz
tar -xzvf tcl8.6.1-src.tar.gz
cd  /usr/local/tcl8.6.1/unix/
./configure  
make && make install
  1. Install redis-3.2.8.tar.gz, may be the latest stable version
cd /usr/local
tar -zxvf redis-3.2.8.tar.gz
cd redis-3.2.8
make && make test && make install

redis production environment Start Program

Redis make a system as daemon进程go running every time the system is started, the process starts with redis

1. /usr/local/redis-3.2.8/utilsdirectory, there is a redis_init_scriptscript
2. redis_init_scriptCopy it to the linux /etc/init.ddirectory, redis_init_scriptrename redis_6379. 6379 is our hope that this redis instance is listening port number
3. Modify the first row 6 of redis_6379 script REDISPORT, set to the same port number (default is 6379)
4. Create two directories: /etc/redis(redis store configuration files), /var/redis/6379(storage redis persistent file)
5. modify redis profile (by default in the root directory, redis.conf), copied to the /etc/redisdirectory, the name is modified 6379.conf
6. modified redis.conf is configured as part of the production environment

daemonize	yes							让redis以daemon进程运行
pidfile		/var/run/redis_6379.pid 	设置redis的pid文件位置
port		6379						设置redis的监听端口号
dir 		/var/redis/6379				设置持久化文件的存储位置

Self-reference.
7. Start redis

cd /etc/init.d
chmod 777 redis_6379
./redis_6379 start

Redis confirm whether to start: ps -ef | grep redis
10. Let redis follow the system starts automatically start

In the redis_6379script, top, adding two line comment

#chkconfig:   2345 90 10
#description:  Redis is a persistent key-value database
chkconfig redis_6379 on

Use of redis cli

  1. redis-cli SHUTDOWN, 6379 port to connect the machine to stop the process redis
  2. redis-cli -h 127.0.0.1 -p 6379 SHUTDOWNDevelop ip and port number to connect to
  3. redis-cli PING, Ping redis port to see if normal

redis technology

  1. redis use various data structures and commands, including the use of the java api
  2. Redis using special solutions, automatically pub / sub messaging system, distributed lock, input, etc.
  3. Related redis daily management command
  4. redis and deploy enterprise-class cluster architecture

For large enterprise-level cache architecture, real large-scale electricity system's Web site details page (cache), redis cluster architecture (huge amounts of data, high concurrency, high availability), the most popular, the most commonly used distributed caching system.

to sum up

redis persistence, master-slave architecture, replication principle, cluster architecture, distributed data storage principle, the principle of Sentinel, high availability architecture.

The underlying principle of in-depth cluster architecture, the underlying principle sentinel, with front-line experience, and tell you how massive the architect redis to support massive data, high concurrency, high availability.

Published 20 original articles · won praise 3 · Views 4527

Guess you like

Origin blog.csdn.net/qq_34246646/article/details/104219353