Modify the default MySQL library of cloud package iPortal to POSTGRESQL

Author: John

Modify the default MySQL library of cloud package iPortal to POSTGRESQL

  • 1. View iPortal’s configuration persistence directory (iportalOPTs)
  • 2. Modify iportal monitor monitoring
  • 3. Modify iPortal database configuration information
    • 3.1 Modify iPortal database configuration information
    • 3.2 Modify iPortal security database configuration information
    • 3.3 Modify the command executed when the container is started in iPortal orchestration
  • 4. Modify iportal-proxy database configuration information
    • 4.1 Modify iportal-proxy portal database configuration information
    • 4.2 Modify iportal-proxy security database configuration information
    • 4.3 Modify the command executed when the container starts in iportal-proxy orchestration

The SuperMap cloud suite portal in 11.0.1 now supports directly modifying the cloud suite iPortal library configuration information by configuring environment variables. Compared with the previous version, which modified the iportal.xml and iserver-system.xml configuration files, it provides great convenience. , this article is also based on the SuperMap iManager 11.0.1 version for case display.

1. View iPortal’s configuration persistence directory (iportalOPTs)

By default, the cloud suite persists the iPortal configuration directory (iportalOPTs). The command to view the nfs path where it is located is as follows:

# View the pvc data containing iportal-data in the cloud package namespace
kubectl get pvc -n giscloudsuite | grep iportal-data
# Obtain the pv name bound to pvc through the previous step, and query the nfs mounting directory included in its pv information.
kubectl get pv -n giscloudsuite -o yaml pvc-9d5149e9-5011-4b41-b98a-a8f2ed32db80 | grep "path: /" -A 1

View iPortal configuration persistence directory
Note: The default namespace of a cloud suite installed using a cloud suite is giscloudsuite, and the namespace of a cloud suite created using k8s imanager is icloud-native-x.

2. Modify iportal monitor monitoring

Because iPortal monitoring data does not support postgresql, you must change the monitor monitoring data storage to SQLITE database before switching mysql to postgresql. That is, you need to adjust the MYSQL connection pool data configured in iportal-monitor.xml. The parameter values to be modified are as follows:
1. Change dbType to SQLITE
2. Modify driverClass to org.sqlite.JDBC
3. Change jdbcUrl to
jdbc:sqlite:/opt/iportalOPTs/WEB-INF/iportaldata/monitor.db
4. Modify maxPoolSize to 1
5. Modify initialPoolSize to 1
6. Modify minPoolSize to 0
7. Modify maxIdleTime to 3000
8. Modify maxWait to 300000
9. Comment out username and password
The cloud suite stores iportal-monitor monitoring data in the MYSQL database by default. iportal-monitor.xml configures the MYSQL database connection pool as follows:

<!-- MYSQL database connection pool settings, monitoring data storage-MYSQL database -->
<dbType>MYSQL</dbType>
<driverClass>org.mariadb.jdbc.Driver</driverClass>
<jdbcUrl>jdbc:mysql://iportal-mysql:3306/monitor?useUnicode=true & amp;amp;characterEncoding=UTF-8</jdbcUrl>
<maxPoolSize>30</maxPoolSize>
<initialPoolSize>5</initialPoolSize>
<minPoolSize>5</minPoolSize>
<maxIdleTime>3000</maxIdleTime>
<maxWait>30000</maxWait>
<username>ENC@[5R2M9oluKst4cWFgNfQkXA..]</username>
<password>ENC@[WLSjKn42Xrpc3BwNy6seg-HozU7LriU3AM3jqU0uChU.]</password>

After modifying the monitor monitoring data to be stored in the SQLITE database, the database connection pool settings configured in iportal-monitor.xml are as follows:

<!-- SQLITE database connection pool settings -->
<dbType>SQLITE</dbType>
<driverClass>org.sqlite.JDBC</driverClass>
<!-- The url connected to the driver. For the sqlite database file path, if a relative path is used, it is the path relative to the iPortal home. -->
<jdbcUrl>jdbc:sqlite:./WEB-INF/iportaldata/monitor.db</jdbcUrl>
<maxPoolSize>1</maxPoolSize>
<initialPoolSize>1</initialPoolSize>
<minPoolSize>0</minPoolSize>
<maxIdleTime>3000</maxIdleTime>
<maxWait>30000</maxWait>
<!-- The sqlite database username and password are empty, so comment out username and password -->
<!-- <username>ENC@[5R2M9oluKst4cWFgNfQkXA..]</username>-->
<!-- <password>ENC@[WLSjKn42Xrpc3BwNy6seg-HozU7LriU3AM3jqU0uChU.]</password>-->

3. Modify iPortal database configuration information

3.1 Modify iPortal database configuration information

DB_TYPE: database type
mysql/mariadb: MYSQL
postgresql: POSTGRESQL

DB_USERNAME: username
DB_PASSWORD: User password

DB_JDBC_URL: Database connection address where portal data is stored
mysql/mariadb: jdbc:mysql://iportal-mysql:3306/iportal?useUnicode=true & amp;amp;characterEncoding=UTF-8
postgresql: jdbc:postgresql://localhost:5432/iportal?useUnicode=true & characterEncoding=UTF-8

3.2 Modify iPortal security database configuration information

SECURITY_DB_JDBC_URL: Security information database connection address
mysql/mariadb: jdbc:mysql://iportal-mysql:3306/ispeco?useUnicode=true & amp;amp;characterEncoding=UTF-8
postgresql: jdbc:postgresql://localhost:5432/ispeco?useUnicode=true &amp;characterEncoding=UTF-8

3.3 Modify the command executed when the container is started in iPortal orchestration

Because the database required by iportal has been modified into an external PG database, for iportal-mysql data, in order to reduce unnecessary additional resource overhead, it is generally closed. However, when starting the iportal orchestration, the container instructions must first be To connect iportal-mysql data, and the database account information in the connection parameters also comes from the environment variables in the orchestration. The account information has also been modified in the first two steps, so it is necessary to delete the relevant iportal- in the command executed when the container starts in the orchestration. mysql part. Delete the contents of containers.args in iPortal arrangement as follows:

 exec /opt/wait-for-mysql.sh iportal-mysql 3306 root $DB_PASSWORD

After the modification is completed, the iPortal is arranged as follows:
Portal & amp; Secure Database Configuration

Delete mysql related information in the startup command

4. Modify iportal-proxy database configuration information

4.1 Modify iportal-proxy portal database configuration information

DB_TYPE: database type
mysql/mariadb: MYSQL
postgresql: POSTGRESQL

DB_JDBC_URL: Database connection address where portal data is stored
mysql/mariadb: jdbc:mysql://iportal-mysql:3306/iportal?useUnicode=true & amp;amp;characterEncoding=UTF-8
postgresql: jdbc:postgresql://localhost:5432/iportal?useUnicode=true & characterEncoding=UTF-8

4.2 Modify iportal-proxy security database configuration information

SECURITY_DB_JDBC_URL: Security information database connection address
mysql/mariadb: jdbc:mysql://iportal-mysql:3306/ispeco?useUnicode=true & amp;amp;characterEncoding=UTF-8
postgresql: jdbc:postgresql://localhost:5432/ispeco?useUnicode=true &amp;characterEncoding=UTF-8

4.3 Modify the command executed when starting the container in iportal-proxy orchestration

Because the database required by iportal-proxy has been modified into an external PG database, for iportal-mysql data, in order to reduce unnecessary additional resource overhead, it is generally closed, but when the container is started in iportal-proxy orchestration In the command, the iportal-mysql data must be connected first, and the database account information in the connection parameters also comes from the environment variables in the orchestration. The account information has also been modified in the first two steps, so it is necessary to delete the command executed when the container starts in the orchestration. The related iportal-mysql part. Delete the contents of containers.args in the iportal-proxy arrangement as follows:

 nc -z -w 1 iportal-mysql 3306; result=$?; while [ $result != 0
]; do
echo 'wait for mysql sleep 5s';
sleep 5s;
nc -z -w 1 iportal-mysql 3306;
result=$?;
done; echo "mysql is ok";

After the modification is completed, iportal-proxy is arranged as follows
Portal & amp; Secure Database Configuration

Delete mysql related information in the startup command

At this point, the entire work of replacing the default portal and security database of the cloud suite iPortal with the external POSTGRESQL database has been completed.