EMM - 从 H2 迁移到 Mysql

EMM - migrate from H2 to Mysql

我想更改我的数据库并将其设置为 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 and the 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:

无需更改用户-mgt.xml 和注册表xml 所以我将它们从问题中删除。进行此更改后,我现在重新启动服务器,控制台已加载,但我无法登录 emm 控制台,我收到错误 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-access and wso2carbon 重新启动后的完整日志。

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

您的数据库服务器中可能缺少 WSO2CARBON_DB,或者您可能没有安装 MySQL JDBC 驱动程序。请按照 [1] 更正您的配置。

[1]- https://docs.wso2.com/display/EMM110/Setting+up+MySQL

谢谢

您的配置似乎存在命名问题。我们可以遵循这些步骤吗?

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

按照这些操作,您应该能够解决您的问题。否则,试图修复现有包中的问题是浪费时间。

[1] - 主文件-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>

谢谢