Liferay 集群中在一个节点上上传照片另外一个节点

Reproduce the procedure:

上次他们有一个集群上的问题,就是从节点1的控制面板中,上传一个图片,然后关闭节点1, 从节点2中看不到这个图片。这个问题的流程如下:

Following are the steps for the clustering issues

Go to Control Panel. Click on "Documents and Media" from Left Nav. Add folder Add Basic document . Browse Image Add the Web content port let And configure it to use the above add image.

我后来在深入研究这个过程之后,解决了这个问题:

解决方法1: 用数据库存储media资源,以Blob形式:

Solution:

<!(1)   In each node ,add the following lines in ${liferay_home}/portal-ext.properties:

   #added by charles to use the DBStore instead of default FileSystemStore when configuring the document library  dl.store.impl=com.liferay.portlet.documentlibrary.store.DBStore        #added by charles to fix the dbStore problem ,use the new portal hibernate mapping file    hibernate.configs=\          META-INF/mail-hbm.xml,\          META-INF/portal-hbm-new.xml,\          META-INF/ext-hbm.xml    

<!--[if !supportLists]-->(2)   <!--[endif]-->In each node ,copy the portal-hbm-new.xml from the attachment to /ROOT/WEB-INF/classes/META-INF/ folder.

Reason for this solution: 

                When we add “Basic Document” to  created folder in control panel ,the liferay system will do the following tasks:

                You can read my article for very detailed analysis process.

 

<!--[if !supportLists]-->a.       <!--[endif]-->Add an entry in “DLFILEENTRY” table to stand for the new added document.

<!--[if !supportLists]-->b.      <!--[endif]-->Add an entry in  “DLFILEENTRYVERSION” table to record the version information of the new added document ,it will related to “DLFILEENTRY” table by foreign key “fileEntryId”

<!--[if !supportLists]-->c.       <!--[endif]-->Update the new posted timestamp in “DLFOLDER” table ,which means the latest timestamp that this folder has been posted by some file.

<!--[if !supportLists]-->d.      <!--[endif]-->Add an entry in “ASSETENTRY” table ,because  file is also one kind of asset. This table will be related to “DLFILEENTRY” table by foreign key “classpk”

<!--[if !supportLists]-->e.       <!--[endif]-->Upload the file to the store based on the liferay server configuration: 

In DLStoreImpl class addFile method: 

public void addFile(                    long companyId, long repositoryId, String fileName,                    boolean validateFileExtension, File file)              throws PortalException, SystemException {                 validate(fileName, validateFileExtension, file);                 if (PropsValues.DL_STORE_ANTIVIRUS_ENABLED) {                    AntivirusScannerUtil.scan(file);              }                 store.addFile(companyId, repositoryId, fileName, file);     }    

Actually ,the Liferay framework has supplied 5 kinds of implementations for Store :

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/6c1bd4cea160688057e7461b4f982c72.html