RE: Lifreay Document Library Table Replication

Kevin Matthews, modified 5 Years ago. Expert Posts: 253 Join Date: 1/25/16 Recent Posts
Hello, has anyone done any DB replication on the document library tables for Liferay 7? This is usually a standard requirement to provide replication to another data center just in case of emergency.
If you have done replication what tables did you replicate and is there a detail procedure replicating tables in Liferay? I notice when I replicated the document library tables dlcontent,dlfileentry,dlfilerank,dlfileshortcut,dlfileversion,dlfolder when I click on the document portlet link there no doucment list and I get an error in the logs:Current URL /group/guest/~/control_panel/manage?p_p_id=com_liferay_document_library_web_portlet_DLAdminPortlet&p_p_lifecycle=0&p_p_state=maximized generates exception: java.lang.IllegalArgumentException: Someone may be trying to circumvent the permission checker: {companyId=20116, name=com.liferay.document.library.kernel.model.DLFileEntry, primKey=73054, scope=4}
com.liferay.portal.kernel.exception.NoSuchResourcePermissionException: {companyId=20116, name=com.liferay.document.library.kernel.model.DLFileEntry, primKey=73054, scope=4}
thumbnail
David H Nebinger, modified 5 Years ago. Liferay Legend Posts: 14933 Join Date: 9/2/06 Recent Posts
Do not "pick and choose" what to replicate; replicate the entire Liferay database. A single doc lib file touches on many different internal systems including the asset framework, doc lib, resource permissions, etc. Trying to cherry pick will end up just giving you a broken replicated environment, as evidenced by what you've already seen.


Additionally, if you are using a non-JDBC store, you have to replicate the filesystem as well to ensure the actual artifacts are available on the target system.
Kevin Matthews, modified 5 Years ago. Expert Posts: 253 Join Date: 1/25/16 Recent Posts
How would I be able to fix this error? Do I need to re-install the liferay portal? Or just replicating the entire DB would fix it?
David H Nebinger:

Do not "pick and choose" what to replicate; replicate the entire Liferay database. A single doc lib file touches on many different internal systems including the asset framework, doc lib, resource permissions, etc. Trying to cherry pick will end up just giving you a broken replicated environment, as evidenced by what you've already seen.


Additionally, if you are using a non-JDBC store, you have to replicate the filesystem as well to ensure the actual artifacts are available on the target system.
thumbnail
Olaf Kock, modified 5 Years ago. Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent Posts
Kevin Matthews:

How would I be able to fix this error? Do I need to re-install the liferay portal? Or just replicating the entire DB would fix it?
You'd best fix it by starting without breaking the database in the first place, just as David says: Don't pick and choose, replicate everything. Note that this might include database, filesystem (document library, deployed plugins etc), search index.
Kevin Matthews, modified 5 Years ago. Expert Posts: 253 Join Date: 1/25/16 Recent Posts
Thanks Olaf. So for liferay, in addition to not modify liferay tables, replicate specific tables is not good as well. If i am unable to recover from the error when I replicate the entire DB then it seems I would need to do re-install of the portal?
Olaf Kock:

Kevin Matthews:

How would I be able to fix this error? Do I need to re-install the liferay portal? Or just replicating the entire DB would fix it?
You'd best fix it by starting without breaking the database in the first place, just as David says: Don't pick and choose, replicate everything. Note that this might include database, filesystem (document library, deployed plugins etc), search index.
thumbnail
Olaf Kock, modified 5 Years ago. Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent Posts
Kevin Matthews:

Thanks Olaf. So for liferay, in addition to not modify liferay tables, replicate specific tables is not good as well. If i am unable to recover from the error when I replicate the entire DB then it seems I would need to do re-install of the portal?
I'm quite pragmatic with this: If you're unable to restore, I won't allow you to state that you have had a backup. Because (according to my principles) you're only allowed to call something a Backup if you have recently demonstrated that you are able to use this set of data to set up a completely new virgin system.
So: If you don't want to do a re-installation of your portal: Have a Backup ready and make sure it fits the criteria given. No matter if you recover live, this moment, or with the detour through cloud, tape or disk.
And yes: A partial copy of the database hardly counts as backup.
Kevin Matthews, modified 5 Years ago. Expert Posts: 253 Join Date: 1/25/16 Recent Posts
Thanks for the recommendation Olaf. noted. Happy Thanksgiving emoticon
Olaf Kock:

Kevin Matthews:

Thanks Olaf. So for liferay, in addition to not modify liferay tables, replicate specific tables is not good as well. If i am unable to recover from the error when I replicate the entire DB then it seems I would need to do re-install of the portal?
I'm quite pragmatic with this: If you're unable to restore, I won't allow you to state that you have had a backup. Because (according to my principles) you're only allowed to call something a Backup if you have recently demonstrated that you are able to use this set of data to set up a completely new virgin system.
So: If you don't want to do a re-installation of your portal: Have a Backup ready and make sure it fits the criteria given. No matter if you recover live, this moment, or with the detour through cloud, tape or disk.
And yes: A partial copy of the database hardly counts as backup.
thumbnail
David H Nebinger, modified 5 Years ago. Liferay Legend Posts: 14933 Join Date: 9/2/06 Recent Posts
Kevin Matthews:

So for liferay, in addition to not modify liferay tables, replicate specific tables is not good as well. If i am unable to recover from the error when I replicate the entire DB then it seems I would need to do re-install of the portal?
So I would first discard the replica; I think it's already in a bad state. Replace it by replicating the main system (db, filesystem, etc) and test and verify.

I don't think "re install" is really going to be required here; your primary instance is [seems to be] functional, it is just the replica that is causing problems. Getting the replica right should be the key to it being functional too.

Backup/restore is a pet peeve of Olaf, with good reason. All to often we hear folks saying they take backups, but if the restore process hasn't been tested, there is no guarantee that the backup itself has any real value. Just backing stuff up to check off a devops checklist is not enough, the restore process needs to be tested to prove that you can restore in the face of a disaster.
Kevin Matthews, modified 5 Years ago. Expert Posts: 253 Join Date: 1/25/16 Recent Posts
<p>OK I will proceed&nbsp;to replace the DB and filesystem from primary to target and see what results..</p>
Kevin Matthews, modified 5 Years ago. Expert Posts: 253 Join Date: 1/25/16 Recent Posts
David H Nebinger:

Kevin Matthews:

So for liferay, in addition to not modify liferay tables, replicate specific tables is not good as well. If i am unable to recover from the error when I replicate the entire DB then it seems I would need to do re-install of the portal?
So I would first discard the replica; I think it's already in a bad state. Replace it by replicating the main system (db, filesystem, etc) and test and verify.

I don't think "re install" is really going to be required here; your primary instance is [seems to be] functional, it is just the replica that is causing problems. Getting the replica right should be the key to it being functional too.

Backup/restore is a pet peeve of Olaf, with good reason. All to often we hear folks saying they take backups, but if the restore process hasn't been tested, there is no guarantee that the backup itself has any real value. Just backing stuff up to check off a devops checklist is not enough, the restore process needs to be tested to prove that you can restore in the face of a disaster.

Hi David, when you say file system do you mean the replacing the data/document_library file system or the entire liferay root folder? I have the system configure 3 ways dbstore,local store and advance file system store. With my advance file system store i have file replication on to a NAS storage. I am still awaiting the lportal db.
Kevin Matthews, modified 5 Years ago. Expert Posts: 253 Join Date: 1/25/16 Recent Posts
Kevin Matthews:

David H Nebinger:

Kevin Matthews:

So for liferay, in addition to not modify liferay tables, replicate specific tables is not good as well. If i am unable to recover from the error when I replicate the entire DB then it seems I would need to do re-install of the portal?
So I would first discard the replica; I think it's already in a bad state. Replace it by replicating the main system (db, filesystem, etc) and test and verify.

I don't think "re install" is really going to be required here; your primary instance is [seems to be] functional, it is just the replica that is causing problems. Getting the replica right should be the key to it being functional too.

Backup/restore is a pet peeve of Olaf, with good reason. All to often we hear folks saying they take backups, but if the restore process hasn't been tested, there is no guarantee that the backup itself has any real value. Just backing stuff up to check off a devops checklist is not enough, the restore process needs to be tested to prove that you can restore in the face of a disaster.

Hi David, when you say file system do you mean the replacing the data/document_library file system or the entire liferay root folder? I have the system configure 3 ways dbstore,local store and advance file system store. With my advance file system store i have file replication on to a NAS storage. I am still awaiting the lportal db.

Hi David, I copy the database and I able to see the artifacts in the document portlet=. Thanks for your advise.
Kevin Matthews, modified 5 Years ago. Expert Posts: 253 Join Date: 1/25/16 Recent Posts
Thanks David. Happy Thanksgiving emoticon