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

Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. sock' in proxy node #8

Open
Qanah opened this issue Oct 3, 2020 · 0 comments

Comments

@Qanah
Copy link

Qanah commented Oct 3, 2020

I have this approach, but it does not work can you help me with this

version: '3.1'

# https://xinity.github.io/Percona-PXC-Swarm-mode/

services:

  etcd:
    image: elcolio/etcd:latest
    networks:
      - galera_network
    ports:
      - 2379:2379
      - 2380:2380
      - 4001:4001
      - 7001:7001
    deploy:
      mode: replicated
      labels: [APP=etcd]
      replicas: 1
      placement:
        constraints: [node.role == manager]

  proxy:
    depends_on:
      - etcd
    image: perconalab/proxysql
    networks:
      - galera_network
    ports:
      - 3306:3306
      - 6032:6032
    environment:
      DISCOVERY_SERVICE: "etcd:2379"
      CLUSTER_NAME: "galera-15"
      MYSQL_ROOT_PASSWORD: "s3cr3TL33tP@ssw0rd"
      MYSQL_PROXY_USER: "proxyuser"
      MYSQL_PROXY_PASSWORD: "s3cr3TL33tPr0xyP@ssw0rd"
    deploy:
      mode: replicated
      replicas: 1
      labels: [APP=proxysql]
      # service restart policy
      restart_policy:
        condition: on-failure
        delay: 5s
        max_attempts: 3
        window: 120s
      # service update configuration
      update_config:
        parallelism: 1
        delay: 10s
        failure_action: continue
        monitor: 60s
        max_failure_ratio: 0.3
      # placement constraint - in this case on 'worker' nodes only
      placement:
        constraints: [node.role == manager]

  percona-xtradb-cluster:
    image: percona/percona-xtradb-cluster
    networks:
      - galera_network
    environment:
      DISCOVERY_SERVICE: "etcd:2379"
      CLUSTER_NAME: "galera-15"
      CLUSTER_JOIN: "proxy"
      MYSQL_ROOT_PASSWORD: "s3cr3TL33tP@ssw0rd"
    command: >
      /bin/sh -c "until mysqladmin ping -h proxy -P 3306 -u root -ps3cr3TL33tP@ssw0rd | grep 'mysqld is alive'; do echo 'MySQL is unavailable - waiting for it... 😴'; sleep 1; done; mysqld"
    deploy:
      mode: global
      labels: [APP=pxc]
      # service restart policy
      restart_policy:
        condition: on-failure
        delay: 5s
        max_attempts: 3
        window: 120s
      # service update configuration
      update_config:
        parallelism: 1
        delay: 10s
        failure_action: continue
        monitor: 60s
        max_failure_ratio: 0.3
      # placement constraint - in this case on 'worker' nodes only
      placement:
        constraints: [node.role == worker]

networks:
  galera_network:
    external: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant