Hi,
We use a single redis master server and many slave nodes that are running tomcat along with the redis slave service.
One of the problems I have is that I need my tomcat application to start when the replication is completed, on my playbook I first install and start redis slave service before tomcat but it seems tomcat service starts before the replication is completed which is not acceptable. How can I have Ansible to check when the redis replication was completed so it can THEN start tomcat ?
I could add a pause command but the replication time is something that will change in the future along with our database, I’m able to check for the replication status using the redis cli command or inspecting the redis log file :
CLI
/usr/bin/redis-cli -a <password> -p <slave_port> info replication
Log
“”"
[11347] 01 Sep 09:05:54.259 # Server started, Redis version 2.8.13
[11347] 01 Sep 09:06:17.406 * DB loaded from append only file: 23.148 seconds
[11347] 01 Sep 09:06:17.406 * The server is now ready to accept connections on port 6380
[11347] 01 Sep 09:06:18.259 * Connecting to MASTER master-redis[.example.com:6379](http://asset-feed.cogmatch.net:6379/)
[11347] 01 Sep 09:06:18.261 * MASTER <-> SLAVE sync started
[11347] 01 Sep 09:06:18.263 * Non blocking connect for SYNC fired the event.
[11347] 01 Sep 09:06:18.264 * Master replied to PING, replication can continue...
[11347] 01 Sep 09:06:18.264 * Partial resynchronization not possible (no cached master)
[11347] 01 Sep 09:06:18.265 * Full resync from master: 16d5e3d27f324kjdf2d10e5c8dadae90186ab85bd51:72507275921
[11347] 01 Sep 09:06:40.402 * MASTER <-> SLAVE sync: receiving 1672419047 bytes from master
[11347] 01 Sep 09:07:32.165 * MASTER <-> SLAVE sync: Flushing old data
[11347] 01 Sep 09:07:40.012 * MASTER <-> SLAVE sync: Loading DB in memory
[11347] 01 Sep 09:07:59.408 * MASTER <-> SLAVE sync: Finished with success
“”"
Can you please advise ?
Regards,
Nicolas.