Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Offline backup script

Avatar

Former Community Member

Hi,

Using AEM 6.2 SP1 on windows.

I've been asked if we can script an offline backup (stop server, clone dir, start server).

Question: How do you suggest detecting the server has stopped cleanly?

Thanks

Joel

1 Accepted Solution

Avatar

Correct answer by
Level 2

In your compaction script add a sleep time of 45 seconds (depending on how long your instance takes to shutdown + 20 seconds) after you've shutdown AEM server as part of your script.

View solution in original post

8 Replies

Avatar

Correct answer by
Level 2

In your compaction script add a sleep time of 45 seconds (depending on how long your instance takes to shutdown + 20 seconds) after you've shutdown AEM server as part of your script.

Avatar

Former Community Member

Yes, I can add a 30 minute sleep, and that will likely be enough for any size server. I was more thinking of pinging the server until I don't get a ping back, or checking the logs for something.

Considering we'll backup during off hours, a 15 or 30 minute delay might be sufficient.

Avatar

Level 10

More info from the product team -- 

Based on previous discussions that we’ve had here, with Oak, there is no need to stop the server.  You can actually just clone the directory while it is running.  The only thing to be mindful of is that we need to ensure consistency between the nodestore and datastore in the backups.  You can ensure this by backing up the nodestore first and the datastore second.  As long as garbage collection has not been run between these steps, everything should be fine.  Scripting this process through a tool like rsync should be pretty straightforward.

Avatar

Former Community Member

Looking here: https://docs.adobe.com/docs/en/aem/6-2/administer/content/backup-and-restore.html#Offline Backup

There is an inconsistency.

> As long as garbage collection has not been run between these steps, everything should be fine. 

I can't see any easy way of detecting a GC. If we need to be live 24/7, I'll look into rsync

We'll be fine with shutting down and backing up via the OS and a homegrown script.

Thanks Scott

Avatar

Level 1

Hi smacdonald,

do we have a adobe doc or adobe support comments  regarding the usage of rsync? we are seriously considering this RSYNC option for online backup?

Regards

Surya

Avatar

Level 1

so when we are not having separate data store(everything in segment store) i don't think this applies "The only thing to be mindful of is that we need to ensure consistency between the nodestore and datastore in the backups." right?

Avatar

Level 4

I would suggest you make a small modification to the stop.bat file so that it removes the conf/cq.pid even on a successful ERRORLEVEL return code.  Then, have your backup script detect the presence of conf/cq.pid (is removed) before starting the backup function using whatever method you are using.  Put a timer loop in the backup script detection of the cq.pid file and fail out after some unusual amount of time (say 10-15 minutes) so that if the cq.pid file is never removed you get some message/error/warning/failure and don't get stuck in an infinite loop.  This will be more graceful to the AEM shutdown of threads, child-processes, etcetera before starting your backup.  You will also not be bound to a timer but a state and behavior which should be safer.