this is not ideal, I found a better solution for my case :
"""
- name: check if Redis replication has finished before proceeding
shell: /usr/bin/redis-cli -a {{ REDIS_PASSWORD }} -p {{ REDIS_SLAVE_PORT
}} info replication | grep master_link_status | cut -d":" -f2
register: result
until: result.stdout.find("up") != -1
retries: 5
delay: 10
"""
Thanks for the help !
On Wednesday, September 3, 2014 1:22:42 PM UTC+3, Frank Steffen wrote:
>
> You may delete or rotate the log file before.
>
> Am Dienstag, 2. September 2014 12:46:34 UTC+2 schrieb Nicolas G:
>>
>> Hi Frank, thanks for the reply.
>>
>> I was not aware of the search_regex thanks you, should be useful in
>> other cases but I don't thin in my case. The reason is if I need to restart
>> the services (redis/tomcat), tomcat will start immediately as it will find
>> the "Finished with success" from previous boot in the logs.
>>
>> On Monday, September 1, 2014 3:23:47 PM UTC+3, Frank Steffen wrote:
>>>
>>> Hi Nicolas,
>>>
>>> have you tried "wait_for"?
>>>
>>> Something like:
>>> wait_for: path=/var/log/redis.log search_regex="Finished with success"
>>> state=present
>>>
>>> Regards,
>>>
>>> Frank
>>>
>>>
>>> Am Montag, 1. September 2014 13:00:15 UTC+2 schrieb Nicolas G:
>>>>
>>>> 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.
>>>>
>>>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/704462ce-9a12-4572-b072-9a48d2deaed6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.