Through Redis notes (a) a small Bai Zing, Redis notes (ii) master-slave and Redis notes (c) Add a password and modify the default port after the master-slave synchronization of the three articles, we have been able to create a master-slave copy of the Redis, such as the following figure:
On this basis, we do a read-write separation, write the main library, read from the library, as follows:
This actually enables the separation of read and write, however, whether it is to start or run the process, as long as there is a redis work is not normal, even if another job is normal, the whole Redis external is not available-the master is not available, not writable, never used unreadable, so there is a single point of failure, in order to solve this problem , the following improvements have been made:
After the transformation, the main Redis and from the Redis only before the start of a clear master-slave relationship, if the start of the discovery of the master or from one is not available, then the reading and writing to the common point of Redis, in order to achieve the high availability of the runtime, the load master Redis abstracted into a When an exception is accessed Redis, the method that loads the Redis is called again so that, as long as there is an available redis during the run, Redis can provide services externally.
This is the last article, the next one to share my implementation methods.