wildfly 10.1 mysql复制第二个数据库是只读异常

时间:2018-11-16 06:58:27

标签: mysql jboss regression wildfly wildfly-10

我开始使用Wildfly 10.1,并将mysql用作数据库。我有两个数据库,DB1和DB2。 D1断开连接后,Wildfly将连接到DB2。到目前为止,我已经做到了。但是,当我连接到DB2时,会出现“连接为只读”错误。我在这里Database Fail Over in Jboss Data sources看过了这个话题,但

> <connection-property name = "readOnly"> false </ connection-property>

无法解决。我正在寻找解决方案。我希望主/主不是主/从。在standalone.xml中的mysql配置中:

    <datasources>
        <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
            <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
            <driver>h2</driver>
            <security>
                <user-name>sa</user-name>
                <password>sa</password>
            </security>
        </datasource>
        <datasource jta="true" jndi-name="java:jboss/datasources/RailbaseLabDS" pool-name="RailbaseLabDS" enabled="true" use-java-context="true" use-ccm="true">
            <connection-url>jdbc:mysql://IP1:3306,IP2:3306/DBN?autoreconnect=true</connection-url>
            <driver-class>com.mysql.jdbc.Driver</driver-class>
            <driver>mysql</driver>
            <url-delimiter>|</url-delimiter>
            <security>
                <user-name>DBN</user-name>
                <password>DBN</password>
            </security>
            <validation>
                <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker"/>
                <check-valid-connection-sql>select 1</check-valid-connection-sql>
                <background-validation>true</background-validation>
                <background-validation-millis>5000</background-validation-millis>
            </validation>
        </datasource>
        <drivers>
            <driver name="h2" module="com.h2database.h2">
                <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
            </driver>
            <driver name="mysql" module="com.mysql">
                <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
            </driver>
        </drivers>
    </datasources>

0 个答案:

没有答案