cancel
Showing results for 
Search instead for 
Did you mean: 

Read-only replicated server difficulties

johnwalsh
Champ in-the-making
Champ in-the-making
Hi,

I have two Alfresco servers, and am using rsync and mysql replication to replicate the master to the slave. The slave is set to read-only. I'm running into a series of bootstrap problems where I need to change Java bootstrap routines to not do the bootstrap operation if the instance is in read-only mode. So far, I've changed WorkflowInterpreter.java, DictionaryRepositoryBootstrap.java and DescriptorServiceImpl.java to wrap the functional parts of the bootstrap routines in "if (!transactionService.isReadOnly())" statements. The bootstrap operations in question are trying to affect changes to the repository and are failing because the repository is read-only.

I assume more classes will need changing before I'm done, and/or that something I'm commenting out will cause other problems that I'll have to deal with.

Is there a simpler way to make Alfresco replication with a read-only slave work? Have others done this?


FWIW: here's the way I'm setting the slave to read-only: alfresco/domain/transaction.properties
server.transaction.mode.readOnly=PROPAGATION_REQUIRED, readOnly
server.transaction.mode.default=PROPAGATION_REQUIRED, readOnly
server.transaction.allow-writes=false
server.transaction.max-retries=20

Thanks,
John
6 REPLIES 6

johnwalsh
Champ in-the-making
Champ in-the-making
It looks to me like repository replication can't work. The wiki sure seems to state that it does, and I'd sure like to be wrong wrong:


My slave instance is now proceeding through the boot process as far as the ModuleComponentHelper where the custom modules are started up. (I have two custom modules.) That work is done within a transaction. The attempt to get a transaction was failing because I have transactions configured to readOnly. My code can't skip custom module startup and still behave as desired, so I changed RetryingTransactionHelper to return a read-only transaction instead of failing when a read-write transaction is requested but the RetryingTransactionHelper's readOnly flag is set to true. My hope was that no writes would be required for the slave Alfresco instance. Unfortunately, that's not true. The following line in ModuleComponentHelper.startModule() attempts to write to the database and fails:
registryService.addProperty(moduleKeyCurrentVersion, moduleNewVersion);

This makes it appear that the system has to be allowed to write to the database if you need to include custom modules. For reasons documented in my previous post (conflicting primary key values), the slave in a replicated system cannot be allowed to write to the database. These conflicting truths seem to imply that Alfresco repository replication can't work if you have custom modules.

Does anyone have it working? How did you address slave writes to the database with MySQL replication of the database?

I hope I'm missing something, because repository replication is a really desirable feature. Any help would be appreciated.

Thanks,
John

johnwalsh
Champ in-the-making
Champ in-the-making
I haven't gotten any further with this. Any help would really be appreciated.

cbosdonnat
Champ in-the-making
Champ in-the-making
Hi John,

Is there a simpler way to make Alfresco replication with a read-only slave work? Have others done this?

Yes there is an easier way to do this. Just have a look at this article I recently wrote:
http://cedric.bosdonnat.free.fr/wordpress/?p=87&lang_view=en

The principle is easy: just turn the transactions as read-only, but not using a config file. This way you can turn Alfresco in a read-only mode without having to restart it. Then all the problems of data written at the startup can be forgotten. To turn your Alfresco read-only or read-write is then only one HTTP request.

I hope this helps

johnwalsh
Champ in-the-making
Champ in-the-making
Cedric,

Awesome. Thanks. You can do a lot with Alfresco, if you know where to look for inspiration. Nice sleuthing!

Thanks again,
John

janv
Employee
Employee
For reference, it is also possible to use JMX to set read-only mode, if you're using 2.2, 2.9C-dev or HEAD.

Regards,
Jan

cbosdonnat
Champ in-the-making
Champ in-the-making
Hi Jan,

For reference, it is also possible to use JMX to set read-only mode, if you're using 2.2, 2.9C-dev or HEAD.

That reminds me to have a serious look at JMX… Thanks for the info.

Cedric
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.