canonical / mysql-operator

Machine charm for MySQL following the operator framework
https://charmhub.io/mysql
Apache License 2.0
6 stars 8 forks source link

Using unique unit host-alias on /etc/hosts #441

Open paulomach opened 2 months ago

paulomach commented 2 months ago

PR postponed, due:

  1. need further discussion for DNS solution/responsibility
  2. breakage of legacy db-router interface

Issue

Solution

Todo:

Fixes #433 #366

/etc/hosts entries:


10.10.10.3      intent-caiman intent-caiman.maas mysql-3.e94ec0f2-55f7-4ebd-81b0-bc4e979f666e # unit=mysql-3.e94ec0f2-55f7-4ebd-81b0-bc4e979f666e
10.10.10.4      finer-pigeon finer-pigeon.maas mysql-4.e94ec0f2-55f7-4ebd-81b0-bc4e979f666e # unit=mysql-4.e94ec0f2-55f7-4ebd-81b0-bc4e979f666e
10.10.10.5      boss-mullet boss-mullet.maas mysql-5.e94ec0f2-55f7-4ebd-81b0-bc4e979f666e # unit=mysql-5.e94ec0f2-55f7-4ebd-81b0-bc4e979f666e

maas

juju run mysql/leader get-cluster-status
Running operation 3 with 1 task
  - task 4 on unit-mysql-3

Waiting for task 4...
status:
  clustername: cluster-acf444d13edeb68d058737b795f28820
  clusterrole: primary
  defaultreplicaset:
    name: default
    primary: mysql-3.e94ec0f2-55f7-4ebd-81b0-bc4e979f666e:3306
    ssl: required
    status: ok
    statustext: cluster is online and can tolerate up to one failure.
    topology:
      mysql-3:
        address: mysql-3.e94ec0f2-55f7-4ebd-81b0-bc4e979f666e:3306
        memberrole: primary
        mode: r/w
        role: ha
        status: online
        version: 8.0.36
      mysql-4:
        address: mysql-4.e94ec0f2-55f7-4ebd-81b0-bc4e979f666e:3306
        memberrole: secondary
        mode: r/o
        replicationlagfromimmediatesource: ""
        replicationlagfromoriginalsource: ""
        role: ha
        status: online
        version: 8.0.36
      mysql-5:
        address: mysql-5.e94ec0f2-55f7-4ebd-81b0-bc4e979f666e:3306
        memberrole: secondary
        mode: r/o
        replicationlagfromimmediatesource: ""
        replicationlagfromoriginalsource: ""
        role: ha
        status: online
        version: 8.0.36
    topologymode: single-primary
  domainname: cluster-set-acf444d13edeb68d058737b795f28820
  groupinformationsourcemember: mysql-3.e94ec0f2-55f7-4ebd-81b0-bc4e979f666e:3306
success: "True"
taurus-forever commented 2 months ago

Quick comment. I would use: <unit_name>.<model_uuid>.svc.cluster.local to mimic K8s and push Juju this direction. Open question: how to migration current installations on the new hostsnames format...

paulomach commented 2 months ago

Quick comment. I would use: <unit_name>.<model_uuid>.svc.cluster.local to mimic K8s and push Juju this direction. Open question: how to migration current installations on the new hostsnames format...

migration wise, previous hostname is preserved - still validating how the cluster behaves on changed report_host

paulomach commented 2 months ago

still validating how the cluster behaves on changed report_host

cluster can rejoin instance after report_host changes, requiring metadata update afterwards (through a cluster.rescan)