0

I am trying to setup MySQL HA Database with Microk8s Kubernetes.

The goal is to have MySQL running on all 3 nodes with 1 floating IP in between them, and that if any of the nodes bursts up in flames database continues to funciton.

I have installed 3 nodes following https://microk8s.io/high-availability , I grouped them together, and truly if I run microk8s kubectl get no I get

NAME    STATUS   ROLES    AGE     VERSION
node3   Ready    <none>   4m28s   v1.19.3-34+a56971609ff35a
node2   Ready    <none>   25m     v1.19.3-34+a56971609ff35a
node1   Ready    <none>   37m     v1.19.3-34+a56971609ff35a

I enabled the dashboard and it works on all 3, on individual IPs.

Now I would like to install MySQL and have it use floating IP and for data to be kept on all 3.

My questions are:

  1. How to install MySQL on microk8s?
  2. How to have it Highly available for data to copy at all times.
  3. How to have floating IP?

Can anyone please point me to the correct tutorial or help me achieve this?

Thank you

Perovic
  • 21
  • 2
  • Which kind of topoloy you want on Mysql? I mean, how many master/slaves do you desire? In kubernetes, you can create services to expose your pods, the [service](https://kubernetes.io/docs/concepts/services-networking/service/) will have a IP that will distribute the requests between the pods. – Mr.KoopaKiller Dec 02 '20 at 16:24
  • @KoopaKiller at the moment I have this type of setup: https://www.howtoforge.com/tutorial/ubuntu-drbd-heartbeat-high-availability/ Basically, 2 nodes where if node 1 is master it has MySQL on and floating IP, and DRBD is always syncing onto the slave. If Node 1 stops responding Heartbeat switches on Mysql on slave, gives slave the floating IP and slave continues to operate as a master. I want the same scenario, High availability with 3 nodes. So if node 1 is Master it has the floating IP ( floating IP is the one I use in applications). If it stops working node 2 or 3 should take the IP. – Perovic Dec 03 '20 at 08:30
  • In kubernetes it not works in the same way as in virtual or bare-metal server. Mysql requires a specific config to work in HA called [multi-master](http://dbadiaries.com/how-to-setup-mysql-master-master-replication). Please not replication not means HA. The floating IP will be the "services" in Kubernetes world. [Here](https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/) there is an example of a master-slave topology, you will need to adjust for your needs. – Mr.KoopaKiller Dec 04 '20 at 10:11

0 Answers0