toughIQ / docker-mariadb-cluster

Dockerized MariaDB Galera Cluster
GNU General Public License v2.0
97 stars 69 forks source link

Service fails on startup #9

Open soeren-helbig opened 6 years ago

soeren-helbig commented 6 years ago

First of all, thanks for your work. If this one is running, it would be a very nice piece of my docker toolkit. But actually use with the following docker-compose file fails

version: "3"
services:

  database:
    image: toughiq/mariadb-cluster:10.1
    environment:
      DB_SERVICE_NAME: database
      MYSQL_ROOT_PASSWORD: 12345678
      MYSQL_DATABASE: test
      MYSQL_USER: test
      MYSQL_PASSWORD: 12345678

running docker-compose up database gives me the following output

database_1  | Initializing database
database_1  | 2017-12-14 11:31:32 139802196658112 [Note] /usr/sbin/mysqld (mysqld 10.1.29-MariaDB-1~jessie) starting as process 64 ...
database_1  | 2017-12-14 11:31:32 139802196658112 [Note] InnoDB: Using mutexes to ref count buffer pool pages
database_1  | 2017-12-14 11:31:32 139802196658112 [Note] InnoDB: The InnoDB memory heap is disabled
database_1  | 2017-12-14 11:31:32 139802196658112 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
database_1  | 2017-12-14 11:31:32 139802196658112 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
database_1  | 2017-12-14 11:31:32 139802196658112 [Note] InnoDB: Compressed tables use zlib 1.2.8
database_1  | 2017-12-14 11:31:32 139802196658112 [Note] InnoDB: Using Linux native AIO
database_1  | 2017-12-14 11:31:32 139802196658112 [Note] InnoDB: Using SSE crc32 instructions
database_1  | 2017-12-14 11:31:32 139802196658112 [Note] InnoDB: Initializing buffer pool, size = 256.0M
database_1  | 2017-12-14 11:31:32 139802196658112 [Note] InnoDB: Completed initialization of buffer pool
database_1  | 2017-12-14 11:31:32 139802196658112 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
database_1  | 2017-12-14 11:31:32 139802196658112 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
database_1  | 2017-12-14 11:31:32 139802196658112 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
database_1  | 2017-12-14 11:31:32 139802196658112 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
database_1  | 2017-12-14 11:31:33 139802196658112 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
database_1  | 2017-12-14 11:31:33 139802196658112 [Warning] InnoDB: New log files created, LSN=45781
database_1  | 2017-12-14 11:31:33 139802196658112 [Note] InnoDB: Doublewrite buffer not found: creating new
database_1  | 2017-12-14 11:31:33 139802196658112 [Note] InnoDB: Doublewrite buffer created
database_1  | 2017-12-14 11:31:33 139802196658112 [Note] InnoDB: 128 rollback segment(s) are active.
database_1  | 2017-12-14 11:31:33 139802196658112 [Warning] InnoDB: Creating foreign key constraint system tables.
database_1  | 2017-12-14 11:31:33 139802196658112 [Note] InnoDB: Foreign key constraint system tables created
database_1  | 2017-12-14 11:31:33 139802196658112 [Note] InnoDB: Creating tablespace and datafile system tables.
database_1  | 2017-12-14 11:31:33 139802196658112 [Note] InnoDB: Tablespace and datafile system tables created.
database_1  | 2017-12-14 11:31:33 139802196658112 [Note] InnoDB: Waiting for purge to start
database_1  | 2017-12-14 11:31:33 139802196658112 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.36-82.2 started; log sequence number 0
database_1  | 2017-12-14 11:31:33 139801361643264 [Note] InnoDB: Dumping buffer pool(s) not yet started
database_1  | 2017-12-14 11:31:36 140641052444608 [Note] /usr/sbin/mysqld (mysqld 10.1.29-MariaDB-1~jessie) starting as process 92 ...
database_1  | 2017-12-14 11:31:36 140641052444608 [Note] InnoDB: Using mutexes to ref count buffer pool pages
database_1  | 2017-12-14 11:31:36 140641052444608 [Note] InnoDB: The InnoDB memory heap is disabled
database_1  | 2017-12-14 11:31:36 140641052444608 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
database_1  | 2017-12-14 11:31:36 140641052444608 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
database_1  | 2017-12-14 11:31:36 140641052444608 [Note] InnoDB: Compressed tables use zlib 1.2.8
database_1  | 2017-12-14 11:31:36 140641052444608 [Note] InnoDB: Using Linux native AIO
database_1  | 2017-12-14 11:31:36 140641052444608 [Note] InnoDB: Using SSE crc32 instructions
database_1  | 2017-12-14 11:31:36 140641052444608 [Note] InnoDB: Initializing buffer pool, size = 256.0M
database_1  | 2017-12-14 11:31:36 140641052444608 [Note] InnoDB: Completed initialization of buffer pool
database_1  | 2017-12-14 11:31:36 140641052444608 [Note] InnoDB: Highest supported file format is Barracuda.
database_1  | 2017-12-14 11:31:36 140641052444608 [Note] InnoDB: 128 rollback segment(s) are active.
database_1  | 2017-12-14 11:31:36 140641052444608 [Note] InnoDB: Waiting for purge to start
database_1  | 2017-12-14 11:31:36 140641052444608 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.36-82.2 started; log sequence number 1616697
database_1  | 2017-12-14 11:31:36 140640235026176 [Note] InnoDB: Dumping buffer pool(s) not yet started
database_1  | 2017-12-14 11:31:39 140338210944960 [Note] /usr/sbin/mysqld (mysqld 10.1.29-MariaDB-1~jessie) starting as process 121 ...
database_1  | 2017-12-14 11:31:39 140338210944960 [Note] InnoDB: Using mutexes to ref count buffer pool pages
database_1  | 2017-12-14 11:31:39 140338210944960 [Note] InnoDB: The InnoDB memory heap is disabled
database_1  | 2017-12-14 11:31:39 140338210944960 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
database_1  | 2017-12-14 11:31:39 140338210944960 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
database_1  | 2017-12-14 11:31:39 140338210944960 [Note] InnoDB: Compressed tables use zlib 1.2.8
database_1  | 2017-12-14 11:31:39 140338210944960 [Note] InnoDB: Using Linux native AIO
database_1  | 2017-12-14 11:31:39 140338210944960 [Note] InnoDB: Using SSE crc32 instructions
database_1  | 2017-12-14 11:31:39 140338210944960 [Note] InnoDB: Initializing buffer pool, size = 256.0M
database_1  | 2017-12-14 11:31:39 140338210944960 [Note] InnoDB: Completed initialization of buffer pool
database_1  | 2017-12-14 11:31:39 140338210944960 [Note] InnoDB: Highest supported file format is Barracuda.
database_1  | 2017-12-14 11:31:39 140338210944960 [Note] InnoDB: 128 rollback segment(s) are active.
database_1  | 2017-12-14 11:31:39 140338210944960 [Note] InnoDB: Waiting for purge to start
database_1  | 2017-12-14 11:31:39 140338210944960 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.36-82.2 started; log sequence number 1616707
database_1  | 2017-12-14 11:31:39 140337393694464 [Note] InnoDB: Dumping buffer pool(s) not yet started
database_1  | 
database_1  | PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
database_1  | To do so, start the server, then issue the following commands:
database_1  | 
database_1  | '/usr/bin/mysqladmin' -u root password 'new-password'
database_1  | '/usr/bin/mysqladmin' -u root -h  password 'new-password'
database_1  | 
database_1  | Alternatively you can run:
database_1  | '/usr/bin/mysql_secure_installation'
database_1  | 
database_1  | which will also give you the option of removing the test
database_1  | databases and anonymous user created by default.  This is
database_1  | strongly recommended for production servers.
database_1  | 
database_1  | See the MariaDB Knowledgebase at http://mariadb.com/kb or the
database_1  | MySQL manual for more instructions.
database_1  | 
database_1  | Please report any problems at http://mariadb.org/jira
database_1  | 
database_1  | The latest information about MariaDB is available at http://mariadb.org/.
database_1  | You can find additional information about the MySQL part at:
database_1  | http://dev.mysql.com
database_1  | Consider joining MariaDB's strong and vibrant community:
database_1  | https://mariadb.org/get-involved/
database_1  | 
database_1  | Database initialized
database_1  | MySQL init process in progress...
database_1  | 2017-12-14 11:31:42 139939563587520 [Note] mysqld (mysqld 10.1.29-MariaDB-1~jessie) starting as process 154 ...
database_1  | 2017-12-14 11:31:42 139939563587520 [Note] InnoDB: Using mutexes to ref count buffer pool pages
database_1  | 2017-12-14 11:31:42 139939563587520 [Note] InnoDB: The InnoDB memory heap is disabled
database_1  | 2017-12-14 11:31:42 139939563587520 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
database_1  | 2017-12-14 11:31:42 139939563587520 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
database_1  | 2017-12-14 11:31:42 139939563587520 [Note] InnoDB: Compressed tables use zlib 1.2.8
database_1  | 2017-12-14 11:31:42 139939563587520 [Note] InnoDB: Using Linux native AIO
database_1  | 2017-12-14 11:31:42 139939563587520 [Note] InnoDB: Using SSE crc32 instructions
database_1  | 2017-12-14 11:31:42 139939563587520 [Note] InnoDB: Initializing buffer pool, size = 256.0M
database_1  | 2017-12-14 11:31:42 139939563587520 [Note] InnoDB: Completed initialization of buffer pool
database_1  | 2017-12-14 11:31:42 139939563587520 [Note] InnoDB: Highest supported file format is Barracuda.
database_1  | 2017-12-14 11:31:42 139939563587520 [Note] InnoDB: 128 rollback segment(s) are active.
database_1  | 2017-12-14 11:31:42 139939563587520 [Note] InnoDB: Waiting for purge to start
database_1  | 2017-12-14 11:31:42 139939563587520 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.36-82.2 started; log sequence number 1616717
database_1  | 2017-12-14 11:31:42 139938746070784 [Note] InnoDB: Dumping buffer pool(s) not yet started
database_1  | 2017-12-14 11:31:42 139939563587520 [Note] Plugin 'FEEDBACK' is disabled.
database_1  | 2017-12-14 11:31:42 139939563587520 [Warning] 'user' entry 'root@eca312c9edad' ignored in --skip-name-resolve mode.
database_1  | 2017-12-14 11:31:42 139939563587520 [Warning] 'proxies_priv' entry '@% root@eca312c9edad' ignored in --skip-name-resolve mode.
database_1  | 2017-12-14 11:31:42 139939563587520 [Note] mysqld: ready for connections.
database_1  | Version: '10.1.29-MariaDB-1~jessie'  socket: '/var/run/mysqld/mysqld.sock'  port: 0  mariadb.org binary distribution
database_1  | Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it.
database_1  | 2017-12-14 11:31:43 139939562720000 [Warning] 'proxies_priv' entry '@% root@eca312c9edad' ignored in --skip-name-resolve mode.
database_1  | 2017-12-14 11:31:43 139939562720000 [Warning] 'proxies_priv' entry '@% root@eca312c9edad' ignored in --skip-name-resolve mode.
database_1  | 
database_1  | /usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/init_cluster_conf.sh
gelarcluster_database_1 exited with code 2

Am i doing wrong? Can i provide some more output to help you fixing the issue?

melliott-sis commented 6 years ago

I believe this is due to some issues with naming/service discovery with docker compose or docker stack deploy. I was using docker stack deploy to run this in swarm, and I found I needed to add an alias, matching DB_SERVICE_NAME.

Provided you had a pre-existing network named "database" (docker network create -d overlay --subnet=172.100.100.0/24 database) your docker-compose.yml may need to look like this..

version: "3"
services:

  database:
    image: toughiq/mariadb-cluster:10.1
    environment:
      DB_SERVICE_NAME: database
      MYSQL_ROOT_PASSWORD: 12345678
      MYSQL_DATABASE: test
      MYSQL_USER: test
      MYSQL_PASSWORD: 12345678
    networks:
       database:
         aliases:
          - database

I can't guarantee that you're hitting the same problem I was, but it looks similar. I'm actually hoping to write up a blog post about this specific issue so hopefully I can remember to come back here and link it...