Unable to use host directory as volume for datadir

206 views
Skip to first unread message

Venkat R

unread,
Sep 8, 2015, 10:21:14 AM9/8/15
to codership
I'm trying to run a MySQL/Galera cluster, with a persistent disk attached to my VM (on google compute engine). The idea is to use the persistent disk (which is mounted at /data/mysql) as the datadir for MySQL/Galera. Now, when I try to start the first node in my cluster, i get the following log:
-------------------------------------
$ docker run --name galera1  -p 3306:3306 -p 4567:4567 -p 4444:4444 -p 4568:4568 -v /data/mysql:/var/lib/mysql erkules/galera:basic --wsrep-cluster-address=gcomm:// --wsrep-node-address=172.28.128.5 --wsrep-provider-options="pc.bootstrap=true" --wsrep-new-cluster
2015-09-08 14:01:10 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2015-09-08 14:01:10 1 [Note] WSREP: Read nil XID from storage engines, skipping position init
2015-09-08 14:01:10 1 [Note] WSREP: wsrep_load(): loading provider library '/usr/lib/galera/libgalera_smm.so'
2015-09-08 14:01:10 1 [Note] WSREP: wsrep_load(): Galera 3.9(rb7b5dd0) by Codership Oy <in...@codership.com> loaded successfully.
2015-09-08 14:01:10 1 [Note] WSREP: CRC-32C: using hardware acceleration.
2015-09-08 14:01:10 1 [Warning] WSREP: Could not open saved state file for reading: /var/lib/mysql//grastate.dat
2015-09-08 14:01:10 1 [Note] WSREP: Found saved state: 00000000-0000-0000-0000-000000000000:-1
2015-09-08 14:01:10 1 [Note] WSREP: Passing config to GCS: base_host = 172.28.128.5; base_port = 4567; cert.log_conflicts = no; debug = no; evs.auto_evict = 0; evs.delay_margin = PT1S; evs.delayed_keep_period = PT30S; evs.inactive_check_period = PT0.5S; evs.inactive_timeout = PT15S; evs.join_retrans_period = PT1S; evs.max_install_timeouts = 3; evs.send_window = 4; evs.stats_report_period = PT1M; evs.suspect_timeout = PT5S; evs.user_send_window = 2; evs.view_forget_timeout = PT24H; gcache.dir = /var/lib/mysql/; gcache.keep_pages_size = 0; gcache.mem_size = 0; gcache.name = /var/lib/mysql//galera.cache; gcache.page_size = 128M; gcache.size = 128M; gcs.fc_debug = 0; gcs.fc_factor = 1.0; gcs.fc_limit = 16; gcs.fc_master_slave = no; gcs.max_packet_size = 64500; gcs.max_throttle = 0.25; gcs.recv_q_hard_limit = 9223372036854775807; gcs.recv_q_soft_limit = 0.25; gcs.sync_donor = no; gmcast.segment = 0; gmcast.version = 0; pc.announce_timeout = PT3S; pc.bootstrap = true; pc.checksum = false; pc.ignore_quorum = false; pc.ignore_sb = false; pc.npv
2015-09-08 14:01:10 1 [Note] WSREP: Service thread queue flushed.
2015-09-08 14:01:10 1 [Note] WSREP: Assign initial position for certification: -1, protocol version: -1
2015-09-08 14:01:10 1 [Note] WSREP: wsrep_sst_grab()
2015-09-08 14:01:10 1 [Note] WSREP: Start replication
2015-09-08 14:01:10 1 [Note] WSREP: Setting initial position to 00000000-0000-0000-0000-000000000000:-1
2015-09-08 14:01:10 1 [Note] WSREP: protonet asio version 0
2015-09-08 14:01:10 1 [Note] WSREP: Using CRC-32C for message checksums.
2015-09-08 14:01:10 1 [Note] WSREP: backend: asio
2015-09-08 14:01:10 1 [Warning] WSREP: access file(gvwstate.dat) failed(No such file or directory)
2015-09-08 14:01:10 1 [Note] WSREP: restore pc from disk failed
2015-09-08 14:01:10 1 [Note] WSREP: GMCast version 0
2015-09-08 14:01:10 1 [Note] WSREP: (0ecdb807, 'tcp://0.0.0.0:4567') listening at tcp://0.0.0.0:4567
2015-09-08 14:01:10 1 [Note] WSREP: (0ecdb807, 'tcp://0.0.0.0:4567') multicast: , ttl: 1
2015-09-08 14:01:10 1 [Note] WSREP: EVS version 0
2015-09-08 14:01:10 1 [Note] WSREP: gcomm: bootstrapping new group 'my_wsrep_cluster'
2015-09-08 14:01:10 1 [Note] WSREP: start_prim is enabled, turn off pc_recovery
2015-09-08 14:01:10 1 [Note] WSREP: Node 0ecdb807 state prim
2015-09-08 14:01:10 1 [Note] WSREP: view(view_id(PRIM,0ecdb807,1) memb {
        0ecdb807,0
} joined {
} left {
} partitioned {
})
2015-09-08 14:01:10 1 [Note] WSREP: save pc into disk
2015-09-08 14:01:10 1 [Note] WSREP: gcomm: connected
2015-09-08 14:01:10 1 [Note] WSREP: Changing maximum packet size to 64500, resulting msg size: 32636
2015-09-08 14:01:10 1 [Note] WSREP: Shifting CLOSED -> OPEN (TO: 0)
2015-09-08 14:01:10 1 [Note] WSREP: Opened channel 'my_wsrep_cluster'
2015-09-08 14:01:10 1 [Note] WSREP: Waiting for SST to complete.
2015-09-08 14:01:10 1 [Note] WSREP: New COMPONENT: primary = yes, bootstrap = no, my_idx = 0, memb_num = 1
2015-09-08 14:01:10 1 [Note] WSREP: Starting new group from scratch: 0ecf6600-5632-11e5-bdfc-2227c79ef2d8
2015-09-08 14:01:10 1 [Note] WSREP: STATE_EXCHANGE: sent state UUID: 0ecf9d13-5632-11e5-b259-1a7b2c3c13fe
2015-09-08 14:01:10 1 [Note] WSREP: STATE EXCHANGE: sent state msg: 0ecf9d13-5632-11e5-b259-1a7b2c3c13fe
2015-09-08 14:01:10 1 [Note] WSREP: STATE EXCHANGE: got state msg: 0ecf9d13-5632-11e5-b259-1a7b2c3c13fe from 0 (0297b248e34a)
2015-09-08 14:01:10 1 [Note] WSREP: Quorum results:
        version    = 3,
        component  = PRIMARY,
        conf_id    = 0,
        members    = 1/1 (joined/total),
        act_id     = 0,
        last_appl. = -1,
        protocols  = 0/7/3 (gcs/repl/appl),
        group UUID = 0ecf6600-5632-11e5-bdfc-2227c79ef2d8
2015-09-08 14:01:10 1 [Note] WSREP: Flow-control interval: [16, 16]
2015-09-08 14:01:10 1 [Note] WSREP: Restored state OPEN -> JOINED (0)
2015-09-08 14:01:10 1 [Note] WSREP: New cluster view: global state: 0ecf6600-5632-11e5-bdfc-2227c79ef2d8:0, view# 1: Primary, number of nodes: 1, my index: 0, protocol version 3
2015-09-08 14:01:10 1 [Note] WSREP: SST complete, seqno: 0
2015-09-08 14:01:10 1 [Note] Plugin 'FEDERATED' is disabled.
mysqld: Table 'mysql.plugin' doesn't exist
2015-09-08 14:01:10 1 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2015-09-08 14:01:10 1 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-09-08 14:01:10 1 [Note] InnoDB: The InnoDB memory heap is disabled
2015-09-08 14:01:10 1 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2015-09-08 14:01:10 1 [Note] InnoDB: Memory barrier is not used
2015-09-08 14:01:10 1 [Note] InnoDB: Compressed tables use zlib 1.2.8
2015-09-08 14:01:10 1 [Note] InnoDB: Using Linux native AIO
2015-09-08 14:01:10 1 [Note] InnoDB: Using CPU crc32 instructions
2015-09-08 14:01:10 1 [Note] WSREP: Member 0.0 (0297b248e34a) synced with group.
2015-09-08 14:01:10 1 [Note] WSREP: Shifting JOINED -> SYNCED (TO: 0)
2015-09-08 14:01:10 1 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2015-09-08 14:01:10 1 [Note] InnoDB: Completed initialization of buffer pool
2015-09-08 14:01:10 1 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2015-09-08 14:01:10 1 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2015-09-08 14:01:10 1 [Note] InnoDB: Database physically writes the file full: wait...
2015-09-08 14:01:10 1 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2015-09-08 14:01:10 1 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2015-09-08 14:01:10 1 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2015-09-08 14:01:10 1 [Warning] InnoDB: New log files created, LSN=45781
2015-09-08 14:01:10 1 [Note] InnoDB: Doublewrite buffer not found: creating new
2015-09-08 14:01:10 1 [Note] InnoDB: Doublewrite buffer created
2015-09-08 14:01:10 1 [Note] InnoDB: 128 rollback segment(s) are active.
2015-09-08 14:01:10 1 [Warning] InnoDB: Creating foreign key constraint system tables.
2015-09-08 14:01:10 1 [Note] InnoDB: Foreign key constraint system tables created
2015-09-08 14:01:10 1 [Note] InnoDB: Creating tablespace and datafile system tables.
2015-09-08 14:01:10 1 [Note] InnoDB: Tablespace and datafile system tables created.
2015-09-08 14:01:10 1 [Note] InnoDB: Waiting for purge to start
2015-09-08 14:01:10 1 [Note] InnoDB: 5.6.21 started; log sequence number 0
2015-09-08 14:01:10 1 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 0f1274e7-5632-11e5-a987-0242ac11000f.
2015-09-08 14:01:10 1 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
2015-09-08 14:01:10 1 [Note]   - '0.0.0.0' resolves to '0.0.0.0';
2015-09-08 14:01:10 1 [Note] Server socket created on IP: '0.0.0.0'.
2015-09-08 14:01:10 1 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
-------------------------------------

How can I initialize the mysql database for the cluster so that this error does not happen? Or am I missing something fundamental here?

Thanks,
-Venkat

Philip Stoev

unread,
Sep 8, 2015, 11:47:01 AM9/8/15
to Venkat R, codership
Hello,

You need to use the mysql_install_db script first to populate the desired
data directory.

https://dev.mysql.com/doc/refman/5.6/en/mysql-install-db.html
--
You received this message because you are subscribed to the Google Groups
"codership" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to codership-tea...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Venkatasubramanian Ramachandran

unread,
Sep 9, 2015, 7:24:37 AM9/9/15
to Philip Stoev, codership
Philip,
   Thanks for the tip. Appreciate it.
   To run the script via docker, do you think the following command is good or would there be a better way:

$ docker run -it --entrypoint /bin/bash -v /data/mysql:/var/lib/mysql erkules/galera:basic -c "if [ ! -f /usr/share/mysql/my-default.cnf ] ; then cp /etc/mysql/my.cnf /usr/share/mysql/my-default.cnf;fi && /usr/bin/mysql_install_db --user=mysql"

Thanks,
-Venkat
--
-------------------------------------
Venkat Ramachandran
+91 9449072323
Reply all
Reply to author
Forward
0 new messages