如何在docker-compose w / pxc-cluster + proxysql

时间:2019-04-26 07:52:38

标签: docker docker-compose etcd

我想创建一个最少3个节点的dockerized pxc

  • 为此我将etcd用作发现服务
  • percona xtradb集群5.7(pxc)作为数据库服务器
  • 用于负载平衡的代理

docker-compose v2文件:

version: "2"
services:
  etcd0:
      image: quay.io/coreos/etcd:latest
      restart: always
      ports:
           - 2379:2379
           - 2380:2380
           - 4001:4001
      volumes:
        - ./certs/:/srv/
        - /srv/docker/etcd:/etcd-data
        - /usr/share/ca-certificates/:/etc/ssl/certs
      networks:
        - network
      environment:
          ETCD_NAME: node1
          ETCD_DATA_DIR: /etcd-data/etcd0.etcd
          ETCDCTL_API: 3
          ETCD_DEBUG: 1
          ETCD_INITIAL_ADVERTISE_PEER_URLS: http://etcd0:2380
          ETCD_INITIAL_CLUSTER: node1=http://etcd0:2380
          ETCD_INITIAL_CLUSTER_STATE: new
          ETCD_INITIAL_CLUSTER_TOKEN: H0bcbBTMh2MDPkXU8ioW
          ETCD_LISTEN_CLIENT_URLS: http://0.0.0.0:2379
          ETCD_LISTEN_PEER_URLS: http://0.0.0.0:2380
          ETCD_ADVERTISE_CLIENT_URLS: http://etcd0:2379,http://etcd0:4001

  node1:
    container_name: node1
    restart: always
    image: percona/percona-xtradb-cluster:latest
    environment:
      - CLUSTER_NAME=pxc-cluster01
      - MYSQL_ROOT_PASSWORD=s3cr3t
      - DISCOVERY_SERVICE=pxc_etcd0_1:2379
      - XTRABACKUP_PASSWORD=s3cr3t
    networks:
      - network

networks:
  network:
    driver: bridge

问题:

  • etcd尝试使用我无法控制凭据的监视用户连接到我的pxc节点,因此登录始终失败
  • 在etcd的官方文档中,我找不到关于etcd以用户“ monitor”身份连接到数据库的方式的一些信息。

$ docker容器日志-f node1

2019-04-26T07:29:43.347857Z 5 [Note] Access denied for user 'monitor'@'localhost' (using password: YES)
2019-04-26T07:29:48.364957Z 6 [Note] Access denied for user 'monitor'@'localhost' (using password: YES)
2019-04-26T07:29:53.429318Z 7 [Note] Access denied for user 'monitor'@'localhost' (using password: YES)
2019-04-26T07:29:58.446057Z 8 [Note] Access denied for user 'monitor'@'localhost' (using password: YES)
2019-04-26T07:30:03.481623Z 9 [Note] Access denied for user 'monitor'@'localhost' (using password: YES)

[...]

$ docker容器日志-f pxc_etcd0_1

2019-04-26 07:46:14.546843 D | etcdserver/api/v2http: [DELETE] /v2/keys/pxc-cluster/pxc-cluster01/172.29.0.3/?recursive=true remote:172.29.0.3:52082
2019-04-26 07:46:19.580041 D | etcdserver/api/v2http: [DELETE] /v2/keys/pxc-cluster/pxc-cluster01/172.29.0.3/?recursive=true remote:172.29.0.3:52084
2019-04-26 07:46:24.671394 D | etcdserver/api/v2http: [DELETE] /v2/keys/pxc-cluster/pxc-cluster01/172.29.0.3/?recursive=true remote:172.29.0.3:52086
2019-04-26 07:46:29.704266 D | etcdserver/api/v2http: [DELETE] /v2/keys/pxc-cluster/pxc-cluster01/172.29.0.3/?recursive=true remote:172.29.0.3:52088
2019-04-26 07:46:34.721640 D | etcdserver/api/v2http: [DELETE] /v2/keys/pxc-cluster/pxc-cluster01/172.29.0.3/?recursive=true remote:172.29.0.3:52090
2019-04-26 07:46:39.745445 D | etcdserver/api/v2http: [DELETE] /v2/keys/pxc-cluster/pxc-cluster01/172.29.0.3/?recursive=true remote:172.29.0.3:52092
2019-04-26 07:46:44.787393 D | etcdserver/api/v2http: [DELETE] /v2/keys/pxc-cluster/pxc-cluster01/172.29.0.3/?recursive=true remote:172.29.0.3:52094
  • 还尝试通过$ docker exec -it pxc_etcd0_1 / bin / sh进入容器

打开无法在其中找到(尝试进行递归搜索)配置文件的外壳程序。

问题是:

  • 是否有etcd配置文件?
  • 我做错什么了吗?

0 个答案:

没有答案