Skip to content

Commit

Permalink
Merge pull request #4920 from AmshikaH/master
Browse files Browse the repository at this point in the history
[next][7.0.0][6.1.0] Add Change Default Registry DBs Doc
  • Loading branch information
himeshsiriwardana authored Dec 12, 2024
2 parents c25f116 + 1fdedd8 commit 084e0a0
Show file tree
Hide file tree
Showing 12 changed files with 860 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,279 @@
# Change the Default Datasources for the Registry Data

!!! note
To deploy this update into production, you need to have a paid subscription. If you do not have a paid subscription, you can use this feature with the next version of WSO2 Identity Server when it is released.

If you have a paid subscription, this capability can be made available by applying update level 81 for WSO2 Identity Server 7.0.0 using the WSO2 Update Tool. For more information on updating WSO2 Identity Server using the WSO2 Update Tool, see [WSO2 Updates](https://updates.docs.wso2.com/en/latest/updates/overview/).

{! ./includes/registry-repositories.md !}

These repositories use the default datasources as follows.

- WSO2_CARBON_DB: Used by the local repository.
- WSO2_SHARED_DB: Used by the configuration and governance repositories.

They can be changed to utilize alternate datasources as described below.

## Configure the Datasource

Following are the sample configuration for each database type.

??? Example "PostgreSQL"

1. Configure the `<IS-HOME>/repository/conf/deployment.toml` file.

```
[[datasource]]
id="WSO2CONFIG_DB"
url = "jdbc:postgresql://localhost:5432/gregdb"
username = "regadmin"
password = "regadmin"
driver = "org.postgresql.Driver"
jmx_enable=false
```

2. Execute the database scripts.

Execute the scripts in the `<IS-HOME>/dbscripts/postgresql.sql` file against
the created database.

3. Download the Postgres JDBC driver for the version you are using and copy it to the `<IS_HOME>/repository/components/lib` folder.
??? Example "MySQL"

1. Configure the `<IS-HOME>/repository/conf/deployment.toml` file.
```
[[datasource]]
id="WSO2CONFIG_DB"
url = "jdbc:mysql://localhost:3306/IAMtest?useSSL=false"
username = "root"
password = "root"
driver = "com.mysql.jdbc.Driver"
jmx_enable=false
```
2. Execute the database scripts.

Execute the scripts in the `<IS-HOME>/dbscripts/mysql.sql` file against
the created database.

3. Download the MySQL JDBC driver for the version you are using and copy it to the `<IS_HOME>/repository/components/lib` folder.
??? Example "DB2"
1. Configure the `<IS-HOME>/repository/conf/deployment.toml` file.
```
[[datasource]]
id="WSO2CONFIG_DB"
url = "jdbc:db2://192.168.108.31:50000/test"
username = "db2inst1"
password = "db2inst1"
driver = "com.ibm.db2.jcc.DB2Driver"
jmx_enable=false
```

2. Execute the database scripts.

Execute the scripts in the `<IS-HOME>/dbscripts/db2.sql` file against
the created database.

3. Download the DB2 JDBC driver for the version, you are using and copy it to the `<IS_HOME>/repository/components/lib` folder.

??? Example "MSSQL"
1. Configure the `<IS-HOME>/repository/conf/deployment.toml` file.
```
[[datasource]]
id="WSO2CONFIG_DB"
url = "jdbc:sqlserver://localhost:1433;databaseName=test;SendStringParametersAsUnicode=false"
username = "sa"
password = "pass#word2"
driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver"
jmx_enable=false
```

2. Execute the database scripts.

Execute the scripts in the `<IS-HOME>/dbscripts/mssql.sql` file against
the created database.

3. Download the MS SQL JDBC driver for the version you are using and copy it to the `<IS_HOME>/repository/components/lib` folder.

??? Example "Oracle"
1. Configure the `<IS-HOME>/repository/conf/deployment.toml` file.
```
[[datasource]]
id="WSO2CONFIG_DB"
url = "jdbc:oracle:thin:@localhost:1521/ORCLPDB"
username = "IS590Test"
password = "ora12c"
driver = "oracle.jdbc.OracleDriver"
jmx_enable=false
```

2. Execute the database scripts.

Execute the scripts in the `<IS-HOME>/dbscripts/oracle.sql` file against
the created database.

3. Download the Oracle JDBC driver for the version you are using and copy it to the `<IS_HOME>/repository/components/lib` folder.

---

### Advanced database configurations

Apart from the above basic configurations, WSO2 Identity Server supports advanced database
configurations. Add the following configurations to the `<IS_HOME>/repository/conf/
deployment.toml` file under the corresponding `[[datasource]]` tag.

``` tab="PostgreSQL"
``` json
pool_options.maxActive = "80"
pool_options.maxWait = "60000"
pool_options.minIdle = "5"
pool_options.testOnBorrow = true
pool_options.validationQuery="SELECT 1; COMMIT"
pool_options.validationInterval="30000"
pool_options.defaultAutoCommit=false
```
``` tab="MySQL"
``` json
pool_options.maxActive = "80"
pool_options.maxWait = "60000"
pool_options.minIdle = "5"
pool_options.testOnBorrow = true
pool_options.validationQuery="SELECT 1"
pool_options.validationInterval="30000"
pool_options.defaultAutoCommit=false
```
``` tab="DB2"
``` json
pool_options.maxActive = "80"
pool_options.maxWait = "360000"
pool_options.minIdle = "5"
pool_options.testOnBorrow = true
pool_options.validationQuery="SELECT 1"
pool_options.validationInterval="30000"
pool_options.defaultAutoCommit=false
```
``` tab="MSSQL"
``` json
pool_options.maxActive = "80"
pool_options.maxWait = "60000"
pool_options.minIdle = "5"
pool_options.testOnBorrow = true
pool_options.validationQuery="SELECT 1"
pool_options.validationInterval="30000"
pool_options.defaultAutoCommit=false
```
``` tab="Oracle"
``` json
pool_options.maxActive = "80"
pool_options.maxWait = "60000"
pool_options.minIdle = "5"
pool_options.testOnBorrow = true
pool_options.validationQuery="SELECT 1 FROM DUAL"
pool_options.validationInterval="30000"
pool_options.defaultAutoCommit=false
```
{! ./includes/db-config-table.md !}
---
## Configure the Registry Databases
The following configurations can be added under the `[registry]` section in the `<IS-HOME>/repository/conf/deployment.toml` file.
```
[registry]
local_datasource = "jdbc/<id-of-the-datasource>"
gov_datasource = "jdbc/<id-of-the-datasource>"
config_datasource = "jdbc/<id-of-the-datasource>"
```
<table>
<thead>
<tr class="header">
<th>Configuration</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="even">
<td><strong>local_datasource</strong></td>
<td>This is the jndi config name of the datasource for the local repository.
Here, this would be "jdbc/&lt;id&gt;" where <code>id</code> is the value configured in the
datasource configurations.</td>
</tr>
<tr class="odd">
<td><strong>gov_datasource</strong></td>
<td>This is the jndi config name of the datasource configured for the governance repository.
Here, this would be "jdbc/&lt;id&gt;" where <code>id</code> is the value configured in the
datasource configurations.</td>
</tr>
<tr class="even">
<td><strong>config_datasource</strong></td>
<td>This is the jndi config name of the datasource configured for the configuration repository.
Here, this would be "jdbc/&lt;id&gt;" where <code>id</code> is the value configured in the
datasource configurations.</td>
</tr>
</tbody>
</table>
It is only necessary to add the configuration for the datasource which is being changed.
For example, if you wish to change only the governance and configuration datasources,
only the `gov_datasource` and `config_datasource` configurations would be necessary
as shown below.
```
[registry]
gov_datasource = "jdbc/<id-of-the-datasource>"
config_datasource = "jdbc/<id-of-the-datasource>"
```
!!! note "Sample Config"
If you have correctly configured, the `deployment.toml` file should have an entry
similar to the following config.
The following sample configuration is for separate **MSSQL** governance and config
databases.
```
[registry]
gov_datasource = "jdbc/WSO2GOV_DB"
config_datasource = "jdbc/WSO2CONFIG_DB"
[[datasource]]
id="WSO2GOV_DB"
url = "jdbc:sqlserver://localhost:1433;databaseName=test1;SendStringParametersAsUnicode=false"
username = "sa"
password = "pass#word2"
driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver"
jmx_enable=false
pool_options.maxActive = "80"
pool_options.maxWait = "60000"
pool_options.minIdle = "5"
pool_options.testOnBorrow = true
pool_options.validationQuery="SELECT 1"
pool_options.validationInterval="30000"
pool_options.defaultAutoCommit=false
[[datasource]]
id="WSO2CONFIG_DB"
url = "jdbc:sqlserver://localhost:1433;databaseName=test2;SendStringParametersAsUnicode=false"
username = "sa"
password = "pass#word2"
driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver"
jmx_enable=false
pool_options.maxActive = "80"
pool_options.maxWait = "60000"
pool_options.minIdle = "5"
pool_options.testOnBorrow = true
pool_options.validationQuery="SELECT 1"
pool_options.validationInterval="30000"
pool_options.defaultAutoCommit=false
```
8 changes: 1 addition & 7 deletions en/identity-server/6.1.0/docs/deploy/deployment-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,7 @@ The following diagram is a high-level component diagram showing how the system w

## Mount the shared registry

WSO2 Identity Server comprises three different registry repositories.

1. **Local Repository**: Stores configuration and runtime data that is local to the server.

2. **Configuration Repository**: Stores product-specific configurations.

3. **Governance Repository**: This stores configuration and data that are shared across the whole platform. This typically includes services, service descriptions, endpoints, or data sources.
{! ./includes/registry-repositories.md !}


<!--!!! info
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
WSO2 Identity Server comprises three different registry repositories.

1. **Local Repository**: Stores configuration and runtime data that is local to the server.

2. **Configuration Repository**: Stores product-specific configurations.

3. **Governance Repository**: This stores configuration and data that are shared across the whole platform. This typically includes services, service descriptions, endpoints, or data sources.
2 changes: 2 additions & 0 deletions en/identity-server/6.1.0/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ nav:
- Change to remote H2: deploy/change-to-remote-h2.md
- Change the Default Datasource of BPS: deploy/change-datasource-bpsds.md
- Change the Default Datasource for Consent Management: deploy/change-datasource-consent-management.md
- Change the Default Datasource for Registry Data: deploy/change-datasource-registry-data.md
- Data Purging: deploy/data-purging.md
- Remove References to Deleted User Identities: deploy/remove-references-to-deleted-user-identities.md
- Session Persistence: deploy/session-persistence.md
Expand Down Expand Up @@ -1297,6 +1298,7 @@ plugins:
'setup/changing-to-oracle-rac.md': 'https://is.docs.wso2.com/en/6.0.0/deploy/change-to-oracle-rac/'
'setup/changing-to-postgresql.md': 'https://is.docs.wso2.com/en/6.0.0/deploy/change-to-postgresql/'
'setup/changing-to-remote-h2.md': 'https://is.docs.wso2.com/en/6.0.0/deploy/change-to-remote-h2/'
'setup/change-datasource-registry-data.md': 'https://is.docs.wso2.com/en/6.1.0/deploy/change-datasource-registry-data/'
'setup/changing-datasource-bpsds.md': 'https://is.docs.wso2.com/en/6.0.0/deploy/change-datasource-bpsds/'
'setup/changing-datasource-consent-management.md': 'https://is.docs.wso2.com/en/6.0.0/deploy/change-datasource-consent-management/'
'setup/working-with-users-roles-and-permissions.md': 'https://is.docs.wso2.com/en/6.0.0/references/concepts/user-management/roles-and-permissions/'
Expand Down
Loading

0 comments on commit 084e0a0

Please sign in to comment.