gpt4 book ai didi

mysql - EMM - 从 H2 迁移到 Mysql

转载 作者:行者123 更新时间:2023-11-29 12:05:01 25 4
gpt4 key购买 nike

我想更改我的数据库并将其设置为 mysql 我通过 How to migrate from H2 to MySQL 但无法连接到任何控制台!

这是对 master-datasources.xml 所做的更改:

       <datasource>
<name>WSO2_EMM_DB</name>
<description>The datasource used for EMM</description>
<jndiConfig>
<name>jdbc/WSO2EMMDB</name>
</jndiConfig>
<definition type="RDBMS">
<configuration>
<url>jdbc:mysql://localhost:3306/WSO2EMM_DB</url> // I also try by setting ip address
<username>admin</username>
<password>******</password>
<driverClassName>com.mysql.jdbc.Driver</driverClassName>
<maxActive>50</maxActive>
<maxWait>60000</maxWait>
<testOnBorrow>true</testOnBorrow>
<validationQuery>SELECT 1</validationQuery>
<validationInterval>30000</validationInterval>
</configuration>
</definition>
</datasource>

WSO2_CARBON_DB 和 WSO2AM_DB 的编辑方式也与 WSO2AM_DB 类似。

我检查了数据库,所有数据库都已创建,here 是图像。

服务器运行在win 7上,mysql版本是5.6。

这是碳 log 和网络浏览器中的 error

编辑:

这是碳日志的一部分:

 {org.wso2.carbon.user.core.util.DatabaseUtil} -  Database Error - Unknown database 'wso2carbon_db' {org.wso2.carbon.user.core.util.DatabaseUtil} com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown database 'wso2carbon_db'   
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:353)
...

编辑2:

这是经过更改的 master-datasources.xml:

<datasources-configuration xmlns:svns="http://org.wso2.securevault/configuration">
<providers>
<provider>org.wso2.carbon.ndatasource.rdbms.RDBMSDataSourceReader</provider>
</providers>

<datasources>

<datasource>
<name>wso2_emm_db</name>
<description>The datasource used for EMM</description>
<jndiConfig>
<name>jdbc/WSO2EMMDB</name>
</jndiConfig>
<definition type="RDBMS">
<configuration>
<url>jdbc:mysql://localhost:3306/wso2_emm_db</url>
<username>admin</username>
<password>123456</password>
<driverClassName>com.mysql.jdbc.Driver</driverClassName>
<maxActive>50</maxActive>
<maxWait>60000</maxWait>
<testOnBorrow>true</testOnBorrow>
<validationQuery>SELECT 1</validationQuery>
<validationInterval>30000</validationInterval>
</configuration>
</definition>
</datasource>

<datasource>
<name>wso2_carbon_db</name>
<description>The datasource used for registry and user manager</description>
<jndiConfig>
<name>jdbc/WSO2CarbonDB</name>
</jndiConfig>
<definition type="RDBMS">
<configuration>
<url>jdbc:mysql://localhost:3306/wso2_carbon_db</url>
<username>admin</username>
<password>123456</password>
<driverClassName>com.mysql.jdbc.Driver</driverClassName>
<maxActive>50</maxActive>
<maxWait>60000</maxWait>
<!-- <minIdle>5</minIdle>-->
<testOnBorrow>true</testOnBorrow>
<validationQuery>SELECT 1</validationQuery>
<validationInterval>30000</validationInterval>
</configuration>
</definition>
</datasource>

<datasource>
<name>WSO2_IDENTITY_DB</name>
<description>The datasource used for Identity configurations</description>
<jndiConfig>
<name>jdbc/WSO2IdentityDB</name>
</jndiConfig>
<definition type="RDBMS">
<configuration>
<url>jdbc:h2:repository/database/WSO2IDENTITY_DB;DB_CLOSE_ON_EXIT=FALSE</url>
<username>wso2carbon</username>
<password>wso2carbon</password>
<driverClassName>org.h2.Driver</driverClassName>
<maxActive>50</maxActive>
<maxWait>60000</maxWait>
<testOnBorrow>true</testOnBorrow>
<validationQuery>SELECT 1</validationQuery>
<validationInterval>30000</validationInterval>
</configuration>
</definition>
</datasource>

<datasource>
<name>SOCIAL_CACHE</name>
<description>The datasource used for storing the cached social objects.</description>
<jndiConfig>
<name>jdbc/test</name>
</jndiConfig>
<definition type="RDBMS">
<configuration>
<url>jdbc:h2:repository/database/WSO2SOCIAL_CACHE_DB;DB_CLOSE_ON_EXIT=FALSE</url>
<username>wso2carbon</username>
<password>wso2carbon</password>
<driverClassName>org.h2.Driver</driverClassName>
<maxActive>50</maxActive>
<maxWait>60000</maxWait>
</configuration>
</definition>
</datasource>

<datasource>
<name>SOCIAL_CASSANDRA_DB</name>
<description>The cassandra datasource used for storing social activities</description>
<definition type="RDBMS">
<configuration>
<url>jdbc:cassandra://localhost:9160/EVENT_KS</url>
<username>admin@admin.com</username>
<password>admin</password>
<driverClassName>org.apache.cassandra.cql.jdbc.CassandraDriver</driverClassName>
</configuration>
</definition>
</datasource>

<datasource>
<name>wso2am_db</name>
<description>The datasource used for API Manager database</description>
<jndiConfig>
<name>jdbc/WSO2AM_DB</name>
</jndiConfig>
<definition type="RDBMS">
<configuration>
<!-- add line below -->
<defaultAutoCommit>false</defaultAutoCommit>
<url>jdbc:mysql://localhost:3306/wso2am_db</url>
<username>admin</username>
<password>123456</password>
<driverClassName>com.mysql.jdbc.Driver</driverClassName>
<maxActive>50</maxActive>
<maxWait>60000</maxWait>
<testOnBorrow>true</testOnBorrow>
<validationQuery>SELECT 1</validationQuery>
<validationInterval>30000</validationInterval>
</configuration>
</definition>
</datasource>

<datasource>
<name>JAGH2</name>
<description>The datasource used for by the Jaggery Storage Manager</description>
<jndiConfig>
<name>jdbc/test</name>
</jndiConfig>
<definition type="RDBMS">
<configuration>
<url>jdbc:h2:~/test;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=60000</url>
<username>sa</username>
<password></password>
<driverClassName>org.h2.Driver</driverClassName>
<maxActive>50</maxActive>
<maxWait>60000</maxWait>
</configuration>
</definition>
</datasource>
</datasources>

编辑3:

无需更改 user-mgt.xml 和注册表 xml,因此我将它们从问题中删除。进行此更改后,我重新启动服务器,现在控制台已加载,但我无法登录到 emm consol,我收到错误 500:

192.168.1.157 - - [28/Jul/2015:19:05:17 +0430] "POST /emm/acs HTTP/1.1" 500 1042 "https://192.168.1.157:9443/commonauth" "Mozilla/5.0 (Windows NT 6.1; WOW64) 

AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36"

但我可以登录发布商和商店控制台。

这是重新启动后 http-accesswso2carbon 的完整日志。

编辑4:我在编辑 2 中更改了 master-datasources.xml ,这是 databases

最佳答案

您的配置似乎存在命名问题。我们可以按照以下步骤操作吗?

  1. 获取新的 EMM 包。
  2. 使用以下名称创建 4 个空 mysql 数据库:WSO2AM_DB、WSO2CARBON_DB、WSO2EMM_DB 和 WSO2IDENTITY_DB。
  3. 将您的 master-datasources.xml 文件替换为本答案中的附件 [1]。
  4. 更改 mysql 用户名和密码以匹配您的用户名和密码。
  5. 使用“sh ./wso2server.sh -Dsetup”命令运行包。

您应该能够按照这些方法解决您的问题。否则尝试解决现有包中的问题就是浪费时间。

[1] - MASTER-DATASOURCES.XML 文件

<datasources-configuration xmlns:svns="http://org.wso2.securevault/configuration">
<providers>
<provider>org.wso2.carbon.ndatasource.rdbms.RDBMSDataSourceReader</provider>
</providers>

<datasources>
<datasource>
<name>WSO2_EMM_DB</name>
<description>The datasource used for EMM</description>
<jndiConfig>
<name>jdbc/WSO2EMMDB</name>
</jndiConfig>
<definition type="RDBMS">
<configuration>
<url>jdbc:mysql://localhost:3306/WSO2EMM_DB</url>
<username>root</username>
<password>root</password>
<driverClassName>com.mysql.jdbc.Driver</driverClassName>
<maxActive>50</maxActive>
<maxWait>60000</maxWait>
<testOnBorrow>true</testOnBorrow>
<validationQuery>SELECT 1</validationQuery>
<validationInterval>30000</validationInterval>
</configuration>
</definition>
</datasource>
<datasource>
<name>WSO2_CARBON_DB</name>
<description>The datasource used for registry and user manager</description>
<jndiConfig>
<name>jdbc/WSO2CarbonDB</name>
</jndiConfig>
<definition type="RDBMS">
<configuration>
<url>jdbc:mysql://localhost:3306/WSO2CARBON_DB</url>
<username>root</username>
<password>root</password>
<driverClassName>com.mysql.jdbc.Driver</driverClassName>
<maxActive>50</maxActive>
<maxWait>60000</maxWait>
<testOnBorrow>true</testOnBorrow>
<validationQuery>SELECT 1</validationQuery>
<validationInterval>30000</validationInterval>
</configuration>
</definition>
</datasource>

<datasource>
<name>WSO2_IDENTITY_DB</name>
<description>The datasource used for Identity configurations</description>
<jndiConfig>
<name>jdbc/WSO2IdentityDB</name>
</jndiConfig>
<definition type="RDBMS">
<configuration>
<url>jdbc:mysql://localhost:3306/WSO2IDENTITY_DB</url>
<username>root</username>
<password>root</password>
<driverClassName>com.mysql.jdbc.Driver</driverClassName>
<maxActive>50</maxActive>
<maxWait>60000</maxWait>
<testOnBorrow>true</testOnBorrow>
<validationQuery>SELECT 1</validationQuery>
<validationInterval>30000</validationInterval>
</configuration>
</definition>
</datasource>

<datasource>
<name>SOCIAL_CACHE</name>
<description>The datasource used for storing the cached social objects.</description>
<jndiConfig>
<name>jdbc/test</name>
</jndiConfig>
<definition type="RDBMS">
<configuration>
<url>jdbc:h2:repository/database/WSO2SOCIAL_CACHE_DB;DB_CLOSE_ON_EXIT=FALSE</url>
<username>wso2carbon</username>
<password>wso2carbon</password>
<driverClassName>org.h2.Driver</driverClassName>
<maxActive>50</maxActive>
<maxWait>60000</maxWait>
</configuration>
</definition>
</datasource>

<datasource>
<name>SOCIAL_CASSANDRA_DB</name>
<description>The cassandra datasource used for storing social activities</description>
<definition type="RDBMS">
<configuration>
<url>jdbc:cassandra://localhost:9160/EVENT_KS</url>
<username>admin@admin.com</username>
<password>admin</password>
<driverClassName>org.apache.cassandra.cql.jdbc.CassandraDriver</driverClassName>
</configuration>
</definition>
</datasource>

<datasource>
<name>WSO2AM_DB</name>
<description>The datasource used for API Manager database</description>
<jndiConfig>
<name>jdbc/WSO2AM_DB</name>
</jndiConfig>
<definition type="RDBMS">
<configuration>
<url>jdbc:mysql://localhost:3306/WSO2AM_DB</url>
<username>root</username>
<password>root</password>
<driverClassName>com.mysql.jdbc.Driver</driverClassName>
<maxActive>50</maxActive>
<maxWait>60000</maxWait>
<testOnBorrow>true</testOnBorrow>
<validationQuery>SELECT 1</validationQuery>
<validationInterval>30000</validationInterval>
<defaultAutoCommit>false</defaultAutoCommit>
</configuration>
</definition>
</datasource>

<datasource>
<name>JAGH2</name>
<description>The datasource used for by the Jaggery Storage Manager</description>
<jndiConfig>
<name>jdbc/test</name>
</jndiConfig>
<definition type="RDBMS">
<configuration>
<url>jdbc:h2:~/test;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=60000</url>
<username>sa</username>
<password></password>
<driverClassName>org.h2.Driver</driverClassName>
<maxActive>50</maxActive>
<maxWait>60000</maxWait>
</configuration>
</definition>
</datasource>
</datasources>
</datasources-configuration>

谢谢

关于mysql - EMM - 从 H2 迁移到 Mysql,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31656417/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com