colinmollenhour / mariadb-galera-swarm

MariaDb Galera Cluster container based on official mariadb image which can auto-bootstrap and recover cluster state.
https://hub.docker.com/r/colinmollenhour/mariadb-galera-swarm
Apache License 2.0
217 stars 102 forks source link

Unable to connect to the mysql #18

Closed asadyousufi closed 7 years ago

asadyousufi commented 7 years ago

I am unable to connect to the server once the cluster started

[root@docker ~]# docker ps -l CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 9e3a5697d2e2 colinmollenhour/mariadb-galera-swarm:latest "start.sh node tas..." 22 minutes ago Up 21 minutes (healthy) 3306/tcp, 4444/tcp, 4567-4568/tcp, 8080-8081/tcp, 4567/udp galera.2.g7scv4i7rwh24day4ayh5n6n1 [root@docker ~]# mysql -h 127.0.0.1 -P 3306 -root -p Enter password: ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111) [root@docker ~]#

[root@docker ~]# docker info Containers: 1 Running: 1 Paused: 0 Stopped: 0 Images: 26 Server Version: 17.03.0-ce Storage Driver: devicemapper Pool Name: docker-253:0-201594391-pool Pool Blocksize: 65.54 kB Base Device Size: 10.74 GB Backing Filesystem: xfs Data file: /dev/loop0 Metadata file: /dev/loop1 Data Space Used: 6.491 GB Data Space Total: 107.4 GB Data Space Available: 39.14 GB Metadata Space Used: 11.81 MB Metadata Space Total: 2.147 GB Metadata Space Available: 2.136 GB Thin Pool Minimum Free Space: 10.74 GB Udev Sync Supported: true Deferred Removal Enabled: false Deferred Deletion Enabled: false Deferred Deleted Device Count: 0 Data loop file: /var/lib/docker/devicemapper/devicemapper/data WARNING: Usage of loopback devices is strongly discouraged for production use. Use --storage-opt dm.thinpooldev to specify a custom block storage device. Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata Library Version: 1.02.135-RHEL7 (2016-11-16) Logging Driver: json-file Cgroup Driver: cgroupfs Plugins: Volume: local Network: bridge host macvlan null overlay Swarm: active NodeID: 3qhoawxkwp7wumb551kvukiiw Is Manager: true ClusterID: 9wdq9bz9bd2r2cir2k66tllb1 Managers: 2 Nodes: 5 Orchestration: Task History Retention Limit: 5 Raft: Snapshot Interval: 10000 Number of Old Snapshots to Retain: 0 Heartbeat Tick: 1 Election Tick: 3 Dispatcher: Heartbeat Period: 5 seconds CA Configuration: Expiry Duration: 3 months Node Address: 10.160.107.142 Manager Addresses: 10.160.104.235:2377 10.160.107.142:2377 Runtimes: runc Default Runtime: runc Init Binary: docker-init containerd version: 977c511eda0925a723debdc94d09459af49d082a runc version: a01dafd48bc1c7cc12bdb01206f9fea7dd6feb70 init version: 949e6fa Security Options: seccomp Profile: default Kernel Version: 3.10.0-327.el7.x86_64 Operating System: CentOS Linux 7 (Core) OSType: linux Architecture: x86_64 CPUs: 2 Total Memory: 1.797 GiB Name: docker.manager.01 ID: BM4X:XGZR:6YA5:WPVA:OKOB:ON76:3KSL:GMGI:ROPV:D2TB:VWCC:BJKB Docker Root Dir: /var/lib/docker Debug Mode (client): false Debug Mode (server): false Http Proxy: http://42.99.164.34:80 No Proxy: localhost,127.0.0.1,dockerhub.gemalto.com Username: asadyousufi Registry: https://index.docker.io/v1/ WARNING: bridge-nf-call-ip6tables is disabled Experimental: false Insecure Registries: 127.0.0.0/8 Live Restore Enabled: false [root@docker ~]#

colinmollenhour commented 7 years ago

You need to either expose the port to another interface or try connect to the docker container IP instead of 127.0.0.1.