xinity / pxc_swarm Goto Github PK
View Code? Open in Web Editor NEWa docker swarm Percona PXC setup
License: Apache License 2.0
a docker swarm Percona PXC setup
License: Apache License 2.0
Hey man,
an amazing tutorial. I was able to follow through it just perfectly. I got it all running smoothly on a local 3-node cluster.
However when I went on to our testing environment to deploy the stack there, etcd kept reporting:
percona_etcd.1.pu3dhbwh5tdx@test-011 | 2018-04-24 18:26:05.857945 E | pkg/netutil: could not resolve host galera_etcd:2380
percona_etcd.1.pu3dhbwh5tdx@test-011 | 2018-04-24 18:26:05.858792 C | etcdmain: failed to resolve http://galera_etcd:2380 to match --initial-cluster=etcd0=http://galera_etcd:2380 (failed to resolve "http://galera_etcd:2380" (lookup galera_etcd on 127.0.0.11:53: no such host))
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:11.499244 I | pkg/flags: recognized and used environment variable ETCD_ADVERTISE_CLIENT_URLS=http://galera_etcd:2379,http://galera_etcd:4001
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:11.499300 I | pkg/flags: recognized and used environment variable ETCD_DATA_DIR=/opt/etcd/data
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:11.499321 I | pkg/flags: recognized and used environment variable ETCD_INITIAL_ADVERTISE_PEER_URLS=http://galera_etcd:2380
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:11.499330 I | pkg/flags: recognized and used environment variable ETCD_INITIAL_CLUSTER=etcd0=http://galera_etcd:2380
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:11.499334 I | pkg/flags: recognized and used environment variable ETCD_INITIAL_CLUSTER_STATE=new
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:11.499339 I | pkg/flags: recognized and used environment variable ETCD_INITIAL_CLUSTER_TOKEN=etcd-cluster-1
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:11.499347 I | pkg/flags: recognized and used environment variable ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379,http://0.0.0.0:4001
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:11.499354 I | pkg/flags: recognized and used environment variable ETCD_LISTEN_PEER_URLS=http://0.0.0.0:2380
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:11.499367 I | pkg/flags: recognized and used environment variable ETCD_NAME=etcd0
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:11.499411 I | etcdmain: etcd Version: 3.3.3
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:11.499417 I | etcdmain: Git SHA: e348b1aed
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:11.499420 I | etcdmain: Go Version: go1.9.5
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:11.499423 I | etcdmain: Go OS/Arch: linux/amd64
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:11.499426 I | etcdmain: setting maximum number of CPUs to 4, total number of available CPUs is 4
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:11.499496 I | embed: listening for peers on http://0.0.0.0:2380
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:11.499522 I | embed: listening for client requests on 0.0.0.0:2379
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:11.499544 I | embed: listening for client requests on 0.0.0.0:4001
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:11.502371 W | pkg/netutil: failed resolving host galera_etcd:2380 (lookup galera_etcd on 127.0.0.11:53: no such host); retrying in 1s
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:12.503543 W | pkg/netutil: failed resolving host galera_etcd:2380 (lookup galera_etcd on 127.0.0.11:53: no such host); retrying in 1s
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:13.504880 W | pkg/netutil: failed resolving host galera_etcd:2380 (lookup galera_etcd on 127.0.0.11:53: no such host); retrying in 1s
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:14.506266 W | pkg/netutil: failed resolving host galera_etcd:2380 (lookup galera_etcd on 127.0.0.11:53: no such host); retrying in 1s
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:15.507648 W | pkg/netutil: failed resolving host galera_etcd:2380 (lookup galera_etcd on 127.0.0.11:53: no such host); retrying in 1s
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:16.509034 W | pkg/netutil: failed resolving host galera_etcd:2380 (lookup galera_etcd on 127.0.0.11:53: no such host); retrying in 1s
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:17.510374 W | pkg/netutil: failed resolving host galera_etcd:2380 (lookup galera_etcd on 127.0.0.11:53: no such host); retrying in 1s
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:18.511540 W | pkg/netutil: failed resolving host galera_etcd:2380 (lookup galera_etcd on 127.0.0.11:53: no such host); retrying in 1s
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:19.512725 W | pkg/netutil: failed resolving host galera_etcd:2380 (lookup galera_etcd on 127.0.0.11:53: no such host); retrying in 1s
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:20.513914 W | pkg/netutil: failed resolving host galera_etcd:2380 (lookup galera_etcd on 127.0.0.11:53: no such host); retrying in 1s
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:21.515033 W | pkg/netutil: failed resolving host galera_etcd:2380 (lookup galera_etcd on 127.0.0.11:53: no such host); retrying in 1s
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:22.516254 W | pkg/netutil: failed resolving host galera_etcd:2380 (lookup galera_etcd on 127.0.0.11:53: no such host); retrying in 1s
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:23.517597 W | pkg/netutil: failed resolving host galera_etcd:2380 (lookup galera_etcd on 127.0.0.11:53: no such host); retrying in 1s
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:24.518835 W | pkg/netutil: failed resolving host galera_etcd:2380 (lookup galera_etcd on 127.0.0.11:53: no such host); retrying in 1s
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:25.520160 W | pkg/netutil: failed resolving host galera_etcd:2380 (lookup galera_etcd on 127.0.0.11:53: no such host); retrying in 1s
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:26.521383 W | pkg/netutil: failed resolving host galera_etcd:2380 (lookup galera_etcd on 127.0.0.11:53: no such host); retrying in 1s
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:27.522600 W | pkg/netutil: failed resolving host galera_etcd:2380 (lookup galera_etcd on 127.0.0.11:53: no such host); retrying in 1s
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:28.523986 W | pkg/netutil: failed resolving host galera_etcd:2380 (lookup galera_etcd on 127.0.0.11:53: no such host); retrying in 1s
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:29.525255 W | pkg/netutil: failed resolving host galera_etcd:2380 (lookup galera_etcd on 127.0.0.11:53: no such host); retrying in 1s
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:30.526946 W | pkg/netutil: failed resolving host galera_etcd:2380 (lookup galera_etcd on 127.0.0.11:53: no such host); retrying in 1s
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:31.528323 W | pkg/netutil: failed resolving host galera_etcd:2380 (lookup galera_etcd on 127.0.0.11:53: no such host); retrying in 1s
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:32.529844 W | pkg/netutil: failed resolving host galera_etcd:2380 (lookup galera_etcd on 127.0.0.11:53: no such host); retrying in 1s
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:33.531065 W | pkg/netutil: failed resolving host galera_etcd:2380 (lookup galera_etcd on 127.0.0.11:53: no such host); retrying in 1s
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:34.532294 W | pkg/netutil: failed resolving host galera_etcd:2380 (lookup galera_etcd on 127.0.0.11:53: no such host); retrying in 1s
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:35.533496 W | pkg/netutil: failed resolving host galera_etcd:2380 (lookup galera_etcd on 127.0.0.11:53: no such host); retrying in 1s
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:36.534812 W | pkg/netutil: failed resolving host galera_etcd:2380 (lookup galera_etcd on 127.0.0.11:53: no such host); retrying in 1s
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:37.536152 W | pkg/netutil: failed resolving host galera_etcd:2380 (lookup galera_etcd on 127.0.0.11:53: no such host); retrying in 1s
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:38.537574 W | pkg/netutil: failed resolving host galera_etcd:2380 (lookup galera_etcd on 127.0.0.11:53: no such host); retrying in 1s
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:39.538832 W | pkg/netutil: failed resolving host galera_etcd:2380 (lookup galera_etcd on 127.0.0.11:53: no such host); retrying in 1s
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:40.540126 W | pkg/netutil: failed resolving host galera_etcd:2380 (lookup galera_etcd on 127.0.0.11:53: no such host); retrying in 1s
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:41.501414 E | pkg/netutil: could not resolve host galera_etcd:2380
percona_etcd.1.srj6veewwulx@test-011 | 2018-04-24 18:26:41.502104 C | etcdmain: failed to resolve http://galera_etcd:2380 to match --initial-cluster=etcd0=http://galera_etcd:2380 (failed to resolve "http://galera_etcd:2380" (lookup galera_etcd on 127.0.0.11:53: no such host))
I assume there is a problem resolving DNS names? I have no clue where I might find help with that as the search for "etcd failed resolving hostname" or "etcdmain failed to resolve" does not yield anything viable yet.
I am also thinking it's not an etcd issue but a Docker issue.
Maybe it's not connected to DNS but maybe I am missing a port to open?
If you can provide any hint I am happy for anything!
Thank you for your awesome instructions.
In this line. You mean # placement constraint - in this case on '**manager**' nodes only
, don't you?
Hi,
I'm getting this error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.
sock' (2)
Details:
[node1] (local) [email protected] ~/docker-stack-this/PXC-Cluster
$ # Find the ID for galera_proxy
[node1] (local) [email protected] ~/docker-stack-this/PXC-Cluster
$ ctn_NAME=galera_proxy && \
> ctnID=$(docker ps -q --filter label=com.docker.swarm.service.name=$ctn_NAME)
[node1] (local) [email protected] ~/docker-stack-this/PXC-Cluster
$ echo "$ctnID"
d2eeee1f793d
[node1] (local) [email protected] ~/docker-stack-this/PXC-Cluster
$ echo && echo "galera_proxy ID is: $ctnID"
galera_proxy ID is: d2eeee1f793d
[node1] (local) [email protected] ~/docker-stack-this/PXC-Cluster
$ echo && echo
[node1] (local) [email protected] ~/docker-stack-this/PXC-Cluster
$ docker exec -it $ctnID mysql -uproxyuser -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.
sock' (2)
[node1] (local) [email protected] ~/docker-stack-this/PXC-Cluster
You can quickly recreate my setup using play-with-docker. See the steps I have done here: https://github.com/pascalandy/docker-stack-this/tree/master/PXC-Cluster
Thanks!
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
https://xinity.github.io/Percona-PXC-Swarm-mode/
More information: see my blog post
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.