Redis Deployment Management Persistent migration

Source: Internet
Author: User
Tags save file redis desktop manager

Redis Master-Slave deployment

Master:192.168. 30.131 Slave01: 192.168. 30.132 SLAVE02: 192.168. 30.134

1) Download the package

Used here: redis-3.0.3.tar.gz

2) Redis Installation

TARZXF redis-3.0. 3 . TAR.GZMV Redis-3.0. 3  /data/rediscd  /data/redismake&& make installmkdir  /data/redis _6379

3) Redis Configuration

Locate the configuration file/data/redis/redis.conf

Modify the following content:

daemonize  No change to Yes #启动后台运行dir. /change to/data/  redis_6379   #数据目录slaveof192.168.  30.131  6379   #同步master, set this parameter only from the

4) Redis Boot

Cp/data/redis/util/redis_init_scriptetc/init.d/redis

and modified as follows:

Conf=/data/redis/redis.conf

Pidfile=/var/run/redis.pid

Serviceredis start

5) Redis Master-Slave test

Redis-cli

127.0.0.1:6379>set name Yang

Ok

127.0.0.1:6379>get Name

"Yang"

Summary: Disadvantage for single point of failure

Redis Sentinel Deployment

Architecture diagram:

Modify the file/data/redis/sentinel.conf as follows:

Sentialmontinelmymastar 192.168.30.131 2

The format is as follows:

Sentialmontinel Monitor Host name (optionally defined) main data IP port number quorum value

Quorum value calculation method: Sentinel node number/2+1

Summary: Solve the single point of failure, the disadvantage is that each database still has all the data in the cluster, resulting in the total data storage of the cluster is limited to the smallest available storage memory database node, the formation of cask effect.

/data/redis/src/redis-sentinel/data/redis/sentinel.conf

Redis Persistence

Two types of persistence: Rdb and AoF

RDB: The specified rule "timed" stores the in-memory data on the hard disk;

AOF: The command itself is recorded after each execution of the command.

RDB settings (enabled by default):

Automatic snapshots based on configuration rules

User executes save or bgsave command

Execute Flushall command

When performing replication (master-slave)

AOF settings:

Turn on the appendonly parameter

Specify save file Appendfilename parameter

Redis Data Migration

######### #查看配置信息及当前存储的key值 ########### with persistent migration data127.0.0.1:6379>info# serverredis_version:3.0.3REDIS_GIT_SHA1:00000000Redis_git_dirty:0redis_build_id:b12f89c1e0186f28.....# Keyspacedb0:keys=7, expires=0, avg_ttl=0######## #保存最新的key值 ################127.0.0.1:6379>bgsavebackground Saving started######### #查看是否保存成功 ##############127.0.0.1:6379>lastsave (integer)1444357287######### #关闭redis服务器 ##############[[email protected]~]# Killall-9redis-server######### #压缩redis文件并拷入另一台机器 #########[[email protected] data]# tar zcf redis.gz redis_6379[[email protected] data]# SCP [email protected]192.168.30.134:/data/######## #登陆192.168.30. 134 machine and do the corresponding configuration ###### #修改redis. conf file dir/data/redis_6379######## #解压缩RDB文件 ########################[[email protected] data]# tarzxf redis.gz######### Restart Redis server ########################[[email protected] redis_6379]# Serviceredis start

Redis Management

The following are all modifications to the redis.conf configuration file

1) Specify the logon server

Bing 127.0.0.1

Note: The Bing parameter can only bind one address

2) Database Password Authentication

Requrepass Password

Logon Client Authentication format:

AUTH Password

Note: Set the Masterauth parameter-based password from the server

3) Command Rename settings

Rename-command Flushelldfsad

Format:

Rename-command original command name new command name

Redis Desktop Manager Tools

Redis Deployment Management Persistent migration

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.