掲示板

Liferay 7 to make database read/write split

thumbnail
6年前 に Ying Wang によって更新されました。

Liferay 7 to make database read/write split

New Member 投稿: 22 参加年月日: 13/10/22 最新の投稿
I ever successfully configured database read/write split on 6.2. But liferay 7 seems different on configuration. So far I hasn't made it work.

I created portal-ext.properties. Uncommented "dynamic-data-source-spring.xml" in spring.infrastructure.configs.

spring.infrastructure.configs=\
META-INF/hibernate-spring.xml,\
\
META-INF/counter-infrastructure-spring.xml,\
\
#META-INF/dynamic-data-source-spring.xml,\ (I uncomment this line)
\
META-INF/infrastructure-spring.xml

Then I added jdbc.read and jdbc.write like following:

jdbc.write.driverClassName=com.mysql.jdbc.Driver
jdbc.write.password=root
jdbc.write.url=jdbc:mysql://192.168.31.132:3307/lportal?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
jdbc.write.username=root

jdbc.read.driverClassName=com.mysql.jdbc.Driver
jdbc.read.password=root
jdbc.read.url=jdbc:mysql://192.168.31.132:3308/lportal?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
jdbc.read.username=root

As you can see, though I have configured MySQL, it actually always run in HSQL:

10:07:52,324 INFO [localhost-startStop-1][DialectDetector:75] Determine dialect for HSQL Database Engine 2.3
10:07:52,468 WARN [localhost-startStop-1][DialectDetector:93] Liferay is configured to use Hypersonic as its database. Do NOT use Hypersonic in production. Hypersonic is an embedded database useful for development and demonstration purposes. The database settings can be changed in portal-ext.properties.
10:07:52,470 INFO [localhost-startStop-1][DialectDetector:148] Found dialect com.liferay.portal.dao.orm.hibernate.HSQLDialect
10:07:54,913 ERROR [localhost-startStop-1][PortalContextLoaderListener:114] java.lang.NullPointerException
java.lang.NullPointerException
at com.liferay.portal.kernel.servlet.DirectServletRegistryUtil.clearServlets(DirectServletRegistryUtil.java:27)
at com.liferay.portal.spring.context.PortalContextLoaderListener.contextDestroyed(PortalContextLoaderListener.java:132)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4859)
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5478)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:224)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:159)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:585)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1794)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
thumbnail
6年前 に Andrew Jardine によって更新されました。

RE: Liferay 7 to make database read/write split

Liferay Legend 投稿: 2416 参加年月日: 10/12/22 最新の投稿
Weird -- I had a look at the 6.2 portal.properties and the 7, as well as the XML configs and the differences are negligible (and I doubt they make a difference). Are you sure your portal-ext is being read? I've had a couple of moments in my past that proved to be a great source of frustration.

1. There was a portal-setup-wizard.properties -- which is actually loaded AFTER portal-ext that was overriding my db settings.

2. I had the wrong liferay.home property set so my portal-ext wasn't being loaded.

Can you check a little higher up in your log and make sure that your portal-ext is being loaded, and that there is no portal-setup-wizard (or that in your portal-ext you have the line

setup.wizard.enabled=false


just to make sure that there is nothing coming AFTER your portal-ext that is changing stuff?