WSO2 Carbon database setup - wso2

Having to troubleshoot a time out issue when calling our WSO2 carbon setup. I know practically nothing about WSO2 but have read that the H2 database supplied is not suitable for production. Although a H2 database is still used for the local registry.
Taking a look at repository\conf\datasources\master-datasources.xml it appears that we are still using the local H2 database for the WSO2_CARBON_DB.
<datasource>
<name>WSO2_CARBON_DB</name>
H2
</datasource>
<datasource>
<name>WSO2AM_DB</name>
SQL Server
</datasource>
<datasource>
<name>WSO2UM_DB</name>
SQL Server
</datasource>
<datasource>
<name>WSO2REG_DB</name>
SQL Server
</datasource>
<datasource>
<name>WSO2AM_STATS_DB</name>
H2
</datasource>
<datasource>
<name>JAGH2</name>
h2
</datasource>
Can anyone tell me if this set up is incorrect and I need to set up another SQL server DB for WSO2_CARBON_DB, and also tell em which one of these is the "local registry"
Thanks

Having a local h2 db for WSO2_CARBON_DB is OK. But in production you need to integrate a more reliable db engine such as mysql/sql server/oracle etc.. for databases other than the WSO2_CARBON_DB

Related

Access H2 Embedded Database for WSO2 products

I am using stream processor 4.3.0 and need to access the H2 Database for it which comes by default in WSO2 SP application.
Can some please help me here to access/browse the database.
Thanks
And need to access the H2 Database for it which comes by default in WSO2 SP application
For WSO2SP DB configuration stored in:
${carbon.home}/conf/worker/deploymment.yaml
${carbon.home}/conf/dashboard/deploymment.yaml
${carbon.home}/conf/..other module../deploymment.yaml
so you can check the database locations
by default check
${carbon.home}/wso2/worker/database
${carbon.home}/wso2/dashboard/database
${carbon.home}/wso2/..other module../database
You can use H2 Shell to access the databases
Please note the embedded H2 databases are not intended to be accessed from multiple processes concurrently, so stop the wso2sp first
please find the answer below.
Open the /repository/conf/carbon.xml file and paste the following configuration.
Do not uncomment the existing element. Just paste the following configuration below it.
<H2DatabaseConfiguration>
<property name="web"/>
<property name="webPort">8082</property>
<property name="webAllowOthers"/>
</H2DatabaseConfiguration>
3.Restart the WSO2 product and access the following URL via your browser: http://localhost:8082
Tip: If you are logged in to the management console, log out before connecting to the database.
4.Enter the following details and click Connect.
JDBC URL : jdbc:h2:[file path to /repository/database/WSO2CARBON_DB]
username : wso2carbon
password : wso2carbon

Using placeholders in WSO2 DSS dbs files for DB connection params

Is it possible to use placeholders in WSO2 DSS db connection params - e.g. ${prod.db.url} and replace them in runtime from Registry?
Thanks.
The datasource connection is checked and established in the dataservice deployment time. Therefore, you have to provide the datasource configurations such as driver class name, connection url. etc. at the deployment time.
Since the datasource configurations like db url, driver name, user name, password is needed during deployment stage, its not possible to refer the same from registry.
I assume your requirement comes from the need to manage different environments, to achieve the same, have the option to create datasources at server level, called Carbon_Datasources.
These datasources can be referred from .dbs file like the below one. In the below example, serviceDS is the datasource configured.
<config id="rs">
<property name="carbon_datasource_name">serviceDS</property>
</config>
<query id="deliveryService" useConfig="rs">
Refer here for adding different types of datasources and here for managing the same.

Azure flask <handler> scriptProcessor could not be found in <fastCGI> application configuration

I am trying to deploy Python Flask application in the Azure web app. I had create web app(Flask) and published my code. After publish, I am getting below error from the site.
The page cannot be displayed because an internal server error has
occurred.
When check the Log, i could see the below error.
But this was happening only in my subscription(free subscription got with MSDN). But working fine in the Organisation subscription.
The <fastCGI> settings must be in the applicationHost.config file (in the system.webServer section) of IIS. Just putting it into web.config does not work (confirmed by testing it on a local IIS, not in Azure). An example configuration may look like this:
<fastCgi>
<application
fullPath="D:\home\Python27\python.exe"
arguments="D:\home\Python27\wfastcgi.py"
maxInstances="16"
idleTimeout="21600"
instanceMaxRequests="10000000"
signalBeforeTerminateSeconds="60"
xdt:Transform="InsertIfMissing"
xdt:Locator="Match(fullPath)">
<environmentVariables>
<environmentVariable name="PYTHONHOME" value="D:\home\Python27" />
</environmentVariables>
</application>
</fastCgi>
You may want to adjust this configuration.
This should solve it for a local IIS where you can edit applicationHost.config. I'm not sure about Azure, but maybe you can find some hints here: https://github.com/Azure/azure-python-siteextensions/issues/2.

User Management Tables are not shared between WSO2 products

I have followed the this guide on sharing registry between WSO2 products using G-Reg. But the problem is that User Management Tables are not shared.
For example, I have created a new user "test" in G-Reg, but it is not valid in WSO2 ESB product (only native user "admin" is possible).
So is it possible to share users stored in G-Reg? Or are they stored in local H2 databases?
So is it possible to share users stored in G-Red? Or are they stored
in local H2 databases?
Yes, You can share users between all WSO2 products. By default, H2 used which is shipped with all the products.
If you are going to share the user among multiple products, You need to go for a production ready databases like mysql, postgresql, etc.
Create a database named userdb
Add the below entry in repository/conf/datasources/master-datasources.xml
<datasource>
<name>WSO2_CARBON_USER</name>
<description>The datasource used for registry and user manager</description>
<jndiConfig>
<name>jdbc/WSO2CarbonDB_User</name>
</jndiConfig>
<definition type="RDBMS">
<configuration>
<url>jdbc:mysql://localhost:3306/userdb</url>
<username>wso2carbon</username>
<password>wso2carbon</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>
Change the datasource JNDI name in repository/conf/user-mgt.xml file like following in both G-REG and ESB
<Property name="dataSource">jdbc/WSO2CarbonDB_User</Property>
Start the G-REG or ESB with -Dset up option to create the required database.This is required only in the first time.
For this you'll need to configure the products to point to the same user store by configuring it through repository/conf/user-mgt.xml. Have a look at this doc to get an idea how to do it.

How to connect to the WSO2 AM database thorugh client?

I am newbie to WSO2 AM and researching to understand it's good features. It seems that "The default database of user manager is the H2 database that comes with WSO2 products. We can configure it to point to databases by other vendors such as IBM DB2, Oracle, MySQL using the scripts provided by WSO2 for installing and configuring relational databases".
How we can connect WSO2 AM to MySQL DB? What files needs to be
changed? (I'm interested to use MySQL and not H2 db)
How we can use external client to see all tables?
Requesting you to please guide me on this.
Following sample works better with a fresh install(prior to initial start-up) :
Put the Mysql jar connector/driver in wso2am/repository/components/lib directory.
MySql you will need 2 databases :
mysql> create database reg_db;
mysql> create database am_db;
mysql> grant all on reg_db.* to dba#localhost identified by 'dba';
mysql> grant all on am_db.* to dba#localhost identified by 'dba';
mysql> flush privileges;
Overwrite the following 2 data sources in wso2am/repository/conf/datasources/master-datasources.xml
<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/reg_db?autoReconnect=true&relaxAutoCommit=true&</url>
<username>dba</username>
<password>dba</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>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/am_db?autoReconnect=true&relaxAutoCommit=true&</url>
<username>dba</username>
<password>dba</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>
Start the server with wso2server.sh -Dsetup or wso2server.bat -Dsetup