Mysql 从JBoss AS 5到Wildfly 8的集群数据源迁移
我们计划从JBoss5迁移到Wildfly 8.2。在数据库方面,我们有一个三节点的Galera集群,其中包含MariaDB 10 在Jboss 5上,ds.xml文件中有以下设置:Mysql 从JBoss AS 5到Wildfly 8的集群数据源迁移,mysql,mariadb,jboss5.x,wildfly-8,galera,Mysql,Mariadb,Jboss5.x,Wildfly 8,Galera,我们计划从JBoss5迁移到Wildfly 8.2。在数据库方面,我们有一个三节点的Galera集群,其中包含MariaDB 10 在Jboss 5上,ds.xml文件中有以下设置: ... <connection-url>jdbc:mysql:loadbalance://ip-node1,ip-node2,ip-node3/DBname</connection-url> ... 如何将Wildfly连接到集群数据源?我知道可以插入HAProxy这样的外部负载平衡器,但
...
<connection-url>jdbc:mysql:loadbalance://ip-node1,ip-node2,ip-node3/DBname</connection-url>
...
如何将Wildfly连接到集群数据源?我知道可以插入HAProxy这样的外部负载平衡器,但我更愿意让架构尽可能简单。您必须在
standalone.xml
文件中提到数据源,该文件位于wildfly-8.2.0.Final_1\standalone\configuration\
中,如下所示
<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>
jdbc:postgresql://localhost:5432/DB1
博士后
DB1
DB1
jdbc:postgresql://localhost:5432/DB2
博士后
DB2
DB2
我已经尝试直接在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>