【问题标题】:Clustered datasource migration from JBoss AS 5 to Wildfly 8从 JBoss AS 5 到 Wildfly 8 的集群数据源迁移
【发布时间】:2015-09-17 14:21:46
【问题描述】:

我们计划从 Jboss 5 迁移到 Wildfly 8.2。在数据库方面,我们有一个带有 MariaDB 10 的三节点 Galera 集群。

在 Jboss 5 上,我们在 ds.xml 文件中有以下设置:

...
<connection-url>jdbc:mysql:loadbalance://ip-node1,ip-node2,ip-node3/DBname</connection-url>
...

在 Jboss 5 上一切正常。但在 Wildfly 8.2 上我无法达到同样的效果。从管理控制台,我能够毫无问题地添加一个非集群数据源并且它可以工作。 示例网址:jdbc:mysql://ip-node1/DBname

但是当我尝试像上面那样添加集群 URL 时,我收到以下错误:

Unexpected HTTP response: 500

Request
{
    "address" => [
        ("subsystem" => "datasources"),
        ("xa-data-source" => "dsName")
    ],
    "operation" => "test-connection-in-pool"
}

Response

Internal Server Error
{
    "outcome" => "failed",
    "failure-description" => "JBAS010440: failed to invoke operation: JBAS010447: Connection is not valid",
    "rolled-back" => true
}

如何将 Wildfly 连接到集群数据源?我知道可以插入像 HAProxy 这样的外部负载均衡器,但我希望架构尽可能简单。

【问题讨论】:

标签: mysql mariadb jboss5.x wildfly-8 galera


【解决方案1】:

您必须在wildfly-8.2.0.Final_1\standalone\configuration\ 内的standalone.xml 文件中提及数据源,如下所示。

 <datasource jndi-name="java:/jdbc/DB1" pool-name="PostgresDS" enabled="true" use-java-context="true">
                        <connection-url>jdbc:postgresql://localhost:5432/DB1</connection-url>
                        <driver>postgres</driver>
                        <security>
                            <user-name>DB1</user-name>
                            <password>DB1</password>
                        </security>
                    </datasource>
                    <datasource jndi-name="java:/jdbc/DB2" pool-name="PostgresDS1" enabled="true" use-java-context="true">
                        <connection-url>jdbc:postgresql://localhost:5432/DB2</connection-url>
                        <driver>postgres</driver>
                        <security>
                            <user-name>DB2</user-name>
                            <password>DB2</password>
                        </security>
                    </datasource>

【讨论】:

  • 我已经尝试直接在standalone.xml 中或从管理界面定义数据源。如果我使用非集群数据源,两者都可以工作。但是,当我在最初的示例中使用集群数据源时,没有任何效果。
猜你喜欢
  • 2014-07-16
  • 2015-05-09
  • 2015-12-19
  • 1970-01-01
  • 2015-05-21
  • 2021-02-22
  • 2018-09-16
  • 2021-08-26
  • 2017-06-24
相关资源
最近更新 更多