Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Ansible Framework Container
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ansible
Playbooks
Ansible Framework Container
Commits
d0d46cf5
Commit
d0d46cf5
authored
4 years ago
by
jurgenhaas
Browse files
Options
Downloads
Patches
Plain Diff
Replace master/slave with primary/secondary
parent
6b921bad
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
playbooks/mysqlsecondary.yml
+9
-19
9 additions, 19 deletions
playbooks/mysqlsecondary.yml
scripts/mysql-slave-skipone.yml
+1
-1
1 addition, 1 deletion
scripts/mysql-slave-skipone.yml
with
10 additions
and
20 deletions
playbooks/mysqls
lave
.yml
→
playbooks/mysqls
econdary
.yml
+
9
−
19
View file @
d0d46cf5
##
# Ansible playbook to work on a MySQL Slave DB
#
# https://www.howtoforge.com/how-to-repair-mysql-replication
# SHOW SLAVE STATUS \G;
# STOP SLAVE;
# SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
# START SLAVE;
# SHOW SLAVE STATUS \G;
#
# On the slave, we maybe should:
# SET GLOBAL slow_query_log = "OFF";
# Ansible playbook to work on a MySQL Secondary DB
---
# file: mysqls
lave
.yml
# file: mysqls
econdary
.yml
-
name
:
Import playbook validate
import_playbook
:
validate.yml
-
name
:
Skip 1 Replication Item
hosts
:
"
dbserver_mysql
-slave
"
hosts
:
"
dbserver_mysql
_secondary
"
become
:
no
tags
:
-
skipbyone
tasks
:
-
name
:
Stop s
lave
-
name
:
Stop s
econdary
mysql_replication
:
mode
:
stopslave
-
name
:
Set Skip Counter
mysql_variables
:
variable
:
sql_slave_skip_counter
value
:
1
-
name
:
Start s
lave
-
name
:
Start s
econdary
mysql_replication
:
mode
:
startslave
-
name
:
MySQL Replication
hosts
:
"
dbserver_mysql
-slave
"
hosts
:
"
dbserver_mysql
_secondary
"
become
:
no
tags
:
-
changemaster
...
...
@@ -48,13 +38,13 @@
mode
:
changemaster
login_host
:
127.0.0.1
login_user
:
root
login_password
:
root
login_password
:
'
{{
mysql_root_password|default("root")
}}'
master_host
:
127.0.0.1
master_port
:
'
{{
port
}}'
master_user
:
repl
master_password
:
repl
master_log_file
:
'
{{
binlog
}}'
master_log_pos
:
'
{{
binpos
}}'
master_log_file
:
'
{{
binlog
|default("/var/log/mysql/mysql-bin.log")
}}'
master_log_pos
:
'
{{
binpos
|default(0)
}}'
-
name
:
Start Replication
mysql_replication
:
mode
:
startslave
This diff is collapsed.
Click to expand it.
scripts/mysql-slave-skipone.yml
+
1
−
1
View file @
d0d46cf5
...
...
@@ -3,7 +3,7 @@
description
:
MySQL Slave - Skip counter by
1
cli
:
defaults
:
limit
:
dbserver_mysql
-slave
limit
:
dbserver_mysql
_secondary
arguments
:
playbook
:
mysqlslave
command
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment