JoaoJandre opened a new pull request, #7895:
URL: https://github.com/apache/cloudstack/pull/7895

   ### Description
   
   Current properties on `db.properties` are limited and focused only on mysql. 
This PR adds a new property on `db.properties`, `db.cloud.uri`, that when set, 
will be used for the connection with the DBMS. This enables URI configuration 
and use with other DBMSs, such as mariaDB.
   
   When using the `db.cloud.uri` property, the following properties will be 
**ignored**:
   - `db.cloud.host`;
   - `db.cloud.port`;
   - `db.cloud.name`;
   - `db.cloud.autoReconnect`;
   - `db.cloud.url.params`;
   - `db.cloud.replicas`;
   - `db.cloud.autoReconnect`;
   - `db.cloud.failOverReadOnly`;
   - `db.cloud.reconnectAtTxEnd`;
   - `db.cloud.autoReconnectForPools`;
   - `db.cloud.secondsBeforeRetrySource`;
   - `db.cloud.queriesBeforeRetrySource`;
   - `db.cloud.initialTimeout`;
   
   
   When using the `db.usage.uri` property, the following properties will be 
**ignored**:
   - `db.usage.host`;
   - `db.usage.port`;
   - `db.usage.name`;
   - `db.usage.autoReconnect`;
   - `db.usage.url.params`;
   - `db.usage.replicas`;
   - `db.usage.autoReconnect`;
   - `db.usage.failOverReadOnly`;
   - `db.usage.reconnectAtTxEnd`;
   - `db.usage.autoReconnectForPools`;
   - `db.usage.secondsBeforeRetrySource`;
   - `db.usage.queriesBeforeRetrySource`;
   - `db.usage.initialTimeout`;
   
   When using both, the following properties will also be **ignored**:
   - `db.ha.enable`;
   - `db.ha.loadBalanceStrategy`;
   
   This PR also adds support for the MariaDB driver.
   
   ### Types of changes
   
   - [ ] Breaking change (fix or feature that would cause existing 
functionality to change)
   - [ ] New feature (non-breaking change which adds functionality)
   - [ ] Bug fix (non-breaking change which fixes an issue)
   - [X] Enhancement (improves an existing feature and functionality)
   - [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
   
   ### Feature/Enhancement Scale or Bug Severity
   
   #### Feature/Enhancement Scale
   
   - [ ] Major
   - [X] Minor
   
   ### How Has This Been Tested?
   Using the current version in a setup with mariaDB and Galera, with a cluster 
size of 3 and the following configuration on the `db.properties` file:
   ```
   # High Availability And Cluster Properties
   db.ha.enabled=true
   db.ha.loadBalanceStrategy=com.cloud.utils.db.StaticStrategy
   # cloud stack Database
   db.cloud.replicas=192.168.201.161,192.168.201.162
   db.cloud.autoReconnect=false
   db.cloud.failOverReadOnly=false
   db.cloud.reconnectAtTxEnd=false
   db.cloud.autoReconnectForPools=true
   db.cloud.secondsBeforeRetrySource=1800
   db.cloud.queriesBeforeRetrySource=5000
   db.cloud.initialTimeout=3600
   ```
   When the mysql service stops in the main node, ACS is able to switch to one 
of the other two. But if the host is shut down, this switch never occurs.
   
   
   Using the changes proposed in this PR, by configuring the `db.cloud.uri`:
   ```
   
db.cloud.uri=jdbc:mariadb:sequential://192.168.201.160:3306,192.168.201.161:3306,192.168.201.162:3306/cloud?autoReconnect=true&prepStmtCacheSize=517&cachePrepStmts=true&sessionVariables=sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'&serverTimezone=UTC
   ```
   I was able to configure and use the `sequential` fail over mode. This way, 
when the mysql service stops in the main node and even if the host is shut 
down, ACS was able to switch to the other DBs.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to