Hi,
I am trying to run a stateful mysql job with nomad using exec driver.
I have setup a host volume in the nomad config as:
host_volume "mysql" {
path = "/opt/mysql/data"
read_only = false
}
I then reference this in the job as:
job "mysql" {
type = "service"
datacenters = var.datacenters
group "mysql-server" {
count = 1
volume "mysql" {
type = "host"
read_only = false
source = "mysql"
}
task "mysql-server" {
volume_mount {
volume = "mysql"
destination = "/var/lib/mysql"
}
driver = "exec"
config {
command = "/usr/sbin/mysqld"
args = ["--defaults-file=/var/lib/mysql/my.cnf"]
}
I expect that my.cnf
is found in the volume and the server starts, but it fails. Frustratingly without any logs anywhere. After some debugging I found that the alloc chroot (in alloc in nomad data dir) for the job didn’t have anything in /var/lib/mysql
. It’s always empty no matter what I try. I am definitely missing something basic but can’t figure out what Can someone please help?
The volume shows up fine in nomad node status -self
btw.