outbrain / orchestrator-agent

MySQL replication topology manager - agent (daemon)
Apache License 2.0
35 stars 53 forks source link

Error 1364: Field 'count_mysql_snapshots' doesn't have a default value #20

Open ofbeaton opened 8 years ago

ofbeaton commented 8 years ago

With orchestrator 1.5.0 and orchestrator-agent 1.1.25 both from rpm on centos 6

So after setting up the default rpm's on centos and configuring orchestrator, everything was peachy but my agents weren't reporting in. I modified orchestrator-agent.conf.json to point to right server but it still wasn't working.

Checking /var/lib/orchestrator.log I saw errors like:

[martini] Started GET /api/submit-agent/myserver/3002/6bc145b06fdcbc8a7f00e6bf211c22a0827e3f33d7dd049b4de6abd1b710fd0c for 7.28.245.156:56818
2016-07-12 16:20:02 ERROR Error 1364: Field 'count_mysql_snapshots' doesn't have a default value
2016-07-12 16:20:02 ERROR Error 1364: Field 'count_mysql_snapshots' doesn't have a default value
[martini] Completed 200 OK in 11.346799ms

my orchestrator-agent.conf.json is near default provided by the rpm. Of note is that I'm not using the LVM functionality.

{
  "SnapshotMountPoint": "/tmp",
  "AgentsServer": "http://my-orchestrator-box.mynetwork.com:3001",
  "ContinuousPollSeconds" : 60,
  "ResubmitAgentIntervalMinutes": 60,
  "CreateSnapshotCommand": "echo 'no action'",
  "AvailableLocalSnapshotHostsCommand": "echo 127.0.0.1",
  "AvailableSnapshotHostsCommand": "echo localhost\n127.0.0.1",
  "SnapshotVolumesFilter": "-my-snapshot-",
  "MySQLDatadirCommand": "set $(grep datadir /etc/my.cnf | head -n 1 | awk -F= '{print $2}') ; echo $1",
  "MySQLPortCommand": "set $(grep ^port /etc/my.cnf | head -n 1 | awk -F= '{print $2}') ; echo $1",
  "MySQLDeleteDatadirContentCommand": "echo 'will not do'",
  "MySQLServiceStopCommand": "/etc/init.d/mysqld stop",
  "MySQLServiceStartCommand": "/etc/init.d/mysqld start",
  "MySQLServiceStatusCommand": "/etc/init.d/mysqld status",
  "ReceiveSeedDataCommand":       "echo 'not implemented here'",
  "SendSeedDataCommand":          "echo 'not implemented here'",
  "PostCopyCommand":              "echo 'post copy'",
  "HTTPPort": 3002,
  "HTTPAuthUser": "",
  "HTTPAuthPassword": "",
  "UseSSL": false,
  "SSLCertFile": "",
  "SSLPrivateKeyFile": "",
  "HttpTimeoutSeconds": 10
}

So on a whim I did an ALTER TABLE in MySQL orchestrator.host_agent.count_mysql_snapshots to set a DEFAULT value of 0.

A few refreshes later and the error no longer occurs and my agent info is now populated in the orchestrator GUI.

You'll still get some errors in the logs, as this obviously isn't the right fix. But it should get you running in the short term.

[martini] Started GET /api/submit-agent/myserver/3002/f4a57561fb14029cc1f762cf503f252e9895f4de54dc704c982d22a9393d835c for 7.28.225.201:56846
[martini] Completed 200 OK in 20.484832ms
2016-07-12 16:31:23 ERROR json: cannot unmarshal object into Go value of type []string

What is the proper fix?