iManager&cloud suite supports configuring kingbase

Author yangjunlin

Foreword

More and more secret-related units have gradually increased their requirements for the Xinchuang environment, and service applications are also increasingly dependent on domestic databases. The open source database in the SuperGraph iManager for k8s product is replaced with domestic databases such as Kingbase. Customer needs and scenarios will follow. Therefore, this article will take readers step by step to implement iManager & cloud suite configuration kingbase database. Please see below for the specific process.

1. [kingbase installation and imanager installation]

  1. Kingbase installation (refer to the blog, https://blog.csdn.net/supermapsupport/article/details/128496058) requires attention to 5 points:
    (1) The default installation path is under /home/kingbase/. You can first create the directory and attach permissions, and then change the directory with 777 permissions as the root user. Then select the installation path and fill in the path directly.
    chmod -R 777 /home/kingbase/

(2) During installation, you need to switch to the kingbase user for deployment.
(3) Select database mode and select pg when deploying

(4) Remember to configure environment variables. The paths may be inconsistent. Configure them according to the actual method.
(5) How to start the database according to the documentation, “Error, fatal error: The lock file “kingbase.pid” already exists”, you can restart the service through the command

./sys_ctl -D /home/kingbase/data restart
  1. Deploy imanager and cloud suite (this step is omitted, please refer to the help document https://help.supermap.com/iManager_K8S/1111/zh/)
  2. Use third-party tools to check whether you can successfully connect to the database

2. [k8s accesses external database resources]

There are two access methods. One is to access directly by ip and port. Later, you just need to change the ip and port in the env connection parameters. The second is to manually create a headless service and endpoint, introduce an external database, and then access it through the domain name resolution service in the k8s cluster. The accessed host name format is: [svc_name].[namespace_name].svc.cluster.local. Let me take the example of creating an endpoint to access:

  1. First create the endpoint and svc corresponding to the external database

  2. After creating it, check the corresponding service to see if the status is normal.

    Later, we can access external database services through this headless service method.

3. [Replace the default mysql with kingbase in imanager] (Note that if it is 11.0.1 and previous versions, you need to change the image first. For specific images, you can contact the support center first)

  1. First modify imanager-dashbord-api
    (1) Delete commond and args
    (2) Modify the following environment variables:
  • spring_datasource_url: database connection address
    • postgresql/kingbase:jdbc:postgresql://imanager-kingbase.supermap.svc.cluster.local:54321/imanager?autoReconnect=true & amp;useSSL=false & amp;useUnicode=true & amp;characterEncoding=utf8 & amp; stringtype=unspecified
      [stringtype=unspecified must be set]
  • spring_datasource_username: database username
  • spring_datasource_password: database password

    Pay attention to the content of the small red box. It requires the name imanager database, which is not included in the schema database, so you need to manually create a database named imanager first
  1. Modify bslicense-server
    (1) Delete commond and args

    (2) Modify the following environment variables:
  • BSLICENSE_DB_URL: database connection address
    • postgresql/kingbase:jdbc:postgresql://imanager-kingbase.supermap.svc.cluster.local:54321/bslicense?autoReconnect=true & amp;useSSL=false & amp;useUnicode=true & amp;characterEncoding=utf8
  • BSLICENSE_DB_USERNAME: database username
  • BSLICENSE_DB_PASSWORD: database password
    Please refer to the following:

    Pay attention to the content of the small box. It is the same as imanager-dashbord-api, but you still need to manually create the bslicense library
  1. Modify ispeco-dashbord-api
    (1) Delete commond and args

    (2) Modify the following environment variables:
  • spring_datasource_url: database connection address
    • postgresql/kingbase:jdbc:postgresql://imanager-kingbase.supermap.svc.cluster.local:54321/ispeco?autoReconnect=true & amp;useSSL=false & amp;useUnicode=true & amp;characterEncoding=utf8 & amp; stringtype=unspecified
      [stringtype=unspecified must be set]
  • spring_datasource_username: database username
  • spring_datasource_password: database password
    Please refer to the following:

Pay attention to the content of the small box. It is the same as imanager-dashbord-api or you need to manually create the ispeco library

  1. Modify the iportal in the cloud suite
    (1) First, before switching from mysql to kingbase, the user needs to go to the iportal mounting path and modify WEB-INF/iportal-monitor.xml
  • a) Change dbType to SQLITE

  • b) Modify driverClass to org.sqlite.JDBC

  • c) jdbcUrl is jdbc:sqlite:/opt/iportalOPTs/WEB-INF/iportaldata/monitor.db

  • d) Modify maxPoolSize to 1

  • e) Modify initialPoolSize to 1

  • f) Modify minPoolSize to 0

  • g) Modify maxIdleTime to 3000

  • h) Modify maxWait to 300000

  • i) Comment out username and password

    (2)iportal delete args. iportal-proxy removes command and args
    iportal delete content:

    iportal-proxy delete content:

    (3)iportal and iportal-proxy modify the following environment variables

  • DB_TYPE: database type
    Postgresql/kingbase: POSTGRESQL

  • DB_JDBC_URL: Database connection address where portal data is stored

    • postgresql: jdbc:postgresql://imanager-kingbase.supermap.svc.cluster.local:54321/iportal?useUnicode=true &characterEncoding=UTF-8
  • SECURITY_DB_JDBC_URL: Security information database connection address

    • postgresql: jdbc:postgresql://imanager-kingbase.supermap.svc.cluster.local:54321/iportal-security?useUnicode=true &characterEncoding=UTF-8
      Note: DB_JDBC_URL and SECURITY_DB_JDBC_URL use different databases
  • DB_USERNAME: The username used to connect DB_JDBC_URL and SECURITY_DB_JDBC_URL

  • DB_PASSWORD: The password used to connect DB_JDBC_URL and SECURITY_DB_JDBC_URL
    Iportal is changed in the same way as iportal-porxy. Pay attention to the content in the red box, which requires our newly created database