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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
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
...
@@ -22,7 +22,7 @@ md5sum = d9151fe9f86fb1700c6c33d30a750837
[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 =
cfbbf574c1f755855022b1bcd6e6ff64
md5sum =
53734d9527308a255ddb35677d143579
[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 =
44ef0b7c2c03715a3765400b71d240c8
md5sum =
d5c19d866c5a76d3bc2f434a91b1553a
[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 @
bcfaa714
...
@@ -110,7 +110,7 @@ csr-id =
...
@@ -110,7 +110,7 @@ csr-id =
[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/software.cfg
View file @
bcfaa714
...
@@ -51,8 +51,9 @@ template =
...
@@ -51,8 +51,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 @
bcfaa714
...
@@ -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 @
bcfaa714
#!/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
/
...
@@ -78,13 +79,13 @@ do
...
@@ -78,13 +79,13 @@ do
reseedmysqldump
)
reseedmysqldump
)
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
=
"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;'
$MYSQL_CLIENT
-e
'start slave;'
;;
;;
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
$MYSQL_CLIENT
-e
'start slave;'
$MYSQL_CLIENT
-e
'start slave;'
;;
;;
reseedmariabackup
)
reseedmariabackup
)
...
@@ -117,10 +118,10 @@ do
...
@@ -117,10 +118,10 @@ 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
;;
;;
esac
esac
doneJob
doneJob
...
...
software/repman/templates/mariadb_initial_setup.sql.in
View file @
bcfaa714
...
@@ -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