Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ivan Tyagov
slapos
Commits
97e87e7e
Commit
97e87e7e
authored
Aug 04, 2021
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
repman: fix mariadb data location and fix reseed backup in dbjobs
parent
814eb565
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
20 additions
and
15 deletions
+20
-15
software/repman/buildout.hash.cfg
software/repman/buildout.hash.cfg
+5
-5
software/repman/instance-mariadb.cfg.jinja2.in
software/repman/instance-mariadb.cfg.jinja2.in
+2
-1
software/repman/instance.cfg.in
software/repman/instance.cfg.in
+2
-2
software/repman/software.cfg
software/repman/software.cfg
+3
-1
software/repman/templates/config.toml.in
software/repman/templates/config.toml.in
+1
-0
software/repman/templates/dbjobs.in
software/repman/templates/dbjobs.in
+4
-3
software/repman/templates/mariadb_initial_setup.sql.in
software/repman/templates/mariadb_initial_setup.sql.in
+3
-3
No files found.
software/repman/buildout.hash.cfg
View file @
97e87e7e
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
# not need these here).
# not need these here).
[instance.cfg]
[instance.cfg]
filename = instance.cfg.in
filename = instance.cfg.in
md5sum =
4bcd62ac0b5c9d2c584533f5ba08d922
md5sum =
af2fc4a7a0f782fed2cb1112ef3cb397
[instance-repman.cfg]
[instance-repman.cfg]
_update_hash_filename_ = instance-repman.cfg.jinja2.in
_update_hash_filename_ = instance-repman.cfg.jinja2.in
...
@@ -22,7 +22,7 @@ md5sum = b905ac6dad9b6dddef426b69fea7286b
...
@@ -22,7 +22,7 @@ md5sum = b905ac6dad9b6dddef426b69fea7286b
[config-toml.in]
[config-toml.in]
_update_hash_filename_ = templates/config.toml.in
_update_hash_filename_ = templates/config.toml.in
md5sum =
cc15b607435106beaaab9200f4cd525a
md5sum =
28ab31bbf073f777221f90902e9d435e
[config-cluster-toml.in]
[config-cluster-toml.in]
_update_hash_filename_ = templates/cluster-config.toml.in
_update_hash_filename_ = templates/cluster-config.toml.in
...
@@ -34,7 +34,7 @@ md5sum = 0eeb24c6aa0760f0d33c4cc2828ddf30
...
@@ -34,7 +34,7 @@ md5sum = 0eeb24c6aa0760f0d33c4cc2828ddf30
[template-mariadb.cfg]
[template-mariadb.cfg]
_update_hash_filename_ = instance-mariadb.cfg.jinja2.in
_update_hash_filename_ = instance-mariadb.cfg.jinja2.in
md5sum =
73326b36dca4717f2b0d1dbb7e76b596
md5sum =
c2777aef6c51300f632fa6cac3ba6783
[template-my-cnf]
[template-my-cnf]
_update_hash_filename_ = templates/my.cnf.in
_update_hash_filename_ = templates/my.cnf.in
...
@@ -42,7 +42,7 @@ md5sum = f3661b788099bb31d71ba6e7d36836d9
...
@@ -42,7 +42,7 @@ md5sum = f3661b788099bb31d71ba6e7d36836d9
[template-mariadb-initial-setup]
[template-mariadb-initial-setup]
_update_hash_filename_ = templates/mariadb_initial_setup.sql.in
_update_hash_filename_ = templates/mariadb_initial_setup.sql.in
md5sum =
5a070090fc5b266bf866855c9c54dadf
md5sum =
28fdc24f85b82242751b6c3f40267b39
[template-publish-slave-information]
[template-publish-slave-information]
_update_hash_filename_ = publish-database-slave-parameters.cfg.in
_update_hash_filename_ = publish-database-slave-parameters.cfg.in
...
@@ -62,7 +62,7 @@ md5sum = 852dfab6d798aa1382eec4de2fd624f9
...
@@ -62,7 +62,7 @@ md5sum = 852dfab6d798aa1382eec4de2fd624f9
[dbjobs-in]
[dbjobs-in]
_update_hash_filename_ = templates/dbjobs.in
_update_hash_filename_ = templates/dbjobs.in
md5sum = d
a15968c75e7c856662099edaea5ef46
md5sum = d
f15bd12bbe34d206ddf76d01e683241
[mysqld-need-start.sh.in]
[mysqld-need-start.sh.in]
_update_hash_filename_ = templates/mysqld-need-start.sh.in
_update_hash_filename_ = templates/mysqld-need-start.sh.in
...
...
software/repman/instance-mariadb.cfg.jinja2.in
View file @
97e87e7e
...
@@ -107,7 +107,7 @@ commands =
...
@@ -107,7 +107,7 @@ commands =
[my-cnf-parameters]
[my-cnf-parameters]
socket = ${directory:run}/mariadb.sock
socket = ${directory:run}/mariadb.sock
ip = {{ ip }}
ip = {{ ip }}
data-directory = ${directory:
srv}/mariadb
data-directory = ${directory:
mysql}
pid-file = ${directory:run}/mariadb.pid
pid-file = ${directory:run}/mariadb.pid
plugin-directory = {{ dumps(parameter_dict['mroonga-mariadb-plugin-dir']) }}
plugin-directory = {{ dumps(parameter_dict['mroonga-mariadb-plugin-dir']) }}
groonga-plugins-path = {{ parameter_dict['groonga-plugins-path'] }}
groonga-plugins-path = {{ parameter_dict['groonga-plugins-path'] }}
...
@@ -202,6 +202,7 @@ recipe = slapos.cookbook:wrapper
...
@@ -202,6 +202,7 @@ recipe = slapos.cookbook:wrapper
command-line = ${mysqld:rendered}
command-line = ${mysqld:rendered}
wrapper-path = ${directory:controller}/mariadb
wrapper-path = ${directory:controller}/mariadb
wait-for-files =
wait-for-files =
${directory:etc}/mysql/my.cnf
${directory:ssl}/mariadb-cert.crt
${directory:ssl}/mariadb-cert.crt
{% import "supervisord_lib" as supervisord_lib with context %}
{% import "supervisord_lib" as supervisord_lib with context %}
...
...
software/repman/instance.cfg.in
View file @
97e87e7e
software/repman/software.cfg
View file @
97e87e7e
...
@@ -42,6 +42,7 @@ part = python2.7
...
@@ -42,6 +42,7 @@ part = python2.7
eggs +=
eggs +=
collective.recipe.shelloutput
collective.recipe.shelloutput
[template-mysqld-wrapper]
[template-mysqld-wrapper]
recipe = slapos.recipe.template:jinja2
recipe = slapos.recipe.template:jinja2
rendered = ${buildout:parts-directory}/${:_buildout_section_name_}/mysqld.in
rendered = ${buildout:parts-directory}/${:_buildout_section_name_}/mysqld.in
...
@@ -51,8 +52,9 @@ template =
...
@@ -51,8 +52,9 @@ template =
basedir='${mariadb:location}'
basedir='${mariadb:location}'
datadir='{{datadir}}'
datadir='{{datadir}}'
marker=$datadir/.slapos_initializing
marker=$datadir/.slapos_initializing
system=$datadir/.system
[ -d "$datadir/mysql" ] && [ ! -f "$marker" ] || {
[ -d "$datadir/mysql" ] && [ ! -f "$marker" ] || {
find "$datadir/" -mindepth 1 !
-path $marker
-delete || mkdir "$datadir"
find "$datadir/" -mindepth 1 !
\( -path $marker -o -path $system -o -path "*$system/*" \)
-delete || mkdir "$datadir"
touch "$marker"
touch "$marker"
"$basedir/scripts/mysql_install_db" \
"$basedir/scripts/mysql_install_db" \
--defaults-file='{{defaults_file}}' \
--defaults-file='{{defaults_file}}' \
...
...
software/repman/templates/config.toml.in
View file @
97e87e7e
...
@@ -48,6 +48,7 @@ backup-restic-password = "{{ parameter_dict['password'] }}"
...
@@ -48,6 +48,7 @@ backup-restic-password = "{{ parameter_dict['password'] }}"
backup-mysqlclient-path = "{{ parameter_dict['mysqlclient-path'] }}"
backup-mysqlclient-path = "{{ parameter_dict['mysqlclient-path'] }}"
backup-mysqlbinlog-path = "{{ parameter_dict['mysqlbinlog-path'] }}"
backup-mysqlbinlog-path = "{{ parameter_dict['mysqlbinlog-path'] }}"
backup-mysqldump-path = "{{ parameter_dict['mysqldump-path'] }}"
backup-mysqldump-path = "{{ parameter_dict['mysqldump-path'] }}"
backup-mysqldump-options = "--hex-blob --single-transaction --verbose --all-databases --add-drop-database"
# Mail configuration
# Mail configuration
# Alert email sender (default "mrm@localhost")
# Alert email sender (default "mrm@localhost")
...
...
software/repman/templates/dbjobs.in
View file @
97e87e7e
#!/bin/bash
#!/bin/bash
DBUSER
={{
parameter_dict[
'db-user'
]
}}
DBUSER
={{
parameter_dict[
'db-user'
]
}}
PASSWORD
={{
parameter_dict[
'db-password'
]
}}
PASSWORD
={{
parameter_dict[
'db-password'
]
}}
ERROLOG
={{
parameter_dict[
'mysql-dir'
]
}}
/.system/logs/errors.log
ERROLOG
={{
parameter_dict[
'mysql-dir'
]
}}
/.system/logs/errors.log
...
@@ -43,7 +44,7 @@ partialRestore()
...
@@ -43,7 +44,7 @@ partialRestore()
done
done
for
file
in
$(
find
$BACKUPDIR
/
$dir
/
-name
"*.MYD"
| xargs
-n
1
basename
|
cut
-d
'.'
--complement
-f2-
)
;
do
for
file
in
$(
find
$BACKUPDIR
/
$dir
/
-name
"*.MYD"
| xargs
-n
1
basename
|
cut
-d
'.'
--complement
-f2-
)
;
do
mv
$BACKUPDIR
/
$dir
/
$file
.
*
$DATADIR
/
$dir
/
mv
$BACKUPDIR
/
$dir
/
$file
.
*
$DATADIR
/
$dir
/
mysql
--defaults-file
=
/etc/mysql/dbjob.cnf
-e
"set sql_log_bin=0;FLUSH TABLE
$dir
.
$file
"
$MYSQL_CLIENT
-e
"set sql_log_bin=0;FLUSH TABLE
$dir
.
$file
"
done
done
for
file
in
$(
find
$BACKUPDIR
/
$dir
/
-name
"*.CSV"
| xargs
-n
1
basename
|
cut
-d
'.'
--complement
-f2-
)
;
do
for
file
in
$(
find
$BACKUPDIR
/
$dir
/
-name
"*.CSV"
| xargs
-n
1
basename
|
cut
-d
'.'
--complement
-f2-
)
;
do
mv
$BACKUPDIR
/
$dir
/
$file
.
*
$DATADIR
/
$dir
/
mv
$BACKUPDIR
/
$dir
/
$file
.
*
$DATADIR
/
$dir
/
...
@@ -84,7 +85,7 @@ do
...
@@ -84,7 +85,7 @@ do
flashbackmysqldump
)
flashbackmysqldump
)
echo
"Waiting backup."
>
{{
parameter_dict[
'log-dir'
]
}}
/dbjob.out
echo
"Waiting backup."
>
{{
parameter_dict[
'log-dir'
]
}}
/dbjob.out
pauseJob
pauseJob
socat
-u
{{
listen
}}
:
{{
parameter_dict[
'socat-port'
]
}}
,bind
={{
parameter_dict[
'host'
]
}}
,reuseaddr STDOUT |
gunzip
| mysql
-h
{{
parameter_dict[
'ip'
]
}}
-P
{{
parameter_dict[
'port'
]
}}
-p
$PASSWORD
-u
$DBUSER
--init-command
=
"set sql_log_bin=0"
>
{{
parameter_dict[
'log-dir'
]
}}
/dbjob.out 2>&1
socat
-u
{{
listen
}}
:
{{
parameter_dict[
'socat-port'
]
}}
,bind
={{
parameter_dict[
'host'
]
}}
,reuseaddr STDOUT |
gunzip
| mysql
-h
{{
parameter_dict[
'ip'
]
}}
-P
{{
parameter_dict[
'port'
]
}}
-p
$PASSWORD
-u
$DBUSER
>
{{
parameter_dict[
'log-dir'
]
}}
/dbjob.out 2>&1
$MYSQL_CLIENT
-e
'start slave;'
$MYSQL_CLIENT
-e
'start slave;'
;;
;;
reseedmariabackup
)
reseedmariabackup
)
...
@@ -117,7 +118,7 @@ do
...
@@ -117,7 +118,7 @@ do
cat
$SLOWLOG
| socat
-u
stdio TCP:
$ADDRESS
&>
{{
parameter_dict[
'log-dir'
]
}}
/dbjob.out
cat
$SLOWLOG
| socat
-u
stdio TCP:
$ADDRESS
&>
{{
parameter_dict[
'log-dir'
]
}}
/dbjob.out
;;
;;
optimize
)
optimize
)
mysqlcheck
--defaults-file
={{
parameter_dict[
'dbjob-cnf'
]
}}
-o
--all-databases
--skip-write-binlog
&>
{{
parameter_dict[
'log-dir'
]
}}
/dbjob.out
$MYSQL_CLIENT
-o
--all-databases
--skip-write-binlog
&>
{{
parameter_dict[
'log-dir'
]
}}
/dbjob.out
;;
;;
restart
)
restart
)
{{
parameter_dict[
'restart-script'
]
}}
>
{{
parameter_dict[
'log-dir'
]
}}
/dbjob.out
{{
parameter_dict[
'restart-script'
]
}}
>
{{
parameter_dict[
'log-dir'
]
}}
/dbjob.out
...
...
software/repman/templates/mariadb_initial_setup.sql.in
View file @
97e87e7e
...
@@ -10,7 +10,7 @@ DROP FUNCTION IF EXISTS sphinx_snippets;
...
@@ -10,7 +10,7 @@ DROP FUNCTION IF EXISTS sphinx_snippets;
CREATE DATABASE IF NOT EXISTS `repman_slave_definition`;
CREATE DATABASE IF NOT EXISTS `repman_slave_definition`;
{% macro database(name, user, password, charset="") -%}
{% macro database(name, user, password,
ssl,
charset="") -%}
{% set charset_collate = "" -%}
{% set charset_collate = "" -%}
{% set charset_dict = {'utf8_general_ci': 'utf8',
{% set charset_dict = {'utf8_general_ci': 'utf8',
'utf8_unicode_ci': 'utf8',
'utf8_unicode_ci': 'utf8',
...
@@ -29,12 +29,12 @@ CREATE DATABASE IF NOT EXISTS `repman_slave_definition`;
...
@@ -29,12 +29,12 @@ CREATE DATABASE IF NOT EXISTS `repman_slave_definition`;
{% endif -%}
{% endif -%}
CREATE DATABASE IF NOT EXISTS `{{ name }}` {{ charset_collate }};
CREATE DATABASE IF NOT EXISTS `{{ name }}` {{ charset_collate }};
{% if user -%}
{% if user -%}
GRANT ALL PRIVILEGES ON `{{ name }}`.* TO `{{ user }}`@`%` IDENTIFIED BY '{{ password }}';
GRANT ALL PRIVILEGES ON `{{ name }}`.* TO `{{ user }}`@`%` IDENTIFIED BY '{{ password }}'
{% if ssl %} REQUIRE SSL{% endif %}
;
GRANT ALL PRIVILEGES ON `{{ name }}`.* TO `{{ user }}`@localhost IDENTIFIED BY '{{ password }}';
GRANT ALL PRIVILEGES ON `{{ name }}`.* TO `{{ user }}`@localhost IDENTIFIED BY '{{ password }}';
GRANT ALL PRIVILEGES ON `{{ name }}`.* TO `{{ user }}`@'::' IDENTIFIED BY '{{ password }}';
GRANT ALL PRIVILEGES ON `{{ name }}`.* TO `{{ user }}`@'::' IDENTIFIED BY '{{ password }}';
{%- endif %}
{%- endif %}
{% endmacro -%}
{% endmacro -%}
{% for entry in parameter_dict['database-list'] -%}
{% for entry in parameter_dict['database-list'] -%}
{{ database(entry['name'], entry.get('user'), entry.get('password'), entry.get('charset')) }}
{{ database(entry['name'], entry.get('user'), entry.get('password'), entry.get('
require_ssl', True), entry.get('
charset')) }}
{% endfor -%}
{% endfor -%}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment