{"id":43952,"date":"2015-09-21T14:20:09","date_gmt":"2015-09-21T11:20:09","guid":{"rendered":"http:\/\/www.javacodegeeks.com\/?p=43952"},"modified":"2023-12-06T14:57:16","modified_gmt":"2023-12-06T12:57:16","slug":"redis-replication","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2015\/09\/redis-replication.html","title":{"rendered":"Redis Replication"},"content":{"rendered":"<p><em>This article is part of our Academy Course titled <a href=\"http:\/\/www.javacodegeeks.com\/2015\/09\/redis-a-nosql-key-value-store.html\">Redis a NoSQL key-value store<\/a>.<\/em><\/p>\n<p><em>This is a crash course on Redis. You will learn how to install Redis and start up the server. Additionally, you will mess around with the Redis command line. More advanced topics follow, such as replication, sharding and clustering, while the integration of Redis with Spring Data is also explained. Check it out <a href=\"http:\/\/www.javacodegeeks.com\/2015\/09\/redis-a-nosql-key-value-store.html\">here<\/a>!<\/em><\/p>\n<div class=\"toc\">\n<h4>Table Of Contents<\/h4>\n<dl>\n<dt><a href=\"#introduction\">1. Introduction<\/a><\/dt>\n<dt><a href=\"#redis_replication\">2. Replication in Redis<\/a><\/dt>\n<dt><a href=\"#configuring_basic_replication\">3. Configuring Basic Replication in Redis<\/a><\/dt>\n<dt><a href=\"#verifying_replication_work\">4. Verifying That Replication Works<\/a><\/dt>\n<dt><a href=\"#configuring_replication_runtime\">5. Configuring Replication at Runtime<\/a><\/dt>\n<dt><a href=\"#advanced_replication_configuration\">6. Advanced Replication Configuration<\/a><\/dt>\n<\/dl>\n<\/div>\n<h2><a name=\"introduction\"><\/a>1. Introduction<\/h2>\n<p>Replication is a very important feature of any data-oriented solution: either sophisticated relation database or simple key\/value store. Replication allows having many copies of your data to be distributed across many nodes (servers), data centers and\/or geographical regions. <\/p>\n<p>Replication is a foundation of reliable, horizontally scalable and fault-tolerant systems: once one data node (server) fails, another one is ready to serve the queries or requests having the (mostly) up-to-date data as the failed node had. Not to mention the ability to effectively split write and read operations across master nodes and slaves (read-only replicas). Some interesting software system patterns are based on such decisions, for example <a href=\"http:\/\/martinfowler.com\/bliki\/CQRS.html\">CQRS<\/a> (Command Query Responsibility Segregation) and replicated caching solutions.<\/p>\n<p>There are basically two main classes of replication: <\/p>\n<ul>\n<li><code>Master \u2013 Master<\/code> (or <code>Active \u2013 Active<\/code>) and<\/li>\n<li><code>Master \u2013 Slave<\/code> (or <code>Active \u2013 Passive<\/code>).<\/li>\n<\/ul>\n<p>Though <code>Master \u2013 Master<\/code> is the best option to have for automatic failover, it\u2019s very complicated and only few data solutions have it. At the moment of writing, Redis <code>2.8.4<\/code> supports only <code>Master \u2013 Slave<\/code> replication.<\/p>\n<h2><a name=\"redis_replication\"><\/a>2. Replication in Redis<\/h2>\n<p>The material of this section is based on excellent Redis documentation <a title=\"\" href=\"#_ref1\">[1]<\/a>. As we mentioned before, Redis supports <code>Master \u2013 Slave<\/code> replication that allows slaves to be exact copies of the master. <\/p>\n<p>Some facts about Redis replication:<\/p>\n<ul>\n<li>Redis uses asynchronous replication<\/li>\n<li>Redis master can have multiple slaves<\/li>\n<li>Redis slaves can accept connections from other slaves (cascading replication)<\/li>\n<li>Redis replication is non-blocking on the master side: master will continue to handle queries when one or more slaves perform the initial synchronization<\/li>\n<li>Redis replication could be configured to be non-blocking on the slave side: while the slave is performing the initial synchronization, it can handle queries using the old version of the dataset (please see <a href=\"#advanced_replication_configuration\">Advanced Replication Configuration<\/a>, <code>slave-serve-stale-data<\/code> setting)<\/li>\n<\/ul>\n<p>There are a couple of recommended use cases when Redis replication could be very handy. Firstly, it could be used in order to have multiple slaves for read-only queries or simply for data redundancy. Secondly, it is also possible to use replication to avoid master writing the full dataset to disk: slaves could be configured to do so periodically.<\/p>\n<p>Also, very important recent enhancement in Redis 2.8: master and slave are usually able to continue the replication process without requiring a full resynchronization after the replication link went down. What it practically means, if network partition happens between master and slave, the slave can catch up with master later on by fetching the missed change sets, not a whole data set.<\/p>\n<h1><a name=\"configuring_basic_replication\"><\/a>3. Configuring Basic Replication in Redis<\/h3>\n<p>Slave (or replica) configuration is very simple and in basic form requires only single parameter <code>slaveof<\/code> to be set in <code>redis.conf<\/code> file: the master IP address and port. Worth to mention, Redis slaves by default are run in read-only mode. This behavior is managed by the <code>slave-read-only<\/code> option in the configuration file <code>redis.conf<\/code> and can be changed while slave is running using <code>CONFIG SET<\/code> command (please refer to a <strong>part 2<\/strong> of this tutorial: <a href=\"http:\/\/www.javacodegeeks.com\/2015\/09\/redis-commands-using-redis-command-line\/\">Redis Commands &#8211; Using Redis Command Line<\/a>). Read-only slaves will reject all write commands. <\/p>\n<p>In turn, non-read-only slaves will accept write commands. Please notice that the data written to a slave in such a way is ephemeral and will disappear when the slave and the master resynchronize or slave is restarted.<\/p>\n<p>To see in practice how easy Redis replication configuration is we will configure a master and two slaves (replicas). One slave (replica) will have the default read-only mode (marked with green color on the picture below) and another one will be configured to support writes so we can see in action what\u2019s happening.<\/p>\n<p><figure id=\"attachment_3603\" aria-describedby=\"caption-attachment-3603\" style=\"width: 297px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/redis3_pic1.png\"><img decoding=\"async\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/redis3_pic1.png\" alt=\"Figure 1. Redis master and slaves topology\" width=\"297\" height=\"246\" class=\"size-full wp-image-3603\" \/><\/a><figcaption id=\"caption-attachment-3603\" class=\"wp-caption-text\">Figure 1. Redis master and slaves topology<\/figcaption><\/figure><\/p>\n<p>For master and slaves we will use the configuration template redis.conf from Redis distribution (please see <strong>part 1<\/strong> of this tutorial, <a href=\"http:\/\/www.javacodegeeks.com\/2015\/09\/redis-installation-how-to-install-redis\/\">Redis Installation &#8211; How to install Redis<\/a>).<\/p>\n<ol>\n<li>For the <code>master<\/code>, just copy <code>redis.conf<\/code> to <code>redis-master.conf<\/code>:\n<pre class=\"brush:bash\">\ncp redis.conf redis-master.conf\n<\/pre>\n<p>And start Redis server with this configuration:<\/p>\n<pre class=\"brush:bash\">\nredis-server redis-master.conf\n<\/pre>\n<p><figure id=\"attachment_3605\" aria-describedby=\"caption-attachment-3605\" style=\"width: 1900px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/redis3_pic2.png\"><img decoding=\"async\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/redis3_pic2.png\" alt=\"Figure 2. Redis master is started\" width=\"1900\" height=\"489\" class=\"size-full wp-image-3605\" \/><\/a><figcaption id=\"caption-attachment-3605\" class=\"wp-caption-text\">Figure 2. Redis master is started<\/figcaption><\/figure>\n<\/li>\n<li>For slave (replica) 1, just copy <code>redis.conf<\/code> to <code>redis-slave1.conf<\/code>:\n<pre class=\"brush:bash\">\ncp redis.conf redis-slave1.conf\n<\/pre>\n<p>And add following configuration setting to <code>redis-slave1.conf <\/code> (we assume that hostname of Redis master is <code>master<\/code>):<\/p>\n<pre class=\"brush:bash\">\nslaveof master 6379\n<\/pre>\n<p>Then start Redis server with this configuration overriding the default port to <code>6380<\/code>:<\/p>\n<pre class=\"brush:bash\">\nredis-server redis-slave1.conf --port 6380\n<\/pre>\n<p>Upon start, the slave (replica) immediately synchronizes with master (as picture below shows).<\/p>\n<p><figure id=\"attachment_3606\" aria-describedby=\"caption-attachment-3606\" style=\"width: 1900px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/redis3_pic3.png\"><img decoding=\"async\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/redis3_pic3.png\" alt=\"Figure 3. Redis slave (replica) 1 is started (by default in read-only mode) and immediately synchronizes with master\" width=\"1900\" height=\"683\" class=\"size-full wp-image-3606\" \/><\/a><figcaption id=\"caption-attachment-3606\" class=\"wp-caption-text\">Figure 3. Redis slave (replica) 1 is started (by default in read-only mode) and immediately synchronizes with master<\/figcaption><\/figure>\n<\/li>\n<li>For slave (replica) 2, just copy <code>redis.conf<\/code> to <code>redis-slave2.conf<\/code>:\n<pre class=\"brush:bash\">\ncp redis.conf redis-slave2.conf\n<\/pre>\n<p>And add following configuration setting to <code>redis-slave2.conf<\/code> (we assume that hostname of Redis master is <code>master<\/code>):<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<pre class=\"brush:bash\">\nslaveof master 6379\n<\/pre>\n<p>The change <code>slave-read-only<\/code> from <strong>yes<\/strong> (default) to <strong>no<\/strong>, effectively allowing writes.<\/p>\n<pre class=\"brush:bash\">\nslave-read-only no \n<\/pre>\n<p>And finally start Redis server with this configuration overriding the default port to <code>6381<\/code>:<\/p>\n<pre class=\"brush:bash\">\nredis-server redis-slave2.conf --port 6381\n<\/pre>\n<p>Upon start, the slave (replica) immediately synchronizes with master (as picture below shows).<\/p>\n<p><figure id=\"attachment_3607\" aria-describedby=\"caption-attachment-3607\" style=\"width: 1900px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/redis3_pic4.png\"><img decoding=\"async\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/redis3_pic4.png\" alt=\"Figure 4. Redis slave (replica) 2 is started (read-write mode) and immediately synchronizes with master\" width=\"1900\" height=\"710\" class=\"size-full wp-image-3607\" \/><\/a><figcaption id=\"caption-attachment-3607\" class=\"wp-caption-text\">Figure 4. Redis slave (replica) 2 is started (read-write mode) and immediately synchronizes with master<\/figcaption><\/figure>\n<\/li>\n<\/ol>\n<p>At this point, we have a topology with one Redis master and two Redis slaves (replicas) connected to it.<\/p>\n<h2><a name=\"verifying_replication_work\"><\/a>4. Verifying That Replication Works<\/h2>\n<p>There are a couple of simple techniques which may confirm that Redis replication works as expected. The simplest one is to <code>SET<\/code> some key on a master and then issue <code>GET<\/code> command for this key on each slave to see it\u2019s replicated.<\/p>\n<p><figure id=\"attachment_3608\" aria-describedby=\"caption-attachment-3608\" style=\"width: 700px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/redis3_pic5.png\"><img decoding=\"async\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/redis3_pic5.png\" alt=\"Figure 5. Set key mykey on the master node\" width=\"700\" height=\"84\" class=\"size-full wp-image-3608\" \/><\/a><figcaption id=\"caption-attachment-3608\" class=\"wp-caption-text\">Figure 5. Set key <code>mykey<\/code> on the master node<\/figcaption><\/figure><br \/>\n<figure id=\"attachment_3609\" aria-describedby=\"caption-attachment-3609\" style=\"width: 700px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/redis3_pic6a.png\"><img decoding=\"async\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/redis3_pic6a.png\" alt=\"Figure 6a\" width=\"700\" height=\"85\" class=\"size-full wp-image-3609\" \/><\/a><figcaption id=\"caption-attachment-3609\" class=\"wp-caption-text\">Figure 6a<\/figcaption><\/figure><br \/>\n<figure id=\"attachment_3610\" aria-describedby=\"caption-attachment-3610\" style=\"width: 700px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/redis3_pic6.png\"><img decoding=\"async\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/redis3_pic6.png\" alt=\"Figure 6b. Get key mykey on both slave nodes and verify changes from master are replicated\" width=\"700\" height=\"83\" class=\"size-full wp-image-3610\" \/><\/a><figcaption id=\"caption-attachment-3610\" class=\"wp-caption-text\">Figure 6b. Get key <code>mykey<\/code> on both slave nodes and verify changes from master are replicated<\/figcaption><\/figure><\/p>\n<p>Trying to issue any write command on the slave 1 leads to error as it\u2019s configured in read-only mode (as following picture demonstrates).<\/p>\n<p><figure id=\"attachment_3611\" aria-describedby=\"caption-attachment-3611\" style=\"width: 700px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/redis3_pic7.png\"><img decoding=\"async\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/redis3_pic7.png\" alt=\"Figure 7. SET command on read-only slave (slave1) returns an error\" width=\"700\" height=\"81\" class=\"size-full wp-image-3611\" \/><\/a><figcaption id=\"caption-attachment-3611\" class=\"wp-caption-text\">Figure 7. <code>SET<\/code> command on read-only slave (<code>slave1<\/code>) returns an error<\/figcaption><\/figure><\/p>\n<p>Consequently, issuing any write command on the slave 2 is legitimate but all such ephemeral data is gone once slave resynchronizes with master.<\/p>\n<p><figure id=\"attachment_3612\" aria-describedby=\"caption-attachment-3612\" style=\"width: 700px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/redis3_pic13.png\"><img decoding=\"async\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/redis3_pic13.png\" alt=\"Figure 8. SET command on read-write slave (slave2) is accepted\" width=\"700\" height=\"104\" class=\"size-full wp-image-3612\" \/><\/a><figcaption id=\"caption-attachment-3612\" class=\"wp-caption-text\">Figure 8. <code>SET<\/code> command on read-write slave (<code>slave2<\/code>) is accepted<\/figcaption><\/figure><\/p>\n<h2><a name=\"configuring_replication_runtime\"><\/a>5. Configuring Replication at Runtime<\/h2>\n<p>In case you have already running multiple independent Redis servers, it\u2019s possible to configure master-slave replication without restarting single of them, thanks to Redis runtime configuration capabilities. To demonstrate this in the field, we will run a regular Redis instance on port <code>6390<\/code> and then make it a slave of another Redis instance (<code>master<\/code>). So let\u2019s the standalone instance:<\/p>\n<pre class=\"brush:bash\">\nredis-server --port 6390\n<\/pre>\n<p><figure id=\"attachment_3613\" aria-describedby=\"caption-attachment-3613\" style=\"width: 1895px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/redis3_pic8.png\"><img decoding=\"async\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/redis3_pic8.png\" alt=\"Figure 9. Running standalone Redis instance on port 6390\" width=\"1895\" height=\"504\" class=\"size-full wp-image-3613\" \/><\/a><figcaption id=\"caption-attachment-3613\" class=\"wp-caption-text\">Figure 9. Running standalone Redis instance on port <code>6390<\/code><\/figcaption><\/figure><\/p>\n<p>And now, let\u2019s connect to this instance using <code>redis-cli<\/code> and using <code>SLAVEOF<\/code> command (<a title=\"\" href=\"#_ref2\">[2]<\/a>) we will make this instance a slave (replica) of running <code>master<\/code> instance.<\/p>\n<p><figure id=\"attachment_3614\" aria-describedby=\"caption-attachment-3614\" style=\"width: 700px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/redis3_pic9.png\"><img decoding=\"async\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/redis3_pic9.png\" alt=\"Figure 10. Making standalone Redis instance a slave (replica)\" width=\"700\" height=\"85\" class=\"size-full wp-image-3614\" \/><\/a><figcaption id=\"caption-attachment-3614\" class=\"wp-caption-text\">Figure 10. Making standalone Redis instance a slave (replica)<\/figcaption><\/figure><\/p>\n<p>The instance immediately synchronizes with master by using full synchronization (as picture below shows).<\/p>\n<p><figure id=\"attachment_3615\" aria-describedby=\"caption-attachment-3615\" style=\"width: 1287px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/redis3_pic10.png\"><img decoding=\"async\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/redis3_pic10.png\" alt=\"Figure 11. Standalone Redis instance becomes a slave (replica) and makes full resynchronization with the master\" width=\"1287\" height=\"232\" class=\"size-full wp-image-3615\" \/><\/a><figcaption id=\"caption-attachment-3615\" class=\"wp-caption-text\">Figure 11. Standalone Redis instance becomes a slave (replica) and makes full resynchronization with the master<\/figcaption><\/figure><\/p>\n<p>It is also possible at the same time to change slave\u2019s default read-only mode to read-write using <code>CONFIG SET<\/code> command (<a title=\"\" href=\"#_ref3\">[3]<\/a>).<\/p>\n<p><figure id=\"attachment_3616\" aria-describedby=\"caption-attachment-3616\" style=\"width: 700px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/redis3_pic11.png\"><img decoding=\"async\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/redis3_pic11.png\" alt=\"Figure 12. Changing slave\u2019s default read-only mode to read-write\" width=\"700\" height=\"83\" class=\"size-full wp-image-3616\" \/><\/a><figcaption id=\"caption-attachment-3616\" class=\"wp-caption-text\">Figure 12. Changing slave\u2019s default read-only mode to read-write<\/figcaption><\/figure><\/p>\n<p>At any time, the current configuration settings could be queried using <code>CONFIG GET<\/code> command. The following example retrieves the <code>slave-read-only<\/code> setting to ensure its value was changed to \u201c<strong>yes<\/strong>\u201d.<\/p>\n<p><figure id=\"attachment_3617\" aria-describedby=\"caption-attachment-3617\" style=\"width: 700px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/redis3_pic12.png\"><img decoding=\"async\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2015\/09\/redis3_pic12.png\" alt=\"Figure 13. Querying slave\u2019s read-only mode configuration setting\" width=\"700\" height=\"85\" class=\"size-full wp-image-3617\" \/><\/a><figcaption id=\"caption-attachment-3617\" class=\"wp-caption-text\">Figure 13. Querying slave\u2019s read-only mode configuration setting<\/figcaption><\/figure><\/p>\n<h2><a name=\"advanced_replication_configuration\"><\/a>6. Advanced Replication Configuration<\/h2>\n<p>There are quite a lot of settings which are very useful in real-words scenarios that are beyond our basic examples. In this section will go through most of them so to point out how you could make your replication more robust. <\/p>\n<p>Redis master can be configured to accept write commands only if at least N slaves are currently connected to it (but it is not possible to ensure that slaves actually received a given write, only to limit the window of exposure for lost writes in case not enough slaves are available) with specified number of seconds. <\/p>\n<p>Configuration settings support a minimum number of slaves (<code>min-slaves-to-write<\/code>) that have a lag not greater than a maximum number of seconds (<code>slaves-max-lag<\/code>). If those conditions haven\u2019t been met, the master will reply with an error and the write will not be accepted.<\/p>\n<div class=\"wp-caption aligncenter\">\n<table>\n<tbody>\n<tr>\n<td><strong>Setting<\/strong><\/td>\n<td><strong>min-slaves-to-write<\/strong> &lt;number of slaves&gt;<\/td>\n<\/tr>\n<tr>\n<td><strong>Description<\/strong><\/td>\n<td>Sets the &lt;number of slaves&gt; which should be connected in order for write command to proceed. The &lt;number of slaves&gt; slaves need to be in &#8220;online&#8221; state. Setting the value to 0 disables this feature.<\/td>\n<\/tr>\n<tr>\n<td><strong>Defaults<\/strong><\/td>\n<td>By default <code>min-slaves-to-write<\/code> is set to 0 (feature disabled)<\/td>\n<\/tr>\n<tr>\n<td><strong>Example<\/strong><\/td>\n<td><code>min-slaves-to-write<\/code> 3<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p class=\"wp-caption-text\">Table 1<\/p>\n<\/p>\n<\/div>\n<div class=\"wp-caption aligncenter\">\n<table>\n<tbody>\n<tr>\n<td><strong>Setting<\/strong><\/td>\n<td><strong>min-slaves-max-lag<\/strong> &lt;number of seconds&gt;<\/td>\n<\/tr>\n<tr >\n<td><strong>Description<\/strong><\/td>\n<td>Sets the lag in seconds that must be less or equal to the specified value. It is calculated from the last ping received from the slave (that is usually sent every second). Setting the value to 0 disables the feature.<\/td>\n<\/tr>\n<tr>\n<td><strong>Defaults<\/strong><\/td>\n<td>By default <code>min-slaves-max-lag<\/code> is set to 10<\/td>\n<\/tr>\n<tr>\n<td><strong>Example<\/strong><\/td>\n<td><code>min-slaves-max-lag<\/code> 10<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p class=\"wp-caption-text\">Table 2<\/p>\n<\/p>\n<\/div>\n<p>If the master is password-protected (using the requirepass configuration directive) it is possible to tell the slave to authenticate before starting the replication synchronization process, otherwise the master will refuse the slave request.<\/p>\n<div class=\"wp-caption aligncenter\">\n<table>\n<tbody>\n<tr>\n<td><strong>Setting<\/strong><\/td>\n<td><strong>masterauth<\/strong> <master-password><\/td>\n<\/tr>\n<tr>\n<td><strong>Description<\/strong><\/td>\n<td>Configures password to use for authentication with master<\/td>\n<\/tr>\n<tr>\n<td><strong>Defaults<\/strong><\/td>\n<td>Commented out (no authentication )<\/td>\n<\/tr>\n<tr>\n<td><strong>Example<\/strong><\/td>\n<td><code>masterauth<\/code> <code>mysectetpassword<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p class=\"wp-caption-text\">Table 3<\/p>\n<\/p>\n<\/div>\n<p>When a slave loses its connection with the master, or when the replication is still in progress, the slave can act in two different ways:<\/p>\n<ul>\n<li>if <code>slave-serve-stale-data<\/code> is set to &#8216;<strong>yes<\/strong>&#8216; (the default) the slave will still reply to client requests, possibly with out of date data, or the data set may just be empty if this is the first synchronization<\/li>\n<li>if <code>slave-serve-stale-data<\/code> is set to &#8216;<strong>no<\/strong>&#8216; the slave will reply with an error &#8220;<strong>SYNC with master in progress<\/strong>&#8221; to all the kind of commands but to <code>INFO<\/code> (<a title=\"\" href=\"#_ref4\">[4]<\/a>) and <code>SLAVEOF<\/code> (<a title=\"\" href=\"#_ref2\">[2]<\/a>)<\/li>\n<\/ul>\n<div class=\"wp-caption aligncenter\">\n<table>\n<tbody>\n<tr>\n<td><strong>Setting<\/strong><\/td>\n<td><strong>slave-serve-stale-data<\/strong> yes | no<\/td>\n<\/tr>\n<tr>\n<td><strong>Description<\/strong><\/td>\n<td>Configures the behavior when a slave loses its connection with the master<\/td>\n<\/tr>\n<tr>\n<td><strong>Defaults<\/strong><\/td>\n<td>By default <code>slave-serve-stale-data<\/code> is set to yes<\/td>\n<\/tr>\n<tr>\n<td><strong>Example<\/strong><\/td>\n<td><code>slave-serve-stale-data<\/code> yes<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p class=\"wp-caption-text\">Table 4<\/p>\n<\/p>\n<\/div>\n<p>Slaves send <code>PING<\/code>s to server in a predefined interval. It&#8217;s allowed to change this interval with the <code>repl_ping_slave_period<\/code> option. <\/p>\n<div class=\"wp-caption aligncenter\">\n<table>\n<tbody>\n<tr>\n<td><strong>Setting<\/strong><\/td>\n<td><strong>repl-ping-slave-period<\/strong> &lt;number of seconds&gt;<\/td>\n<\/tr>\n<tr>\n<td><strong>Description<\/strong><\/td>\n<td>Configures how often slaves send PINGs to server<\/td>\n<\/tr>\n<tr>\n<td><strong>Defaults<\/strong><\/td>\n<td>By default <code>repl-ping-slave-period<\/code> is set to 10<\/td>\n<\/tr>\n<tr>\n<td><strong>Example<\/strong><\/td>\n<td><code>repl-ping-slave-period<\/code> 10<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p class=\"wp-caption-text\">Table 5<\/p>\n<\/p>\n<\/div>\n<p>It is possible to configure the replication timeout for master and slaves (timeout from the point of view of slaves, when slaves make the decision that master is not available, and timeout from the point of view of masters, when master makes the decision that slaves are not available):<\/p>\n<ul>\n<li>bulk transfer I\/O during SYNC, from the point of view of slave<\/li>\n<li>master timeout from the point of view of slaves<\/li>\n<li>slaves timeout from the point of view of master<\/li>\n<\/ul>\n<div class=\"wp-caption aligncenter\">\n<table>\n<tbody>\n<tr>\n<td><strong>Setting<\/strong><\/td>\n<td><strong>repl-timeout <\/strong>&lt;number of seconds&gt;<\/td>\n<\/tr>\n<tr>\n<td><strong>Description<\/strong><\/td>\n<td>Configures the replication timeout. It is important to make sure that this value is greater than the value specified for <code>repl-ping-slave-period<\/code> or a timeout will be detected every time there is low traffic between the master and the slave.<\/td>\n<\/tr>\n<tr>\n<td><strong>Defaults<\/strong><\/td>\n<td>By default <code>repl-timeout<\/code> is set to 60<\/td>\n<\/tr>\n<tr>\n<td><strong>Example<\/strong><\/td>\n<td><code>repl-timeout<\/code> 60<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p class=\"wp-caption-text\">Table 6<\/p>\n<\/p>\n<\/div>\n<p>For replication purposes, Redis supports some low-level TCP protocol tuning by using <code>repl-disable-tcp-nodelay<\/code> option. If it is set to &#8220;<strong>yes<\/strong>&#8220;, Redis server will use a smaller number of TCP packets and less bandwidth to send data to slaves. But this can add a delay for the data to appear on the slave side (up to 40 milliseconds with Linux kernels using a default configuration). Activating this setting could be considered useful in very high traffic condition or when the master and slaves are many hops away. By default, it is set to &#8220;<strong>no<\/strong>&#8220;, which means that delay for data to appear on the slave side will be reduced but more bandwidth will be used for replication.<\/p>\n<div class=\"wp-caption aligncenter\">\n<table>\n<tbody>\n<tr>\n<td><strong>Setting<\/strong><\/td>\n<td><strong>repl-disable-tcp-nodelay<\/strong> yes | no<\/td>\n<\/tr>\n<tr>\n<td><strong>Description<\/strong><\/td>\n<td>Disables \/ enables TCP_NODELAY on the slave socket after SYNC<\/td>\n<\/tr>\n<tr>\n<td><strong>Defaults<\/strong><\/td>\n<td>By default <code>repl-disable-tcp-nodelay<\/code> is set to \u201c<strong>no<\/strong>\u201d (optimized for low latency)<\/td>\n<\/tr>\n<tr>\n<td><strong>Example<\/strong><\/td>\n<td><code>repl-disable-tcp-nodelay<\/code> no<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p class=\"wp-caption-text\">Table 7<\/p>\n<\/p>\n<\/div>\n<p>There are two configuration parameters which help master to manage slave disconnections and partial replication: replication backlog size and backlog buffer time-to-live. The backlog is a buffer that accumulates slave data when slaves are disconnected for some time, so that when a slave wants to reconnect again, often a full resynchronization is not needed, but a partial resynchronization is enough (just passing the portion of data the slave missed while disconnected). The biggest the replication backlog, the longer the time the slave can be disconnected and later will be able to perform a partial resynchronization. The backlog is only allocated once there is at least one slave connected.<\/p>\n<div class=\"wp-caption aligncenter\">\n<table>\n<tbody>\n<tr>\n<td><strong>Setting<\/strong><\/td>\n<td><strong>repl-backlog-size <\/strong><size><\/td>\n<\/tr>\n<tr>\n<td><strong>Description<\/strong><\/td>\n<td>Sets the replication backlog size<\/td>\n<\/tr>\n<tr>\n<td><strong>Defaults<\/strong><\/td>\n<td>By default <code>repl-backlog-size<code> is set to \u201c<strong>1mb<\/strong>\u201d<\/td>\n<\/tr>\n<tr>\n<td><strong>Example<\/strong><\/td>\n<td><code>repl-backlog-size<\/code> 1mb<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p class=\"wp-caption-text\">Table 8<\/p>\n<\/p>\n<\/div>\n<p>After a master has no longer connected slaves for some time, the backlog will be freed. The <code>repl-backlog-ttl<\/code> option configures the amount of seconds that needs to elapse, starting from the time the last slave disconnected, for the backlog buffer to be freed.<\/p>\n<div class=\"wp-caption aligncenter\">\n<table>\n<tbody>\n<tr>\n<td><strong>Setting<\/strong><\/td>\n<td><strong>repl-backlog-ttl <\/strong>&lt;number of seconds&gt;<\/td>\n<\/tr>\n<tr>\n<td><strong>Description<\/strong><\/td>\n<td>Sets backlog buffer time-to-live before freeing it. A value of 0 means to never release the backlog.<\/td>\n<\/tr>\n<tr>\n<td><strong>Defaults<\/strong><\/td>\n<td>By default <code>repl-backlog-ttl<\/code> is set to \u201c<strong>3600<\/strong>\u201d<\/td>\n<\/tr>\n<tr>\n<td><strong>Example<\/strong><\/td>\n<td><code>repl-backlog-ttl<\/code> 3600<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p class=\"wp-caption-text\">Table 9<\/p>\n<\/p>\n<\/div>\n<p>Lastly, very interesting setting to assign a priority to the slave (replica) which is used by Redis Sentinel (<a title=\"\" href=\"#_ref5\">[5]<\/a>) in order to select a slave to promote into a master if the master is no longer working correctly. A slave with a low priority number is considered better for promotion, so for instance if there are three slaves with priority 10, 100, 25 Redis Sentinel (<a title=\"\" href=\"#_ref5\">[5]<\/a>) will pick the one with priority 10 (that is the lowest). However a special priority of 0 marks the slave as not able to perform the role of master, so a slave with priority of 0 will never be selected by Redis Sentinel (<a title=\"\" href=\"#_ref5\">[5]<\/a>) for promotion.<\/p>\n<div class=\"wp-caption aligncenter\">\n<table>\n<tbody>\n<tr>\n<td><strong>Setting<\/strong><\/td>\n<td><strong>slave-priority<\/strong> &lt;number&gt;<\/td>\n<\/tr>\n<tr>\n<td><strong>Description<\/strong><\/td>\n<td>The slave priority is an integer number published by Redis in the INFO output.<\/td>\n<\/tr>\n<tr>\n<td><strong>Defaults<\/strong><\/td>\n<td>By default <code>slave-priority<\/code> is set 100<\/td>\n<\/tr>\n<tr>\n<td><strong>Example<\/strong><\/td>\n<td><code>slave-priority<\/code> 100<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p class=\"wp-caption-text\">Table 10<\/p>\n<\/p>\n<\/div>\n<p>Redis Sentinel (<a title=\"\" href=\"#_ref5\">[5]<\/a>) will be discussed later in the tutorial.<\/p>\n<table class=\"ref-table\">\n<tr>\n<td id=\"_ref1\">[1] <a href=\"http:\/\/redis.io\/topics\/replication\">http:\/\/redis.io\/topics\/replication<\/a><\/td>\n<\/tr>\n<tr>\n<td id=\"_ref2\">[2] <a href=\"http:\/\/redis.io\/commands\/slaveof\">http:\/\/redis.io\/commands\/slaveof<\/a><\/td>\n<\/tr>\n<tr>\n<td id=\"_ref3\">[3] <a href=\"http:\/\/redis.io\/commands\/config-set\">http:\/\/redis.io\/commands\/config-set<\/a><\/td>\n<\/tr>\n<tr>\n<td id=\"_ref4\">[4] <a href=\"http:\/\/redis.io\/commands\/info\">http:\/\/redis.io\/commands\/info<\/a><\/td>\n<\/tr>\n<tr>\n<td id=\"_ref5\">[5] <a href=\"http:\/\/redis.io\/topics\/sentinel\">http:\/\/redis.io\/topics\/sentinel<\/a><\/td>\n<\/tr>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>This article is part of our Academy Course titled Redis a NoSQL key-value store. This is a crash course on Redis. You will learn how to install Redis and start up the server. Additionally, you will mess around with the Redis command line. More advanced topics follow, such as replication, sharding and clustering, while the &hellip;<\/p>\n","protected":false},"author":141,"featured_media":223,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[113,117],"class_list":["post-43952","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-nosql","tag-redis"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Redis Replication - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"This article is part of our Academy Course titled Redis a NoSQL key-value store. This is a crash course on Redis. You will learn how to install Redis and\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2015\/09\/redis-replication.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Redis Replication - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"This article is part of our Academy Course titled Redis a NoSQL key-value store. This is a crash course on Redis. You will learn how to install Redis and\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2015\/09\/redis-replication.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2015-09-21T11:20:09+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-06T12:57:16+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/redis-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Andrey Redko\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Andrey Redko\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"14 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2015\\\/09\\\/redis-replication.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2015\\\/09\\\/redis-replication.html\"},\"author\":{\"name\":\"Andrey Redko\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/771a6504862edc45322776832cbce413\"},\"headline\":\"Redis Replication\",\"datePublished\":\"2015-09-21T11:20:09+00:00\",\"dateModified\":\"2023-12-06T12:57:16+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2015\\\/09\\\/redis-replication.html\"},\"wordCount\":2379,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2015\\\/09\\\/redis-replication.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/redis-logo.jpg\",\"keywords\":[\"NoSQL\",\"Redis\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2015\\\/09\\\/redis-replication.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2015\\\/09\\\/redis-replication.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2015\\\/09\\\/redis-replication.html\",\"name\":\"Redis Replication - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2015\\\/09\\\/redis-replication.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2015\\\/09\\\/redis-replication.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/redis-logo.jpg\",\"datePublished\":\"2015-09-21T11:20:09+00:00\",\"dateModified\":\"2023-12-06T12:57:16+00:00\",\"description\":\"This article is part of our Academy Course titled Redis a NoSQL key-value store. This is a crash course on Redis. You will learn how to install Redis and\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2015\\\/09\\\/redis-replication.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2015\\\/09\\\/redis-replication.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2015\\\/09\\\/redis-replication.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/redis-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/redis-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2015\\\/09\\\/redis-replication.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Redis Replication\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/771a6504862edc45322776832cbce413\",\"name\":\"Andrey Redko\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/16419ce8394173028eddaeb992859862bab50cfcf74589fa9bb9a3dd8bb27518?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/16419ce8394173028eddaeb992859862bab50cfcf74589fa9bb9a3dd8bb27518?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/16419ce8394173028eddaeb992859862bab50cfcf74589fa9bb9a3dd8bb27518?s=96&d=mm&r=g\",\"caption\":\"Andrey Redko\"},\"description\":\"Andriy is a well-grounded software developer with more then 12 years of practical experience using Java\\\/EE, C#\\\/.NET, C++, Groovy, Ruby, functional programming (Scala), databases (MySQL, PostgreSQL, Oracle) and NoSQL solutions (MongoDB, Redis).\",\"sameAs\":[\"http:\\\/\\\/aredko.blogspot.com\\\/\",\"http:\\\/\\\/ca.linkedin.com\\\/in\\\/aredko\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/andrey-redko\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Redis Replication - Java Code Geeks","description":"This article is part of our Academy Course titled Redis a NoSQL key-value store. This is a crash course on Redis. You will learn how to install Redis and","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2015\/09\/redis-replication.html","og_locale":"en_US","og_type":"article","og_title":"Redis Replication - Java Code Geeks","og_description":"This article is part of our Academy Course titled Redis a NoSQL key-value store. This is a crash course on Redis. You will learn how to install Redis and","og_url":"https:\/\/www.javacodegeeks.com\/2015\/09\/redis-replication.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2015-09-21T11:20:09+00:00","article_modified_time":"2023-12-06T12:57:16+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/redis-logo.jpg","type":"image\/jpeg"}],"author":"Andrey Redko","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Andrey Redko","Est. reading time":"14 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2015\/09\/redis-replication.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2015\/09\/redis-replication.html"},"author":{"name":"Andrey Redko","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/771a6504862edc45322776832cbce413"},"headline":"Redis Replication","datePublished":"2015-09-21T11:20:09+00:00","dateModified":"2023-12-06T12:57:16+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2015\/09\/redis-replication.html"},"wordCount":2379,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2015\/09\/redis-replication.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/redis-logo.jpg","keywords":["NoSQL","Redis"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2015\/09\/redis-replication.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2015\/09\/redis-replication.html","url":"https:\/\/www.javacodegeeks.com\/2015\/09\/redis-replication.html","name":"Redis Replication - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2015\/09\/redis-replication.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2015\/09\/redis-replication.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/redis-logo.jpg","datePublished":"2015-09-21T11:20:09+00:00","dateModified":"2023-12-06T12:57:16+00:00","description":"This article is part of our Academy Course titled Redis a NoSQL key-value store. This is a crash course on Redis. You will learn how to install Redis and","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2015\/09\/redis-replication.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2015\/09\/redis-replication.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2015\/09\/redis-replication.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/redis-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/redis-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2015\/09\/redis-replication.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"Redis Replication"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/771a6504862edc45322776832cbce413","name":"Andrey Redko","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/16419ce8394173028eddaeb992859862bab50cfcf74589fa9bb9a3dd8bb27518?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/16419ce8394173028eddaeb992859862bab50cfcf74589fa9bb9a3dd8bb27518?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/16419ce8394173028eddaeb992859862bab50cfcf74589fa9bb9a3dd8bb27518?s=96&d=mm&r=g","caption":"Andrey Redko"},"description":"Andriy is a well-grounded software developer with more then 12 years of practical experience using Java\/EE, C#\/.NET, C++, Groovy, Ruby, functional programming (Scala), databases (MySQL, PostgreSQL, Oracle) and NoSQL solutions (MongoDB, Redis).","sameAs":["http:\/\/aredko.blogspot.com\/","http:\/\/ca.linkedin.com\/in\/aredko"],"url":"https:\/\/www.javacodegeeks.com\/author\/andrey-redko"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/43952","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/141"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=43952"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/43952\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/223"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=43952"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=43952"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=43952"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}