[JAVA][Liferay] Configure sharding in multiple sites
create databases first
portal-ext.properties配置
hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
hibernate.show_sql=true
jdbc.default.driverClassName=org.postgresql.Driver
jdbc.default.url=jdbc:postgresql://127.0.0.1:5432/lportal_default
jdbc.default.username=postgres
jdbc.default.password=xxx
jdbc.one.driverClassName=org.postgresql.Driver
jdbc.one.url=jdbc:postgresql://127.0.0.1:5432/lportal_one
jdbc.one.username=postgres
jdbc.one.password=xxx
value.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
[JAVA][Liferay] Configure sharding in multiple sites的更多相关文章
- Java: Replace a string from multiple replaced strings to multiple substitutes
Provide helper methods to replace a string from multiple replaced strings to multiple substitutes im ...
- [Java][Liferay] 如何从Javascript的function中获取language property的值
问题描述 在Portlet中,Javascript中通过Liferay.Language.get("key")的方式是拿不到自己添加的property的值,原因是Liferay.L ...
- [Java][Liferay] 解决Liferay ext项目deploy的问题
Liferay ext project在install war包之后需要重启服务器,重启服务器中会执行ExtHotDeployListener中的逻辑,这里有一个坑,如果是第二次以后install e ...
- [JAVA][Liferay] Duplicate key value violates unique constraint for resourcepermissionid in Liferay
Unexpected exception thrown when create new site: 09:47:10,114 ERROR [ajp-bio-8009-exec-113][JDBCExc ...
- [Java][Liferay] File system in liferay
EditFileEntryAction.java protected FileEntry updateFileEntry(PortletConfig portletConfig, ActionRequ ...
- [Java][Liferay] 模拟用户
以admin的帐号登陆 Navigation to Users and Organizations -> All Users 找到你要查看的user,点击Actions->Imperson ...
- [Java][Liferay] 解决在Linux系统中liferay-ext项目无法卸载的问题
今天遇到liferay-ext无法卸载,log中显示卸载了,但是在App Manager中依然可以看到安装过的ext,其中一个原因是webapps下面的**-ext文件夹的权限只有root才能修改,将 ...
- Java性能提示(全)
http://www.onjava.com/pub/a/onjava/2001/05/30/optimization.htmlComparing the performance of LinkedLi ...
- Spring Security Java Config Preview--官方
原文地址:[1]https://spring.io/blog/2013/07/02/spring-security-java-config-preview-introduction/ [2]https ...
随机推荐
- tableView 的协议方法
需遵守协议 UITableViewDataSource, UITableViewDelegate,并设置代理 UITableViewDelegate 继承自 UIScrollViewDelegate ...
- 【探讨】linux环境,执行重启了php后php.ini依然不生效
背景: 一个linux环境配置了多个php版本的环境,同时修改了多个php.ini,执行service php-fpm restart 之后,依然不生效 原因: 没有设置好启动php.ini 参考链接 ...
- ADX3000二层的负载均衡设计问题
我的想法是 想在现有的局域网内部,利用ADX划分出一个新的局域网,模拟负载均衡. 现在有三台试验机器,拓扑图如下: 各个机器IP设置如下图: 我进行了如下的操作: 1 在组网配置当中,设置eth1_0 ...
- P3369 【模板】普通平衡树(权值线段树)
原来线段树还有这种操作(开成一个桶) 用区间维护在这个区间内元素的个数,离散化一下,居然能达到splay的效果 不仅码量大大减少,而且跑的飞快!!! 6种操作 200多ms 插入 xx 数 删除 x ...
- Codeforces Round #503 (by SIS, Div. 2)B 1020B Badge (拓扑)
题目大意:每个同学可以指定一个人,然后构成一个有向图.1-n次查询,从某个人开始并放入一个东西,然后循环,直到碰到一个人已经放过了,就输出. 思路:直接模拟就可以了,O(n^2) 但是O(n)也可以实 ...
- springboot开发环境搭建
姓名:陈中娇 班级:软件151 第一步:在Eclipse下面配置Maven环境: 一.使用spring boot新建maven工程不在需要建立maven web工程,只要一般的maven工程就好了 ...
- 新建maven 父子模块项目
第一步: 第二步: 先创建个简单的空架结构作为父项目 第三步: 创建子项目 第四步: 切换显示不同的maven子项目显示方式 关于maven中的parent聚合一直都有没好好总结,固有这篇. ---- ...
- 使用nexus 搭建本地 maven 服务器
1.下载安装nexus oos https://www.sonatype.com/download-oss-sonatype ,选择2.x 版本. 2. 配置maven <server> ...
- linux防火墙添加端口
防火墙配置文件: /etc/sysconfig/iptables 1.使用命令查看端口开启情况(下图为安装时未选择开启防火墙) [root@fullstack ~]# iptables -L -n ...
- poj1964最大子矩阵 (单调栈加枚举)
题目传送门 题目大意: 一个矩阵中,求F组成的矩阵的面积,(答案乘以三). 思路:n如果是小于100的,就可以通过前缀和,然后三重循环暴力找,和poj1050很像,但由于是1000,就不可以了,时间复 ...