Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

paulomach
Copy link
Contributor

@paulomach paulomach commented Apr 24, 2024

PR postponed, due:

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

Issue

  • on MAAS, hostsname is resolved to 127.0.1.1, failing setup
  • lack of robust solution for unique hostname resolution

Solution

  • implement hostname resolution using unit alias in /etc/hosts (much like proposed by @taurus-forever here)
    • unit alias is <unit_name>.<model_uuid>

Todo:

  • support async-replication
  • support upgrade/rollback
  • support on router hostname mapping PR#142

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
Copy link
Contributor

taurus-forever commented Apr 25, 2024

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
Copy link
Contributor Author

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
Copy link
Contributor Author

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)

@paulomach paulomach added the donotmerge PR still blocked from merging label Apr 29, 2024
@paulomach paulomach marked this pull request as draft April 29, 2024 14:47
@paulomach paulomach changed the title DPE-3115 Using unit host-alias on /etc/hosts Using unique unit host-alias on /etc/hosts Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
donotmerge PR still blocked from merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Strange Breakage in Vsphere Deployments
2 participants