GithubHelp home page GithubHelp logo

Comments (7)

Guzzi avatar Guzzi commented on June 10, 2024 3

just some thoughts:
using maxscale as sql router would allow to make readwrite split on a single port/service available (see https://mariadb.com/kb/en/mariadb-maxscale-6-read-write-splitting-with-mariadb-maxscale/) the advantage is, that the galeramon "talks" mariadb and knows about the node states (both for replication scenario and galera multimaster) and would take care about writing only to a single node andreading from multiple nodes itself - it doesn't need separate services tobe used from the outside.
Integration into the operator would probably be not too difficult, as it just requires some functional db user and some config.
I think there are some license restrictions which I can't find right now in the documentation - so I am not sure if that is a good idea - a "kubernetes native" solution also has it's advantages - just wanted to mention that and maybe others can also give some experience to that. (I am currently running maxscale in front of both maria db operator controlled replica and galera and testing it)

from mariadb-operator.

bluebike avatar bluebike commented on June 10, 2024 1

MaxScale's problem can be it's license.
It's BSL, which expires to GPL

https://github.com/mariadb-corporation/MaxScale/blob/23.02/LICENSE2302.TXT

from mariadb-operator.

kvaps avatar kvaps commented on June 10, 2024

The naming convention for Services would be:

  • <mariadb-name>: To be used for read requests. It will point to all nodes
  • <mariadb-name>-primary: To be used for write requests. It will point to a single node.

The only wish I'd like to add is one more service:

  • <mariadb-name>-secondary: To be used only for read requests. It should point to all nodes, except the primary one.

from mariadb-operator.

mmontes11 avatar mmontes11 commented on June 10, 2024

Hey there @kvaps !

I do agree that this can be something very interesting to support, as it will allow us to address the replicas without hitting the primary for serving read requests.

Unfortunately, unlike CloudNativePG, we rely on the StatefulSet construct under the hood, which implies that all the Pods will have the same labels and therefore there is no way to selectively address only some of them. The only exception is the statefulset.kubernetes.io/pod-name: mariadb-galera-0, which is the label we rely on to configure the <mariadb-name>-primary primary service. See one of our Pod labels as an example:

apiVersion: v1
kind: Pod
metadata:
  labels:
    app.kubernetes.io/instance: mariadb-galera
    app.kubernetes.io/name: mariadb
    statefulset.kubernetes.io/pod-name: mariadb-galera-0
  name: mariadb-galera-0

For this to happen, we would need to manage Pods separately, not relying on a StatefulSet and label them based on their role. See one of the CloudNativePG Pods as an example:

apiVersion: v1
kind: Pod
metadata:
  labels:
    cnpg.io/cluster: cluster-example
    cnpg.io/instanceName: cluster-example-1
    cnpg.io/podRole: instance
    postgresql: cluster-example
    role: primary
  name: cluster-example-1

I'm open to ideas and suggestions!

from mariadb-operator.

kvaps avatar kvaps commented on June 10, 2024

The only exception is the statefulset.kubernetes.io/pod-name: mariadb-galera-0, which is the label we rely on to configure the -primary primary service. See one of our Pod labels as an example

I think managing of such labels for the every pod (better on the pod side) pretty common pattern. But if you do not want to manage labels, relying on statefulset-controller, there is an another option to create and update endpoints for service directly.

from mariadb-operator.

mmontes11 avatar mmontes11 commented on June 10, 2024

I think managing of such labels for the every pod (better on the pod side) pretty common pattern. But if you do not want to manage labels, relying on statefulset-controller, there is an another option to create and update endpoints for service directly.

That's a pretty neat suggestion, will follow this approach. Just updated the issue body. 🙏🏻

using maxscale as sql router would allow to make readwrite split on a single port/service available

Supporting MaxScale is definetly we want to support at some point, will create a separate issue for it. I think we should support both the "kubernetes native" Services and also have the ability to deploy and configure a MaxScale instance which will have also its own Service to make it addresable from inside and even outside (LoadBalancer) of the cluster.

from mariadb-operator.

mmontes11 avatar mmontes11 commented on June 10, 2024

This has been supported via the following PRs:

To be released in v0.0.20 ! Stay tuned! 🚀

from mariadb-operator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.