arenadata/adcm

Service instance

vbp1 opened this issue · 5 comments

vbp1 commented

I guess maybe it would be nice to have a service instance as ADCM entity: the ability to deploy multiple instances of the same service on the same cluster, with different settings.
For example: I am planning to use adcm to deploy postgresql clusters built on pacemaker / corosync. In this case, the cluster is the corosync setup, and the service is postgresql as a set of pacemaker cluster resources (pgsql + vIP). And I would like to run N DBMS in the one cluster, with the ability to dynamically add and remove them. The template for such a set of resources, as well as the logic for adding them to the cluster, are the same, but the settings (PGDATA, port, etc.) are different.

acmnu commented

We had two concept about this:

  • "Instances" - an a copy of component on the host.
  • "Virtual Service" - some of the object which is not real os services at all. Like database in Postgres ("create database ....").

But we still have no real life case for this.

vbp1 commented

"Virtual Service" - it seems suitable for my purposes.
Is it implemented on current ADCM version?
Where could I read some additional info about it? Manuals, examples and so on.

acmnu commented

@vbp1 No, it is not implemented at all. We did not find any internal customer for this functionality. It would be nice if you describe expected user story about this functionality in details.

vbp1 commented

I am planning to use adcm to deploy postgresql clusters built on pacemaker / corosync. In this case, the cluster (in ADCM terms) itself is the corosync framework, and the service (in ADCM terms) is a set of pacemaker cluster resources (pgsql + vIPs) - we may say it's a redundant DB setup. I would like to run N such DB in the same cluster, with the ability to dynamically add and remove them. The settings set (PGDATA, port, etc.) and provisioning logic for the DB is the same, but the settings values are different.

For example, I'd like to have multiple instances (each one have its own values for the config parameters) of the pgsql_replicated service (see below) in the same cluster.

- name: pgsql_replicated
  display_name: Clustered PostgreSQL DB service(master-sync-async)
  type: service
  required: false
  description: "Clustered PostgreSQL DB service (master-sync-async)"
  version: *version
  actions:
    add_pgsql_replicated: 
      display_name: Init DB, configure it for the cluster and add cluster resources set (pgsql + VIPs)
      script: pgsql_cluster/add_pg_replicated.yaml
      script_type: ansible
      type: job
      states:
        available: 
          - prepared
        on_success: configured
        on_fail: prepared
      log_files: [check]
    check_pgsql: 
      display_name: Check DB service is available
      script: pgsql_cluster/check_pg.yaml
      script_type: ansible
      type: job
      states:
        available: 
          - configured
        on_success: ready
        on_fail: configured
      log_files: [check]
  components:
    master:
      constraint: [1]
      display_name: Master
    replica:
      constraint: [+]
      display_name: Replica

  config:
    __main_info:
      type: text
      default: >
        <a href="https://www.postgresql.org/" target="_blank">
        PostgreSQL</a> is a powerful, open source object-relational database.
    dirs:
      pgdata:
        display_name: Dir for PGDATA
        description: "Dir for PGDATA. Default is /pgdata/<db service name>, i.e. /pgdata/db01"
        required: false
        type: string
        default: ""
      pgwal:
        display_name: Dir for PGWAL
        description: "Dir for PGWAL. Default is /pgdata/<db service name>/pg_wal, i.e. /pgdata/db01/pg_wal"
        required: false
        type: string
        default: ""
      pgtmp:
        display_name: Dir for cluster tmp 
        description: "Dir for cluster tmp. Default is /pgtmp"
        required: false
        type: string
        default: ""
    instance:
      name:
        display_name: Cluster resource name
        description: "Cluster resource name. Must be unique."
        type: string
        default: ""
      port:
        display_name: DB service TCP port
        description: "DB service TCP port. Must be unique, default 5432"
        type: integer
        min: 1025
        max: 65000
        required: false
        default: 5432
      rep_mode:
        display_name: Replication mode
        description: >
          "Replication mode. Can be:
           - sync
           - async
           Default is sync."
        type: string
        required: false
        default: "sync"
      data_checksums:
        display_name: Use data checksums?
        description: "Will we use data checksums? Default: YES"
        type: boolean
        required: false
        default: true
      master_ip:
        display_name: IP address for client access to the DB service
        description: "IP address for client access to the DB service. Must be unique."
        type: string
        default: "2.2.2.2"
      master_repl_ip:
        display_name: IP address for replication 
        description: "IP address for replication. Must be unique."
        type: string
        default: "3.3.3.3"
      sync_ip:
        display_name: IP address for the sync replica
        description: "IP address for the sync replica. Must be unique. Default: DO NOT USE."
        type: string
        required: false
        default: ""
      async_ip:
        display_name: IP address for the async replica
        description: "IP address for the async replica. Must be unique. Default: DO NOT USE."
        type: string
        required: false
        default: ""
      lc_ctype:
        display_name: lc_ctype
        description: "lc_ctype. Default is en_US.UTF8"
        type: string
        required: false
        default: ""
      lc_collate:
        display_name: lc_collate
        description: "lc_collate. Default is en_US.UTF8"
        type: string
        required: false
        default: ""
      auth_host: 
        display_name: auth_host
        description: "auth_host. Default is md5"
        type: string
        required: false
        default: ""
      auth_local:
        display_name: auth_local
        description: "auth_local. Default is peer"
        type: string
        required: false
        default: ""
      repuser:
        display_name: Replication user name
        description: "Replication user name. Default: repl"
        type: string
        required: false
        default: "repl"
vbp1 commented

Maybe in the picture it is more clear.

pgsql_service_instances