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
Lukas Niegsch
slapos
Commits
bcfaa714
Commit
bcfaa714
authored
Dec 10, 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
27ce939c
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
18 additions
and
14 deletions
+18
-14
software/repman/buildout.hash.cfg
software/repman/buildout.hash.cfg
+4
-4
software/repman/instance-mariadb.cfg.jinja2.in
software/repman/instance-mariadb.cfg.jinja2.in
+2
-1
software/repman/software.cfg
software/repman/software.cfg
+2
-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
+6
-5
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 @
bcfaa714
...
...
@@ -22,7 +22,7 @@ md5sum = d9151fe9f86fb1700c6c33d30a750837
[config-toml.in]
_update_hash_filename_ = templates/config.toml.in
md5sum =
cc15b607435106beaaab9200f4cd525a
md5sum =
28ab31bbf073f777221f90902e9d435e
[config-cluster-toml.in]
_update_hash_filename_ = templates/cluster-config.toml.in
...
...
@@ -34,7 +34,7 @@ md5sum = 0eeb24c6aa0760f0d33c4cc2828ddf30
[template-mariadb.cfg]
_update_hash_filename_ = instance-mariadb.cfg.jinja2.in
md5sum =
cfbbf574c1f755855022b1bcd6e6ff64
md5sum =
53734d9527308a255ddb35677d143579
[template-my-cnf]
_update_hash_filename_ = templates/my.cnf.in
...
...
@@ -42,7 +42,7 @@ md5sum = f3661b788099bb31d71ba6e7d36836d9
[template-mariadb-initial-setup]
_update_hash_filename_ = templates/mariadb_initial_setup.sql.in
md5sum =
5a070090fc5b266bf866855c9c54dadf
md5sum =
28fdc24f85b82242751b6c3f40267b39
[template-publish-slave-information]
_update_hash_filename_ = publish-database-slave-parameters.cfg.in
...
...
@@ -62,7 +62,7 @@ md5sum = 852dfab6d798aa1382eec4de2fd624f9
[dbjobs-in]
_update_hash_filename_ = templates/dbjobs.in
md5sum =
44ef0b7c2c03715a3765400b71d240c8
md5sum =
d5c19d866c5a76d3bc2f434a91b1553a
[mysqld-need-start.sh.in]
_update_hash_filename_ = templates/mysqld-need-start.sh.in
...
...
software/repman/instance-mariadb.cfg.jinja2.in
View file @
bcfaa714
...
...
@@ -110,7 +110,7 @@ csr-id =
[my-cnf-parameters]
socket = ${directory:run}/mariadb.sock
ip = {{ ip }}
data-directory = ${directory:
srv}/mariadb
data-directory = ${directory:
mysql}
pid-file = ${directory:run}/mariadb.pid
plugin-directory = {{ dumps(parameter_dict['mroonga-mariadb-plugin-dir']) }}
groonga-plugins-path = {{ parameter_dict['groonga-plugins-path'] }}
...
...
@@ -202,6 +202,7 @@ recipe = slapos.cookbook:wrapper
command-line = ${mysqld:rendered}
wrapper-path = ${directory:controller}/mariadb
wait-for-files =
${directory:etc}/mysql/my.cnf
${directory:ssl}/mariadb-cert.crt
{% import "supervisord_lib" as supervisord_lib with context %}
...
...
software/repman/software.cfg
View file @
bcfaa714
...
...
@@ -51,8 +51,9 @@ template =
basedir='${mariadb:location}'
datadir='{{datadir}}'
marker=$datadir/.slapos_initializing
system=$datadir/.system
[ -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"
"$basedir/scripts/mysql_install_db" \
--defaults-file='{{defaults_file}}' \
...
...
software/repman/templates/config.toml.in
View file @
bcfaa714
...
...
@@ -48,6 +48,7 @@ backup-restic-password = "{{ parameter_dict['password'] }}"
backup-mysqlclient-path = "{{ parameter_dict['mysqlclient-path'] }}"
backup-mysqlbinlog-path = "{{ parameter_dict['mysqlbinlog-path'] }}"
backup-mysqldump-path = "{{ parameter_dict['mysqldump-path'] }}"
backup-mysqldump-options = "--hex-blob --single-transaction --verbose --all-databases --add-drop-database"
# Mail configuration
# Alert email sender (default "mrm@localhost")
...
...
software/repman/templates/dbjobs.in
View file @
bcfaa714
#!/bin/bash
DBUSER
={{
parameter_dict[
'db-user'
]
}}
PASSWORD
={{
parameter_dict[
'db-password'
]
}}
ERROLOG
={{
parameter_dict[
'mysql-dir'
]
}}
/.system/logs/errors.log
...
...
@@ -43,7 +44,7 @@ partialRestore()
done
for
file
in
$(
find
$BACKUPDIR
/
$dir
/
-name
"*.MYD"
| xargs
-n
1
basename
|
cut
-d
'.'
--complement
-f2-
)
;
do
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
for
file
in
$(
find
$BACKUPDIR
/
$dir
/
-name
"*.CSV"
| xargs
-n
1
basename
|
cut
-d
'.'
--complement
-f2-
)
;
do
mv
$BACKUPDIR
/
$dir
/
$file
.
*
$DATADIR
/
$dir
/
...
...
@@ -78,13 +79,13 @@ do
reseedmysqldump
)
echo
"Waiting backup."
>
{{
parameter_dict[
'log-dir'
]
}}
/dbjob.out
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
=
"reset master;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
--init-command
=
"reset master;set sql_log_bin=0"
&>
{{
parameter_dict[
'log-dir'
]
}}
/dbjob.out
$MYSQL_CLIENT
-e
'start slave;'
;;
flashbackmysqldump
)
echo
"Waiting backup."
>
{{
parameter_dict[
'log-dir'
]
}}
/dbjob.out
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
$MYSQL_CLIENT
-e
'start slave;'
;;
reseedmariabackup
)
...
...
@@ -117,10 +118,10 @@ do
cat
$SLOWLOG
| socat
-u
stdio TCP:
$ADDRESS
&>
{{
parameter_dict[
'log-dir'
]
}}
/dbjob.out
;;
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
)
{{
parameter_dict[
'restart-script'
]
}}
>
{{
parameter_dict[
'log-dir'
]
}}
/dbjob.out
{{
parameter_dict[
'restart-script'
]
}}
&>
{{
parameter_dict[
'log-dir'
]
}}
/dbjob.out
;;
esac
doneJob
...
...
software/repman/templates/mariadb_initial_setup.sql.in
View file @
bcfaa714
...
...
@@ -10,7 +10,7 @@ DROP FUNCTION IF EXISTS sphinx_snippets;
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_dict = {'utf8_general_ci': 'utf8',
'utf8_unicode_ci': 'utf8',
...
...
@@ -29,12 +29,12 @@ CREATE DATABASE IF NOT EXISTS `repman_slave_definition`;
{% endif -%}
CREATE DATABASE IF NOT EXISTS `{{ name }}` {{ charset_collate }};
{% 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 }}`@'::' IDENTIFIED BY '{{ password }}';
{%- endif %}
{% endmacro -%}
{% 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 -%}
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