Buy Percona ServicesBuy Now!

k8s Operator and UDF

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • k8s Operator and UDF

    Hi,

    we currently are using an UDF to get the levenshtein distance (https://github.com/juanmirocks/Levenshtein-MySQL-UDF) in Percona XtraDB Cluster, because the implementations written in SQL are much too slow.

    This works great but now we think about moving our database to a self-hosted k8s-Cluster using the Percona Operator.

    Is there an easy way to bring such an UDF inside the cluster, without having to build own images?

  • #2
    Hi ewaldrg 👋
    you can add UDF easily via few simple steps

    1. create Dockerfile with the following content
    Code:
    FROM percona/percona-xtradb-cluster-operator:1.2.0-pxc AS build-env
    USER root
    RUN microdnf -y install gcc git Percona-XtraDB-Cluster-devel-57
    RUN git clone https://github.com/juanmirocks/Levenshtein-MySQL-UDF.git
    RUN gcc -o /usr/lib64/mysql/plugin/levenshtein.so -shared Levenshtein-MySQL-UDF/levenshtein.c `mysql_config --include` -fPIC
    
    FROM percona/percona-xtradb-cluster-operator:1.2.0-pxc
    COPY --from=build-env /usr/lib64/mysql/plugin/levenshtein.so /usr/lib64/mysql/plugin/levenshtein.so
    2. build
    Code:
    docker build -f Dockerfile -t ewaldrg/pxc-with-levenshtein .
    3. create the free repository on Docker Hub for the image and push it into it
    Code:
    docker login -u ewaldrg
    docker push ewaldrg/pxc-with-levenshtein
    4. use "ewaldrg/pxc-with-levenshtein" image with Percona Operator for Percona XtraDB Cluster (via change spec.pxc.image option inside deploy/cr.yaml)

    5. Have fun with Kubernetes!

    Comment


    • #3
      Thanks Mykola

      This solution works in my Minikube environment.

      Comment

      Working...
      X