I. Introduction to Redis
Redis is an open-source (BSD-licensed), in-memory data structure storage system that can be used as a database, cache, and message middleware. It supports multiple types of data structures such as string (strings), hash (hashes), list (lists), set (sets), ordered set (sorted sets) with Range query, bitmaps, h Yperloglogs and geo-spatial (geospatial) Index RADIUS query. Redis has built-in replication (replication), LUA scripting (LUA scripting), LRU driver events (LRU eviction), transactions (transactions), and different levels of disk persistence (Persistenc e) and provides high availability via Redis Sentinel (Sentinel) and automatic Partitioning (Cluster) (Hi availability)
Two. Installing Redis
650) this.width=650; "src=" Https://s2.51cto.com/oss/201710/19/066a9c742baab6ecd8930669b51fdaf5.png "style=" float: none; "Title=" screenshot from 2017-10-18 15-37-09.png "alt=" 066a9c742baab6ecd8930669b51fdaf5.png "/>
650) this.width=650; "src=" Https://s2.51cto.com/oss/201710/19/04afe8aeb24129b4a9db914167cf91c6.png "style=" float: none; "Title=" screenshot from 2017-10-18 15-38-17.png "alt=" 04afe8aeb24129b4a9db914167cf91c6.png "/>
2. Start Redis
650) this.width=650; "src=" Https://s2.51cto.com/oss/201710/19/1cefc06f2a794c9758673e07b78ec7c9.png "style=" float: none; "Title=" screenshot from 2017-10-18 15-39-39.png "alt=" 1cefc06f2a794c9758673e07b78ec7c9.png "/>
Three. Installing Redis
Bind full Network Segment
650) this.width=650; "src=" Https://s4.51cto.com/oss/201710/19/af39ed6923296ea51ed3853f1653a29a.png "style=" float: none; "Title=" screenshot from 2017-10-18 15-52-22.png "alt=" Af39ed6923296ea51ed3853f1653a29a.png "/>
650) this.width=650; "src=" Https://s3.51cto.com/oss/201710/19/e9b48eb65e7ebf8f3abe2ef1333f124e.png "style=" float: none; "Title=" screenshot from 2017-10-18 15-53-20.png "alt=" E9b48eb65e7ebf8f3abe2ef1333f124e.png "/>
Enter Redis to create data
Data is a memory snapshot, saved to/var/lib/redis, in the form of an RDB
650) this.width=650; "src=" Https://s5.51cto.com/oss/201710/19/e76d402e664f8223a1f8f7d75d1289eb.png "style=" float: none; "Title=" screenshot from 2017-10-18 15-54-57.png "alt=" E76d402e664f8223a1f8f7d75d1289eb.png "/>,
four. Install Redis in Server2 and Server3, test data Synchronization
650) this.width=650; "src=" Https://s5.51cto.com/oss/201710/19/9afe20fb0a1a3d16c48e7d9ee98d7cd4.png "style=" float: none; "Title=" screenshot from 2017-10-18 15-55-45.png "alt=" 9afe20fb0a1a3d16c48e7d9ee98d7cd4.png "/>
650) this.width=650; "src=" Https://s1.51cto.com/oss/201710/19/fc8a694465cb641b97828a0966c27bc3.png "style=" float: none; "Title=" screenshot from 2017-10-18 15-57-39.png "alt=" Fc8a694465cb641b97828a0966c27bc3.png "/>
650) this.width=650; "src=" Https://s3.51cto.com/oss/201710/19/7d2b3b93b71c377241e9cc3766a13b57.png "style=" float: none; "Title=" screenshot from 2017-10-18 16-05-55.png "alt=" 7d2b3b93b71c377241e9cc3766a13b57.png "/>
Can view data synchronization to Server2 and Server3
650) this.width=650; "src=" Https://s3.51cto.com/oss/201710/19/760eed070aa82c4532d49cd1e36264ce.png "style=" float: none; "Title=" screenshot from 2017-10-18 16-06-54.png "alt=" 760eed070aa82c4532d49cd1e36264ce.png "/>
650) this.width=650; "src=" Https://s3.51cto.com/oss/201710/19/459fca762d7d3e87eac7693a52dbcb69.png "style=" float: none; "Title=" screenshot from 2017-10-18 16-07-00.png "alt=" 459fca762d7d3e87eac7693a52dbcb69.png "/>
650) this.width=650; "src=" Https://s2.51cto.com/oss/201710/19/96a0c4671db30d9ec7b5cd6cb7c37aa3.png "style=" float: none; "Title=" screenshot from 2017-10-18 16-10-14.png "alt=" 96a0c4671db30d9ec7b5cd6cb7c37aa3.png "/>
650) this.width=650; "src=" Https://s2.51cto.com/oss/201710/19/ddbce8363e7052790ac21e3f10462f1b.png "style=" float: none; "Title=" screenshot from 2017-10-18 16-10-51.png "alt=" Ddbce8363e7052790ac21e3f10462f1b.png "/>
Five.Redis Sentinel
The Redis Sentinel (Sentinel) system is used to manage multiple Redis servers that perform the following three tasks:
· Monitoring (monitoring): Sentinel (Sentinel) constantly checks to see if your master and slave are functioning properly.
reminder ( Notification) :
· automatic failover (Automatic failover): Sentinel (Sentinel) starts an automatic failover operation when a master does not function properly. It upgrades one of the slave of the failed master to the new master, and the other slave of the failed master to replicate the new master, and when the client tries to connect to the failed master, the cluster also returns the address of the new master to the client. Enables the cluster to use master instead of fail master.
1. Configure Sentinel Sentinel files in Server1
650) this.width=650; "src=" Https://s4.51cto.com/oss/201710/19/4408b75cf0fafa655eed77d2b8ad3ad2.png "style=" float: none; "Title=" screenshot from 2017-10-18 16-47-57.png "alt=" 4408b75cf0fafa655eed77d2b8ad3ad2.png "/>
Server1, Server2 and Server3 are the main
650) this.width=650; "src=" Https://s1.51cto.com/oss/201710/19/55de8a236048f4c083312ade200951a8.png "style=" float: none; "Title=" screenshot from 2017-10-18 17-07-30.png "alt=" 55de8a236048f4c083312ade200951a8.png "/>
2. Pass the sentinel.conf file to Server2 and Server3
650) this.width=650; "src=" Https://s4.51cto.com/oss/201710/19/3d3c5d7e453fc9c80926dfe0a3c1067b.png "style=" float: none; "Title=" screenshot from 2017-10-18 16-48-08.png "alt=" 3d3c5d7e453fc9c80926dfe0a3c1067b.png "/>
650) this.width=650; "src=" Https://s4.51cto.com/oss/201710/19/990a49998a60b20d146f47cf32dc37f9.png "style=" float: none; "Title=" screenshot from 2017-10-18 16-48-40.png "alt=" 990a49998a60b20d146f47cf32dc37f9.png "/>
3.server1, Server2, Server3 start Sentinel
650) this.width=650; "src=" Https://s2.51cto.com/oss/201710/19/876b5922b689320bc8e0eb9471a8872c.png "style=" float: none; "Title=" screenshot from 2017-10-18 16-49-26.png "alt=" 876b5922b689320bc8e0eb9471a8872c.png "/>
650) this.width=650; "src=" Https://s1.51cto.com/oss/201710/19/cad7071c51393eebee9fd8a53e0ce920.png "style=" float: none; "Title=" screenshot from 2017-10-18 16-49-32.png "alt=" Cad7071c51393eebee9fd8a53e0ce920.png "/>
650) this.width=650; "src=" Https://s1.51cto.com/oss/201710/19/40f407aeed6fd357864b8fdcd26789f0.png "style=" float: none; "Title=" screenshot from 2017-10-18 16-49-56.png "alt=" 40f407aeed6fd357864b8fdcd26789f0.png "/>
650) this.width=650; "src=" Https://s1.51cto.com/oss/201710/19/12b9b54c9ac52c6e886cc775c7930e60.png "style=" float: none; "Title=" screenshot from 2017-10-18 16-50-14.png "alt=" 12b9b54c9ac52c6e886cc775c7930e60.png "/>
4. After shutdown,30s the Server1 Master node, view master switch to Server2 on Server3
650) this.width=650; "src=" Https://s1.51cto.com/oss/201710/19/fbb1c8728fc8fec73a267ba8225493e1.png "style=" float: none; "Title=" screenshot from 2017-10-18 17-25-43.png "alt=" Fbb1c8728fc8fec73a267ba8225493e1.png "/>
650) this.width=650; "src=" Https://s3.51cto.com/oss/201710/19/af5f606bfaaedad82b8ef1a642273af3.png "style=" float: none; "Title=" screenshot from 2017-10-18 17-26-14.png "alt=" Af5f606bfaaedad82b8ef1a642273af3.png "/>
650) this.width=650; "src=" Https://s4.51cto.com/oss/201710/19/20fafaa79c1bfa260377b8c8e7d945ec.png "style=" float: none; "Title=" screenshot from 2017-10-18 17-26-41.png "alt=" 20fafaa79c1bfa260377b8c8e7d945ec.png "/>
4. Reboot to change the major in Server1 's sentinel.conf file to Server2
650) this.width=650; "src=" Https://s3.51cto.com/oss/201710/19/e02c5fb860458147d4d78cae8f1468ea.png "style=" float: none; "Title=" screenshot from 2017-10-18 17-32-37.png "alt=" E02c5fb860458147d4d78cae8f1468ea.png "/>
650) this.width=650; "src=" Https://s3.51cto.com/oss/201710/19/df3ce058825c0a1035dc52e759bb3425.png "style=" float: none; "Title=" screenshot from 2017-10-18 17-32-45.png "alt=" Df3ce058825c0a1035dc52e759bb3425.png "/>
650) this.width=650; "src=" Https://s3.51cto.com/oss/201710/19/d06ae23eb10fd17e43dc29e62cf0a8d1.png "style=" float: none; "Title=" screenshot from 2017-10-18 17-33-42.png "alt=" D06ae23eb10fd17e43dc29e62cf0a8d1.png "/>
Linux Enterprise-redis database, cache and message middleware