EMM - 从H2迁移到Mysql

时间:2015-07-27 14:54:38

标签: mysql wso2 wso2-emm

我想更改我的数据库并将其设置为mysql我经历How to migrate from H2 to MySQL但我无法连接任何consols!

这是对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。

以下是网络浏览器中的碳logerror

编辑:

以下是碳日志的一部分:

 {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,因此我将其从问题中删除。在此更改后,我重新启动服务器现在加载了consols但我无法登录到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"

但我可以登录发布商并存储consols。

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

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

2 个答案:

答案 0 :(得分:1)

好像你的配置有命名问题。我们可以按照这些步骤吗?

  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”命令运行包。
  6. 您应该可以通过以下方式解决您的问题。否则,尝试解决现有包中的问题是浪费时间。

    [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>

    由于

答案 1 :(得分:0)

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

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

由于