[JAVA][Liferay] Configure sharding in multiple sites
create databases first
portal-ext.properties配置
hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
hibernate.show_sql=truejdbc.default.driverClassName=org.postgresql.Driver
jdbc.default.url=jdbc:postgresql://127.0.0.1:5432/lportal_default
jdbc.default.username=postgres
jdbc.default.password=xxxjdbc.one.driverClassName=org.postgresql.Driver
jdbc.one.url=jdbc:postgresql://127.0.0.1:5432/lportal_one
jdbc.one.username=postgres
jdbc.one.password=xxxvalue.object.entity.cache.enabled.com.liferay.portal.model.Contact=false
shard.default.name=default
shard.available.names=default,one
shard.selector=com.liferay.portal.dao.shard.ManualShardSelector
counter.jdbc.prefix=jdbc.counter.
jdbc.counter.maxPoolSize=30
jdbc.counter.minPoolSize=1
jdbc.counter.numHelperThreads=1
counter.increment=100 spring.configs=\META-INF/base-spring.xml,\\META-INF/hibernate-spring.xml,\META-INF/infrastructure-spring.xml,\META-INF/management-spring.xml,\\META-INF/util-spring.xml,\\META-INF/jpa-spring.xml,\\META-INF/executor-spring.xml,\\META-INF/audit-spring.xml,\META-INF/cluster-spring.xml,\META-INF/editor-spring.xml,\META-INF/jcr-spring.xml,\META-INF/ldap-spring.xml,\META-INF/messaging-core-spring.xml,\META-INF/messaging-misc-spring.xml,\META-INF/mobile-device-spring.xml,\META-INF/notifications-spring.xml,\META-INF/poller-spring.xml,\META-INF/rules-spring.xml,\META-INF/scheduler-spring.xml,\META-INF/search-spring.xml,\META-INF/workflow-spring.xml,\\META-INF/counter-spring.xml,\META-INF/mail-spring.xml,\META-INF/portal-spring.xml,\META-INF/portlet-container-spring.xml,\META-INF/staging-spring.xml,\META-INF/virtual-layouts-spring.xml,\\META-INF/monitoring-spring.xml,\\META-INF/dynamic-data-source-spring.xml,\META-INF/shard-data-source-spring.xml,\\classpath*:META-INF/ext-spring.xml
liferay-portal-6.2-ce-ga6/tomcat-7.0.62/webapps/ROOT/WEB-INF/classes/META-INF/shard-data-source-spring.xml
<?xml version="1.0"?>
<beans default-destroy-method="destroy" default-init-method="afterPropertiesSet"xmlns="http://www.springframework.org/schema/beans"xmlns:aop="http://www.springframework.org/schema/aop"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"><bean id="liferayDataSource" class="org.springframework.jdbc.datasource.DelegatingDataSource"><property name="targetDataSource"><bean class="org.springframework.aop.framework.ProxyFactoryBean"><property name="targetSource" ref="shardDataSourceTargetSource" /></bean></property></bean><bean id="liferayHibernateSessionFactory" class="org.springframework.aop.framework.ProxyFactoryBean"><property name="targetSource" ref="shardSessionFactoryTargetSource" /></bean><bean id="lportal_default" class="org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy"><property name="targetDataSource"><bean class="com.liferay.portal.dao.jdbc.spring.DataSourceFactoryBean"><property name="propertyPrefix" value="jdbc.default." /></bean></property></bean><bean id="lportal_one" class="org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy"><property name="targetDataSource"><bean class="com.liferay.portal.dao.jdbc.spring.DataSourceFactoryBean"><property name="propertyPrefix" value="jdbc.one." /></bean></property></bean><bean id="shardDataSourceTargetSource" class="com.liferay.portal.dao.shard.ShardDataSourceTargetSource"><property name="dataSources"><map><entry><key><value>default</value></key><ref bean="lportal_default" /></entry><entry><key><value>one</value></key><ref bean="lportal_one" /></entry></map></property></bean><bean id="shardSessionFactoryTargetSource" class="com.liferay.portal.dao.shard.ShardSessionFactoryTargetSource"><property name="shardDataSourceTargetSource" ref="shardDataSourceTargetSource" /></bean><bean id="com.liferay.portal.kernel.dao.jdbc.MappingSqlQueryFactoryUtil" class="com.liferay.portal.kernel.dao.jdbc.MappingSqlQueryFactoryUtil"><property name="mappingSqlQueryFactory"><bean class="com.liferay.portal.dao.shard.ShardMappingSqlQueryFactoryImpl" /></property></bean><bean id="com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil" class="com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil"><property name="sqlUpdateFactory"><bean class="com.liferay.portal.dao.shard.ShardSqlUpdateFactoryImpl" /></property></bean><bean id="com.liferay.portal.kernel.dao.shard.ShardUtil" class="com.liferay.portal.kernel.dao.shard.ShardUtil"><property name="shard"><bean class="com.liferay.portal.dao.shard.ShardImpl"><property name="shardAdvice" ref="com.liferay.portal.dao.shard.advice.ShardAdvice" /></bean></property></bean><bean id="com.liferay.portal.kernel.util.InfrastructureUtil" class="com.liferay.portal.kernel.util.InfrastructureUtil"><property name="dataSource" ref="liferayDataSource" /><property name="mailSession" ref="mailSession" /><property name="shardDataSourceTargetSource" ref="shardDataSourceTargetSource" /><property name="shardSessionFactoryTargetSource" ref="shardSessionFactoryTargetSource" /><property name="transactionManager" ref="liferayTransactionManager" /></bean><bean id="com.liferay.portal.dao.shard.advice.ShardAdvice" class="com.liferay.portal.dao.shard.advice.ShardAdvice"><property name="shardDataSourceTargetSource" ref="shardDataSourceTargetSource" /><property name="shardSessionFactoryTargetSource" ref="shardSessionFactoryTargetSource" /></bean><bean id="com.liferay.portal.dao.shard.advice.ShardCompanyAdvice" class="com.liferay.portal.dao.shard.advice.ShardCompanyAdvice"><property name="shardAdvice" ref="com.liferay.portal.dao.shard.advice.ShardAdvice" /></bean><bean id="com.liferay.portal.dao.shard.advice.ShardPortletAdvice" class="com.liferay.portal.dao.shard.advice.ShardPortletAdvice"><property name="shardAdvice" ref="com.liferay.portal.dao.shard.advice.ShardAdvice" /></bean><bean id="com.liferay.portal.dao.shard.advice.ShardPersistenceAdvice" class="com.liferay.portal.dao.shard.advice.ShardPersistenceAdvice"><property name="shardAdvice" ref="com.liferay.portal.dao.shard.advice.ShardAdvice" /></bean><bean id="com.liferay.portal.dao.shard.advice.ShardGloballyAdvice" class="com.liferay.portal.dao.shard.advice.ShardGloballyAdvice"><property name="shardAdvice" ref="com.liferay.portal.dao.shard.advice.ShardAdvice" /></bean><bean id="com.liferay.portal.dao.shard.advice.ShardIterativelyAdvice" class="com.liferay.portal.dao.shard.advice.ShardIterativelyAdvice"><property name="shardAdvice" ref="com.liferay.portal.dao.shard.advice.ShardAdvice" /></bean><bean id="com.liferay.portal.dao.shard.advice.ShardParameterAdvice" class="com.liferay.portal.dao.shard.advice.ShardParameterAdvice"><property name="shardAdvice" ref="com.liferay.portal.dao.shard.advice.ShardAdvice" /></bean><aop:config proxy-target-class="false"><aop:advisor advice-ref="com.liferay.portal.dao.shard.advice.ShardCompanyAdvice" pointcut="bean(com.liferay.portal.service.CompanyLocalService)" /><aop:advisor advice-ref="com.liferay.portal.dao.shard.advice.ShardGloballyAdvice" pointcut="execution(void com.liferay.portal.convert.messaging.ConvertProcessMessageListener.receive(..))" /><aop:advisor advice-ref="com.liferay.portal.dao.shard.advice.ShardGloballyAdvice" pointcut="execution(void com.liferay.portal.events.StartupHelper.updateIndexes())" /><aop:advisor advice-ref="com.liferay.portal.dao.shard.advice.ShardGloballyAdvice" pointcut="execution(void com.liferay.portal.events.StartupHelper.upgradeProcess(int))" /><aop:advisor advice-ref="com.liferay.portal.dao.shard.advice.ShardGloballyAdvice" pointcut="execution(* com.liferay.portal.service.ReleaseLocalService.getBuildNumberOrCreate())" /><aop:advisor advice-ref="com.liferay.portal.dao.shard.advice.ShardGloballyAdvice" pointcut="execution(void com.liferay.portal.service.ServiceComponentLocalService.upgradeDB(..))" /><aop:advisor advice-ref="com.liferay.portal.dao.shard.advice.ShardGloballyAdvice" pointcut="execution(void com.liferay.portlet.journal.service.JournalArticleLocalService.checkArticles())" /><aop:advisor advice-ref="com.liferay.portal.dao.shard.advice.ShardIterativelyAdvice" pointcut="execution(void com.liferay.portal.events.StartupHelper.verifyProcess(boolean, boolean))" /><aop:advisor advice-ref="com.liferay.portal.dao.shard.advice.ShardParameterAdvice" pointcut="execution(* com.liferay.portal.service.AccountLocalService.getAccount(long, long))" /><aop:advisor advice-ref="com.liferay.portal.dao.shard.advice.ShardParameterAdvice" pointcut="execution(* com.liferay.portal.service.GroupLocalService.getCompanyGroup(long))" /><aop:advisor advice-ref="com.liferay.portal.dao.shard.advice.ShardParameterAdvice" pointcut="execution(* com.liferay.portal.service.UserLocalService.searchCount(..))" /><aop:advisor advice-ref="com.liferay.portal.dao.shard.advice.ShardPersistenceAdvice" pointcut="bean(*Persistence) || bean(*Finder)" /><aop:advisor advice-ref="com.liferay.portal.dao.shard.advice.ShardPortletAdvice" pointcut="bean(com.liferay.portal.service.PortletLocalService)" /></aop:config>
</beans>
generate tables in server administrator
转载于:https://www.cnblogs.com/chenyongblog/p/8082547.html
[JAVA][Liferay] Configure sharding in multiple sites相关推荐
- java liferay,用一个简单的Java code获取当前用户的Liferay
I'm working with : Liferay 6.0.6 with JBoss 5.1 and Struts2. My question is, how to get the current ...
- java liferay 框架_liferay6.2-生成布局模板
现在你可以添加portlets到页面,通过拖放从Add菜单.但是liferay的页面布局选项可能对你来说有一定的局限,或者你会发现重复性的向同样类型的页面添加相同的portlets,不要沮丧,我们可以 ...
- Liferay研究-smilingleo
http://blog.csdn.net/smilingleo/article/details/1859908 Liferay研究之一:Ext环境的搭建 本篇主要介绍如何搭建Ext开发环境.网上也有很 ...
- Install And Configure ColdFusion MX 6.1 on Windows
I've made the case for ColdFusion, but you still need to know how to install it! In this tutorial, I ...
- 如何设置Java Spring Boot JWT授权和认证
In the past month, I had a chance to implement JWT auth for a side project. I have previously worked ...
- Spring Security Java Config Preview--官方
原文地址:[1]https://spring.io/blog/2013/07/02/spring-security-java-config-preview-introduction/ [2]https ...
- matlab builder for java下载,Matlab Builder JA - Compile Matlab into a Java jar - Free Version?
问题 Please keep in mind that I know nothing about Matlab. Matlab Builder JA lets developer build Matl ...
- java开源项目源代码_java开源项目源代码
java开源项目 源代码 http://www.codase.com/ http://java-source.net/ https://www.dev.java.net/ 名称 摘要 种类 appfu ...
- Java资源大全中文版(转)
Java资源大全中文版(Awesome最新版) Awesome系列的Java资源整理.awesome-java 就是akullpp发起维护的Java资源列表,内容包括:构建工具.数据库.框架.模板.安 ...
最新文章
- 思维dp ---- CF41D Pawn [可达状态统计dp]
- Ubuntu下使用GDB断点Go程序
- git 解决多人修改相同的文件导致的冲突
- STM32 进阶教程 16 - ADC1与ADC2同步采样
- 我常用的python函数(part3)--time.sleep方法
- 组合数学与数论函数专题
- C#集合类型总结和性能分析
- 2012年6月份第4周51Aspx源码发布详情
- Java-note-调试小技巧
- 动态规划01背包问题入门学习,详细笔记,推荐阅读
- R数据处理包plyr:超越apply函数族的向量化运算
- MySQL Workbench建表时 PK NN UQ B UN ZF AI G的含义
- opcode php 5.4,为PHP5.4开启Zend OPCode缓存
- 兆骑科创创新创业大赛活动举办,线上直播路演,投融资对接
- 【DNF/YUM】如何利用iso文件建立本地软件仓库
- 【CodeForces - 869】 A B C E 【组合数打表】
- Chrome插件 Redux DevTools
- 阿里云弹性EIP和固定公网IP的区别
- HackTheBox-Chase
- 元数据管理工具Atlas学习笔记之使用
热门文章
- Optional java 用法_Java8 Optional 的正确使用方式
- arcgiss如何在空白点图层加入坐标_连载 | 21 QGIS工程文件属性设置(2)——坐标参照系、变换、默认样式、数据源、关系和变量...
- oracle dataguard延迟,Oracle DataGuard延迟应用归档归档日志
- Zookeeper一致性级别分析,面试题附答案
- python【蓝桥杯vip练习题库】ADV-9 递归倒置字符数组
- TensorFlow框架--Keras
- Python程序设计题解【蓝桥杯官网题库】 DAY9-基础练习
- 堆排序最坏时间复杂度
- python中fib什么意思_Python斐波那契数列是什么?怎么用?
- python在坐标轴上画矩形_Python使用matplotlib实现在坐标系中画一个矩形的方法