dynomite icon indicating copy to clipboard operation
dynomite copied to clipboard

What would happen when DataCenter1 crash and reover?

Open ghost opened this issue 12 years ago • 9 comments

step 1. Do i need to sync-up the data from Data Center 2 use the "SLAVEOF" command to full sync-up the data for each shard?

steop2. and then i need to stop the "SLAVEOF" and swith to master at some time?

step3. and then the Dynomite will start to replicate data to it?

How to ensure no data lost between step2 and step3.

ghost avatar Nov 14 '14 10:11 ghost

Yes, you can do that to warm-up the cache. If you have a node with the same token in another rack or DC, you can bring up a new node with warm data this way.

  1. Set a dynomite node that you want to warm up to stand-by state curl 'http://localhost:22222/standby' This will force the dynomite node to not process any read/write from clients or peers

  2. Now you can run your "SLAVEOF" to restore data from Redis peer to that new node

  3. When the slave sync is about to catch up to master (use redis 'info" command for this information), and before we're about to shut off the redis master-slave syncing traffics, we need to turn on the writes for this node. Using this step, the dynomite node can accept writes from both clients and peers but won't be able to store into Redis yet.

    curl 'http://localhost:22222/writes_only'

    The writes are just queued up into dynomite process' memory queue. Note that this won't turn on the reads yet.

  4. Turn of "SLAVEOF" and immediately flush out data from Dynomite process into Redis by sending this command into Dynomite's admin port. curl 'http://localhost:22222/resuming' This will allow dynomite to continue to accept writes and flush writes to Redis instead of queuing them.

  5. Then, run this to make Dynomite process to be back to NORMAL state which means it can accept both writes and reads. curl 'http://localhost:22222/normal'

timiblossom avatar Nov 14 '14 22:11 timiblossom

I think this whole thing can be embedded into a python script.
If you have the time, please submit us this script.

Internally, our 1st version of warming-up is actually this way and we have a tool in Java for that. We have realized a couple of drawbacks and will move to a better warmup method very soon.

timiblossom avatar Nov 14 '14 23:11 timiblossom

Well done @timiblossom , the Step3 to Step5 is just what i am looking for. It looks like that Dynomite resolve the problem by a memory queue and the node status.

BTW. i store the business data in Redis, not only the cache.

ghost avatar Nov 15 '14 11:11 ghost

hi @timiblossom , i still have a question: In the step 3 you mentioned, the write command will in both dynomite queue and also the redis "slave of " replication, some command like INCR, LPOP will have problem if they invoke twice. How do you think ?

ghost avatar Nov 19 '14 06:11 ghost

You are right for in the current version. We will probably get around this by providing a feature similar to Cassandra's read_repair along with read consistency.

timiblossom avatar Nov 24 '14 18:11 timiblossom

Hi,

I can't call any of the state commands from curl? Do I make something wrong?

curl 'http://192.168.33.20:22222/standby' curl: (52) Empty reply from server

Max.

mfouilleul avatar Dec 23 '14 13:12 mfouilleul

That is right. If you look at the code, the server does not return any byte. If you look at the server's console (with logging on of course), we would see:

GET /normal HTTP/1.1 User-Agent: curl/7.35.0 Host: 127.0.0.1:22222 Accept: /

0: GET 1: /normal 2: HTTP/1.1

timiblossom avatar Dec 31 '14 00:12 timiblossom

However, it makes sense that the server returns a string like "OK". Again, we are happy to accept your patch on this :).

timiblossom avatar Dec 31 '14 00:12 timiblossom

We have open sourced Dynomite-manager with the warm up process. It is well documented now in the wiki

ipapapa avatar Jul 13 '16 23:07 ipapapa