Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with setting master log position #10

Closed
tedbjorling opened this issue Dec 8, 2014 · 7 comments
Closed

Issue with setting master log position #10

tedbjorling opened this issue Dec 8, 2014 · 7 comments

Comments

@tedbjorling
Copy link

Hi,

I am trying to configure a Slave node in a Master/Slave setup, running Ansible 1.8.x on Ubuntu, and receive the following error:

failed: [mdldrdb2] => {"failed": true, "parsed": false} Change master Traceback (most recent call last):
File "/root/.ansible/tmp/ansible-tmp-1418041186.92-240395126581341/mysql_replication", line 1949, in
main()
File "/root/.ansible/tmp/ansible-tmp-1418041186.92-240395126581341/mysql_replication", line 367, in main
changemaster(cursor, chm, chm_params)
File "/root/.ansible/tmp/ansible-tmp-1418041186.92-240395126581341/mysql_replication", line 165, in changemaster
cursor.execute(query, chm_params)
File "/usr/lib64/python2.6/site-packages/MySQLdb/cursors.py", line 173, in execute
self.errorhandler(self, exc, value)
File "/usr/lib64/python2.6/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
raise errorclass, errorvalue
_mysql_exceptions.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''106'' at line 1") OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014

However, setting the following property to a static, numerical value, works. I.e.:

master_log_pos: "{{ master.Position }}"
Changed to
master_log_pos: 106

This seems to be an issue with the formatting of the data? Please advise

@geerlingguy
Copy link
Owner

It looks like this may have been a result of some of the changes added to the role for replication. I'll try to take a look, but this error looks like it might be a little bit difficult to reproduce (unless it's just printing a var directly instead of in quotes—as you said, it could just be that a string is being placed somewhere rather than an integer).

@geerlingguy
Copy link
Owner

This is annoying to reproduce in a test environment, since it requires setting up a master and slave, getting them out of sync intentionally, then trying to set up the slave again (as happened in the above issue).

But a possible fix might be making sure replication is stopped on the slave prior to running the CHANGE MASTER command:

- name: Stop replication on the slave.
  mysql_replication: mode=stopslave
  ignore_errors: True
  when: >
    slave|failed
    and (mysql_replication_role == 'slave')
    and (mysql_replication_master != '')

@zx1986
Copy link

zx1986 commented Jan 31, 2017

"failed": true, 
"msg": "the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: 'dict object' has no attribute 'File'.

The error appears to have been in 'roles/mysql/tasks/replication.yml': line 31, column 3, 
but maybe elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

- name: Configure replication on the slave.
  ^ here

My Ansible got this error.
Where should I set master.File and master.Position?

@zx1986
Copy link

zx1986 commented Jan 31, 2017

I had commented:

master_log_pos = "{{ master.Position}}"
master_log_file = "{{ master.File }}"

The seems not be used.

@pserrano
Copy link

pserrano commented Nov 8, 2018

I've same problem. I don't found how script handle master log_pos and log_file variables.

@stale
Copy link

stale bot commented Mar 6, 2020

This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark issues as stale.

@stale stale bot added the stale label Mar 6, 2020
@stale
Copy link

stale bot commented Apr 5, 2020

This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.

@stale stale bot closed this as completed Apr 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants