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
Leo Le Bouter
slapos
Commits
d0c397f9
Commit
d0c397f9
authored
Apr 17, 2020
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
repman: include restic for backup, add more parameter for instance and json parameter schema
parent
59ae57d8
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
554 additions
and
48 deletions
+554
-48
software/repman/buildout.hash.cfg
software/repman/buildout.hash.cfg
+8
-8
software/repman/instance-mariadb.cfg.jinja2.in
software/repman/instance-mariadb.cfg.jinja2.in
+6
-3
software/repman/instance-repman-input-schema.json
software/repman/instance-repman-input-schema.json
+334
-0
software/repman/instance-repman-output-schema.json
software/repman/instance-repman-output-schema.json
+25
-0
software/repman/instance-repman.cfg.jinja2.in
software/repman/instance-repman.cfg.jinja2.in
+85
-18
software/repman/instance.cfg.in
software/repman/instance.cfg.in
+1
-0
software/repman/software.cfg
software/repman/software.cfg
+4
-0
software/repman/software.cfg.json
software/repman/software.cfg.json
+14
-0
software/repman/templates/cluster-config.toml.in
software/repman/templates/cluster-config.toml.in
+36
-6
software/repman/templates/config.toml.in
software/repman/templates/config.toml.in
+17
-8
software/repman/templates/mariadb_init_root.sql.in
software/repman/templates/mariadb_init_root.sql.in
+2
-0
software/repman/templates/mariadb_initial_setup.sql.in
software/repman/templates/mariadb_initial_setup.sql.in
+1
-0
software/repman/templates/repman-manager.sh.in
software/repman/templates/repman-manager.sh.in
+21
-5
No files found.
software/repman/buildout.hash.cfg
View file @
d0c397f9
...
@@ -14,19 +14,19 @@
...
@@ -14,19 +14,19 @@
# not need these here).
# not need these here).
[instance.cfg]
[instance.cfg]
filename = instance.cfg.in
filename = instance.cfg.in
md5sum =
158e4c884b04442aff9726704b3f4d60
md5sum =
b38fb4c5cdba2223c84d62ef60513e49
[instance-repman.cfg]
[instance-repman.cfg]
_update_hash_filename_ = instance-repman.cfg.jinja2.in
_update_hash_filename_ = instance-repman.cfg.jinja2.in
md5sum =
0a17bad0a5e7f472641c8a2984ae9400
md5sum =
e50536613b175a2e25a041c61adeb59f
[config-toml.in]
[config-toml.in]
_update_hash_filename_ = templates/config.toml.in
_update_hash_filename_ = templates/config.toml.in
md5sum =
5114d1bb43025cdc5357572634871da7
md5sum =
1efa65af63b14ca2dd1b8c692b2af80e
[config-cluster-toml.in]
[config-cluster-toml.in]
_update_hash_filename_ = templates/cluster-config.toml.in
_update_hash_filename_ = templates/cluster-config.toml.in
md5sum =
d883337a75140c08853960cd6a8fdc5f
md5sum =
39fb83a9b542b9809948cab98aefa2e7
[nginx.conf.in]
[nginx.conf.in]
_update_hash_filename_ = templates/nginx.conf.in
_update_hash_filename_ = templates/nginx.conf.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 =
57ffd0fc1a7bca46b07cdc3121bbf36f
md5sum =
d32a50db737a9131de7f3eb27f704232
[template-my-cnf]
[template-my-cnf]
_update_hash_filename_ = templates/my.cnf.in
_update_hash_filename_ = templates/my.cnf.in
...
@@ -42,11 +42,11 @@ md5sum = 04a12d3271857fcf29cb010fd7e38a5c
...
@@ -42,11 +42,11 @@ md5sum = 04a12d3271857fcf29cb010fd7e38a5c
[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 =
6c88f4a98668d7c5c0aec14ae662686e
md5sum =
c31618ef115ecd72b30ae59d0440a3ec
[mariadb-init-root-sql]
[mariadb-init-root-sql]
_update_hash_filename_ = templates/mariadb_init_root.sql.in
_update_hash_filename_ = templates/mariadb_init_root.sql.in
md5sum =
bd39fb1e20212c820e5c6b74102b72e8
md5sum =
864d419ea506c9ac543409ba7abb22b0
[init-root-wrapper-in]
[init-root-wrapper-in]
_update_hash_filename_ = templates/init_root_wrapper.in
_update_hash_filename_ = templates/init_root_wrapper.in
...
@@ -54,7 +54,7 @@ md5sum = 3ba02b99c3fcbc24b3659917980b310f
...
@@ -54,7 +54,7 @@ md5sum = 3ba02b99c3fcbc24b3659917980b310f
[repman-manager-sh.in]
[repman-manager-sh.in]
_update_hash_filename_ = templates/repman-manager.sh.in
_update_hash_filename_ = templates/repman-manager.sh.in
md5sum =
8ad6565e7b26e57b41bda4023a9d29ed
md5sum =
99324b56192003254081ef336dcee94c
[dbjobs-in]
[dbjobs-in]
_update_hash_filename_ = templates/dbjobs.in
_update_hash_filename_ = templates/dbjobs.in
...
...
software/repman/instance-mariadb.cfg.jinja2.in
View file @
d0c397f9
{% set part_list = [] -%}
{% set part_list = [] -%}
{% macro section(name) %}{% do part_list.append(name) %}{{ name }}{% endmacro -%}
{% macro section(name) %}{% do part_list.append(name) %}{{ name }}{% endmacro -%}
{% set use_ipv6 = slapparameter_dict.get('use-ipv6',
Fals
e) -%}
{% set use_ipv6 = slapparameter_dict.get('use-ipv6',
Tru
e) -%}
{% set port = slapparameter_dict['tcp-port'] %}
{% set port = slapparameter_dict['tcp-port'] %}
{% set host = (ipv4_set | list)[0] -%}
{% set host = (ipv4_set | list)[0] -%}
{% if use_ipv6 -%}
{% if use_ipv6 -%}
{% set ip = (ipv6_set | list)[0] -%}
{% set ip = (ipv6_set | list)[0] -%}
{% set host = '[' ~
(ipv4_set | list)[0]
~ ']' -%}
{% set host = '[' ~
ip
~ ']' -%}
{% else -%}
{% else -%}
{% set ip = (ipv4_set | list)[0] -%}
{% set ip = (ipv4_set | list)[0] -%}
{% endif -%}
{% endif -%}
{% set dash = parameter_dict['dash-location'] ~ '/bin/dash' %}
{% set dash = parameter_dict['dash-location'] ~ '/bin/dash' %}
{% set database_list = slapparameter_dict.get('database-list', [{'name': 'repdb', 'user': 'user', 'password': 'insecure'}]) -%}
{% set database_list = slapparameter_dict.get('database-list', [{'name': 'repdb', 'user': 'user', 'password': 'insecure'}]) -%}
# XXX- TODO: add cron with check db need restart then restart
# API check restard needed: http://repman/api/clusters/{clusterName}/servers/{serverName}/{serverPort}/need-restart
[{{ section('publish') }}]
[{{ section('publish') }}]
recipe = slapos.cookbook:publish.serialised
recipe = slapos.cookbook:publish.serialised
-extends = publish-early
-extends = publish-early
...
@@ -274,7 +277,7 @@ cluster = cluster1
...
@@ -274,7 +277,7 @@ cluster = cluster1
config = ${directory:etc}/mysql/my.cnf
config = ${directory:etc}/mysql/my.cnf
command =
command =
cd ${directory:config-tmp} &&
cd ${directory:config-tmp} &&
{{ curl_bin }} -o config.tar.gz {{ slapparameter_dict['repman-url'] }}/api/clusters/${:cluster}/servers/{{
ip
}}/{{ port }}/config &&
{{ curl_bin }} -o config.tar.gz {{ slapparameter_dict['repman-url'] }}/api/clusters/${:cluster}/servers/{{
host
}}/{{ port }}/config &&
tar -xzf config.tar.gz &&
tar -xzf config.tar.gz &&
cp -r data/.system ${directory:mysql} &&
cp -r data/.system ${directory:mysql} &&
rm -rf ${directory:etc}/mysql &&
rm -rf ${directory:etc}/mysql &&
...
...
software/repman/instance-repman-input-schema.json
0 → 100644
View file @
d0c397f9
This diff is collapsed.
Click to expand it.
software/repman/instance-repman-output-schema.json
0 → 100644
View file @
d0c397f9
{
"name"
:
"Output Parameters"
,
"properties"
:
{
"backend-url"
:
{
"title"
:
"Backend URL"
,
"description"
:
"URL used to connect directly to backend without frontend. Requires IPv6."
,
"type"
:
"string"
,
"format"
:
"uri"
,
"require"
:
true
},
"url"
:
{
"title"
:
"URL"
,
"description"
:
"URL used to connect to the service."
,
"type"
:
"string"
,
"format"
:
"uri"
,
"require"
:
false
},
"repman-password"
:
{
"title"
:
"Repman password"
,
"description"
:
"Password for Replication Manager service."
,
"type"
:
"string"
,
"require"
:
false
}
}
}
software/repman/instance-repman.cfg.jinja2.in
View file @
d0c397f9
This diff is collapsed.
Click to expand it.
software/repman/instance.cfg.in
View file @
d0c397f9
...
@@ -60,6 +60,7 @@ extra-context =
...
@@ -60,6 +60,7 @@ extra-context =
raw config_cluster_toml_in {{ config_cluster_toml_in }}
raw config_cluster_toml_in {{ config_cluster_toml_in }}
raw nginx_conf_in {{ nginx_conf_in }}
raw nginx_conf_in {{ nginx_conf_in }}
raw rsync_location {{ rsync_location }}
raw rsync_location {{ rsync_location }}
raw restic_bin_location {{ restic_bin_location }}
raw sysbench_location {{ sysbench_location }}
raw sysbench_location {{ sysbench_location }}
raw proxysql_location {{ proxysql_location }}
raw proxysql_location {{ proxysql_location }}
raw template_repman_manager_sh {{ template_repman_manager_sh }}
raw template_repman_manager_sh {{ template_repman_manager_sh }}
...
...
software/repman/software.cfg
View file @
d0c397f9
...
@@ -4,6 +4,7 @@ extends =
...
@@ -4,6 +4,7 @@ extends =
buildout.hash.cfg
buildout.hash.cfg
../neoppod/software-common.cfg
../neoppod/software-common.cfg
../../stack/monitor/buildout.cfg
../../stack/monitor/buildout.cfg
../../component/restic/buildout.cfg
../../component/replication-manager/buildout.cfg
../../component/replication-manager/buildout.cfg
../../component/mariadb/buildout.cfg
../../component/mariadb/buildout.cfg
../../component/nginx/buildout.cfg
../../component/nginx/buildout.cfg
...
@@ -27,6 +28,8 @@ parts =
...
@@ -27,6 +28,8 @@ parts =
instance.cfg
instance.cfg
template-mariadb.cfg
template-mariadb.cfg
template-mysqld-wrapper
template-mysqld-wrapper
gowork
restic
[mariadb]
[mariadb]
# Compile dir is for plugins, there's no plugin yet
# Compile dir is for plugins, there's no plugin yet
...
@@ -62,6 +65,7 @@ context =
...
@@ -62,6 +65,7 @@ context =
key percona_toolkit_location percona-toolkit:location
key percona_toolkit_location percona-toolkit:location
key repman_src_location git.signal18.io_signal18_repman:location
key repman_src_location git.signal18.io_signal18_repman:location
key rsync_location rsync:location
key rsync_location rsync:location
key restic_bin_location restic:location
key socat_location socat:location
key socat_location socat:location
key template_repman_manager_sh repman-manager-sh.in:target
key template_repman_manager_sh repman-manager-sh.in:target
key template_mariadb template-mariadb.cfg:target
key template_mariadb template-mariadb.cfg:target
...
...
software/repman/software.cfg.json
0 → 100644
View file @
d0c397f9
{
"name"
:
"Replication Manager"
,
"description"
:
"Replication Manager"
,
"serialisation"
:
"xml"
,
"software-type"
:
{
"default"
:
{
"title"
:
"Default"
,
"description"
:
"Replication Manager"
,
"request"
:
"instance-repman-input-schema.json"
,
"response"
:
"instance-repman-output-schema.json"
,
"index"
:
0
}
}
}
software/repman/templates/cluster-config.toml.in
View file @
d0c397f9
{% macro setbool(value) -%}
{% if value in ['true', 'True'] %} true {% else %} false {% endif -%}
{% endmacro -%}
[{{ parameter_dict['name'] }}]
[{{ parameter_dict['name'] }}]
title = "{{ parameter_dict['name'] }}"
title = "{{ parameter_dict['name'] }}"
monitoring-save-config = true
db-servers-hosts = "{{ parameter_dict['db-list'] }}"
db-servers-hosts = "{{ parameter_dict['db-list'] }}"
db-servers-prefered-master = "{{ parameter_dict['db-prefered-master'] }}"
db-servers-prefered-master = "{{ parameter_dict['db-prefered-master'] }}"
db-servers-credential = "{{ parameter_dict['db-credential'] }}"
db-servers-credential = "{{ parameter_dict['db-credential'] }}"
...
@@ -16,22 +20,48 @@ proxysql-bootstrap = true
...
@@ -16,22 +20,48 @@ proxysql-bootstrap = true
proxysql-admin-port = {{ parameter_dict['proxy-admin-port'] }}
proxysql-admin-port = {{ parameter_dict['proxy-admin-port'] }}
proxysql-password = "{{ parameter_dict['password'] }}"
proxysql-password = "{{ parameter_dict['password'] }}"
prov-proxy-tags = "
pkg,masterslave,linux,noreadwritesplit
"
prov-proxy-tags = "
{{ parameter_dict['proxy-tags'] }}
"
monitoring-scheduler = true
monitoring-scheduler = true
scheduler-db-servers-logical-backup = true
scheduler-db-servers-logical-backup = true
scheduler-db-servers-logical-backup-cron
= "0 0 1 * * 6
"
scheduler-db-servers-logical-backup-cron
= "0 {{ parameter_dict['logical-backup-cron'] }}
"
scheduler-db-servers-logs = true
scheduler-db-servers-logs = true
scheduler-db-servers-logs-cron = "0 0 * * * *"
scheduler-db-servers-logs-cron = "0 0 * * * *"
#scheduler-db-servers-logs-table-keep = 12
scheduler-db-servers-logs-table-keep = 4
scheduler-db-servers-logs-table-keep = 4
scheduler-db-servers-logs-table-rotate = true
scheduler-db-servers-logs-table-rotate = true
#scheduler-db-servers-logs-table-rotate-cron = "0 0 0/6 * * *"
scheduler-db-servers-logs-table-rotate-cron = "0 0 23 * * *"
scheduler-db-servers-logs-table-rotate-cron = "0 0 23 * * *"
scheduler-db-servers-optimize = true
scheduler-db-servers-optimize = true
scheduler-db-servers-optimize-cron = "0 0 3 1 * 5"
scheduler-db-servers-optimize-cron = "0 0 3 1 * 5"
scheduler-db-servers-physical-backup = true
scheduler-db-servers-physical-backup = true
scheduler-db-servers-physical-backup-cron = "0
0 0 * * *
"
scheduler-db-servers-physical-backup-cron = "0
{{ parameter_dict['physical-backup-cron'] }}
"
backup-physical-type = "mariabackup"
backup-physical-type = "mariabackup"
backup-logical-type = "mysqldump"
backup-logical-type = "mysqldump"
# scheduler-db-servers-receiver-ports="4444,4445"
# scheduler-db-servers-receiver-ports="4444,4445"
\ No newline at end of file
prov-proxy-cpu-cores = {{ parameter_dict['proxy-cpu-cores'] }}
prov-proxy-memory = {{ parameter_dict['proxy-memory'] }}
prov-db-cpu-cores = {{ parameter_dict['db-cpu-cores'] }}
prov-db-disk-iops = {{ parameter_dict['db-disk-iops'] }}
prov-db-memory = {{ parameter_dict['db-memory'] }}
prov-db-memory-shared-pct = "{{ parameter_dict['db-memory-shared-pct'] }}"
prov-db-memory-threaded-pct = "{{ parameter_dict['db-memory-threaded-pct'] }}"
test-inject-traffic = true
# failover
failover-mode = "{{ parameter_dict['failover-mode'] }}"
failover-limit = {{ parameter_dict['failover-limit'] }}
failover-falsepositive-heartbeat = {{ setbool(parameter_dict['failover-falsepositive-heartbeat']) }}
failover-falsepositive-heartbeat-timeout = {{ parameter_dict['failover-falsepositive-heartbeat-timeout'] }}
failover-falsepositive-ping-counter = {{ parameter_dict['failover-falsepositive-ping-counter'] }}
failover-max-slave-delay = {{ parameter_dict['failover-max-slave-delay'] }}
failover-readonly-state = {{ setbool(parameter_dict['failover-readonly-state']) }}
failover-restart-unsafe = {{ setbool(parameter_dict['failover-restart-unsafe']) }}
failover-time-limit = {{ parameter_dict['failover-time-limit'] }}
#switchover
switchover-at-equal-gtid = {{ setbool(parameter_dict['switchover-at-equal-gtid']) }}
switchover-slave-wait-catch = {{ setbool(parameter_dict['switchover-slave-wait-catch']) }}
switchover-wait-kill = {{ parameter_dict['switchover-wait-kill'] }}
switchover-wait-trx = {{ parameter_dict['switchover-wait-trx'] }}
switchover-wait-write-query = {{ parameter_dict['switchover-wait-write-query'] }}
software/repman/templates/config.toml.in
View file @
d0c397f9
[Default]
[Default]
api-bind = "{{ parameter_dict['ipv4'] }}"
api-bind = "{{ parameter_dict['ipv4'] }}"
http-bind-address = "{{ parameter_dict['ipv4'] }}"
http-bind-address = "{{ parameter_dict['ipv4'] }}"
http-server = true
http-session-lifetime = {{ parameter_dict['http-session-lifetime'] }}
http-refresh-interval = {{ int(parameter_dict['http-refresh-interval'])*1000 }}
monitoring-save-config = false
monitoring-save-config = false
api-https-bind = true
api-https-bind = true
api-credentials = "{{ parameter_dict['username'] }}:{{ parameter_dict['password'] }}"
api-credentials = "{{ parameter_dict['username'] }}:{{ parameter_dict['password'] }}"
...
@@ -10,11 +13,10 @@ db-servers-binary-path = "{{ parameter_dict['mysql-bin-dir'] }}"
...
@@ -10,11 +13,10 @@ db-servers-binary-path = "{{ parameter_dict['mysql-bin-dir'] }}"
# Database list of hosts to ignore in election
# Database list of hosts to ignore in election
#db-servers-ignored-hosts =
#db-servers-ignored-hosts =
# Database hosts list to monitor, IP and port (optional), specified in the host:[port] format and separated by commas
# Database hosts list to monitor, IP and port (optional), specified in the host:[port] format and separated by commas
# XXX - check if mandatory (as present in cluster)
monitoring-address = "{{ parameter_dict['ipv4'] }}"
#db-servers-hosts =
#haproxy = true
#haproxy = true
haproxy-binary-path = "{{ parameter_dict['haproxy-bin'] }}"
#
haproxy-binary-path = "{{ parameter_dict['haproxy-bin'] }}"
# HaProxy input bind address for read (default "0.0.0.0")
# HaProxy input bind address for read (default "0.0.0.0")
#haproxy-ip-read-bind =
#haproxy-ip-read-bind =
# HaProxy input bind address for write (default "0.0.0.0")
# HaProxy input bind address for write (default "0.0.0.0")
...
@@ -28,6 +30,17 @@ haproxy-binary-path = "{{ parameter_dict['haproxy-bin'] }}"
...
@@ -28,6 +30,17 @@ haproxy-binary-path = "{{ parameter_dict['haproxy-bin'] }}"
#HaProxy read-write port to leader (default 3306)
#HaProxy read-write port to leader (default 3306)
#haproxy-write-port =
#haproxy-write-port =
# Use restic to archive and restore backups
backup = true
backup-restic = true
backup-restic-binary-path = "{{ parameter_dict['restic-bin'] }}"
backup-restic-aws = false
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'] }}"
# Mail configuration
# Mail configuration
# Alert email sender (default "mrm@localhost")
# Alert email sender (default "mrm@localhost")
mail-from = "{{ parameter_dict['mail-from'] }}"
mail-from = "{{ parameter_dict['mail-from'] }}"
...
@@ -38,12 +51,8 @@ mail-smtp-user = "{{ parameter_dict['mail-smtp-user'] }}"
...
@@ -38,12 +51,8 @@ mail-smtp-user = "{{ parameter_dict['mail-smtp-user'] }}"
# Alert email recipients, separated by commas
# Alert email recipients, separated by commas
mail-to = "{{ parameter_dict['mail-to'] }}"
mail-to = "{{ parameter_dict['mail-to'] }}"
mysqlbinlog-path = "{{ parameter_dict['mysqlbinlog-path'] }}"
mysqlclient-path = "{{ parameter_dict['mysqlclient-path'] }}"
mysqldump-path = "{{ parameter_dict['mysqldump-path'] }}"
prov-orchestrator = "slapos"
prov-orchestrator = "slapos"
prov-db-tags
="gtidstrict,bind,pkg,innodb,noquerycache,slow,pfs,linux,readonly,diskmonitor,sqlerror,compressbinlog
"
prov-db-tags
= "{{ parameter_dict['enabled-tags'] }}
"
sysbench-binary-path = "{{ parameter_dict['sysbench-bin'] }}"
sysbench-binary-path = "{{ parameter_dict['sysbench-bin'] }}"
# Number of threads to run benchmark (default 4)
# Number of threads to run benchmark (default 4)
...
...
software/repman/templates/mariadb_init_root.sql.in
View file @
d0c397f9
...
@@ -6,5 +6,7 @@ CREATE USER 'repman'@'localhost' IDENTIFIED BY '{{ parameter_dict["password"] }}
...
@@ -6,5 +6,7 @@ CREATE USER 'repman'@'localhost' IDENTIFIED BY '{{ parameter_dict["password"] }}
GRANT ALL ON *.* TO 'repman'@'localhost' WITH GRANT OPTION ;
GRANT ALL ON *.* TO 'repman'@'localhost' WITH GRANT OPTION ;
CREATE USER 'repman'@'%' IDENTIFIED BY '{{ parameter_dict["password"] }}' ;
CREATE USER 'repman'@'%' IDENTIFIED BY '{{ parameter_dict["password"] }}' ;
GRANT ALL ON *.* TO 'repman'@'%' WITH GRANT OPTION ;
GRANT ALL ON *.* TO 'repman'@'%' WITH GRANT OPTION ;
CREATE USER 'repman'@'::' IDENTIFIED BY '{{ parameter_dict["password"] }}' ;
GRANT ALL ON *.* TO 'repman'@'::' WITH GRANT OPTION ;
DROP DATABASE IF EXISTS test ;
DROP DATABASE IF EXISTS test ;
FLUSH PRIVILEGES ;
FLUSH PRIVILEGES ;
\ No newline at end of file
software/repman/templates/mariadb_initial_setup.sql.in
View file @
d0c397f9
...
@@ -14,6 +14,7 @@ CREATE DATABASE IF NOT EXISTS `{{ name }}`;
...
@@ -14,6 +14,7 @@ CREATE DATABASE IF NOT EXISTS `{{ name }}`;
{% if user -%}
{% if user -%}
GRANT ALL PRIVILEGES ON `{{ name }}`.* TO `{{ user }}`@`%` IDENTIFIED BY '{{ password }}';
GRANT ALL PRIVILEGES ON `{{ name }}`.* TO `{{ user }}`@`%` IDENTIFIED BY '{{ password }}';
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 }}';
{%- endif %}
{%- endif %}
{% endmacro -%}
{% endmacro -%}
...
...
software/repman/templates/repman-manager.sh.in
View file @
d0c397f9
...
@@ -17,14 +17,26 @@ wait_database () {
...
@@ -17,14 +17,26 @@ wait_database () {
else
else
if [ $CODE -eq 200 ]; then
if [ $CODE -eq 200 ]; then
break;
break;
else:
echo ">> [$retry] waitdatabases returned code $CODE...";
fi
fi
echo ">> [$retry] waitdatabases returned code $CODE...";
fi
fi
sleep 1
sleep 1
done
done
}
}
activate_proxy () {
NAME=$1
URL="{{ secure_url }}/api/clusters/$NAME/settings/actions/switch/database-hearbeat"
echo ">> Calling $URL...";
CODE=$(curl -H "Authorization: Bearer ${TOKEN}" -o /dev/null -w "%{http_code}" $URL)
if [ $CODE -eq 200 ]; then
return 0;
else
echo ">> ERROR: failed to activate proxy: $URL returned code $CODE"
return 1;
fi
}
TOKEN=$(curl -s -X POST --data '{"username":"{{ username }}","password":"{{ password}}"}' {{ secure_url }}/api/login | {{ jq_bin }} -r '.token')
TOKEN=$(curl -s -X POST --data '{"username":"{{ username }}","password":"{{ password}}"}' {{ secure_url }}/api/login | {{ jq_bin }} -r '.token')
# Always reload cluster configuration to apply recent changes
# Always reload cluster configuration to apply recent changes
...
@@ -45,10 +57,14 @@ if [ ! -f "{{ parameter_dict['bootstrap'] }}/{{ name }}_bootstrapped" ]; then
...
@@ -45,10 +57,14 @@ if [ ! -f "{{ parameter_dict['bootstrap'] }}/{{ name }}_bootstrapped" ]; then
curl -H "Authorization: Bearer ${TOKEN}" \
curl -H "Authorization: Bearer ${TOKEN}" \
{{ secure_url }}/api/clusters/{{ name }}/actions/replication/cleanup
{{ secure_url }}/api/clusters/{{ name }}/actions/replication/cleanup
CODE=$(curl -H "Authorization: Bearer ${TOKEN}" -o /dev/null -w "%{http_code}" {{ secure_url }}/api/clusters/{{ name }}/actions/replication/bootstrap/master-slave)
CODE=$(curl -H "Authorization: Bearer ${TOKEN}" -o /dev/null -w "%{http_code}" {{ secure_url }}/api/clusters/{{ name }}/actions/replication/bootstrap/master-slave)
SUCCESS=0
if [ $CODE -eq 200 ]; then
if [ $CODE -eq 200 ]; then
# Mark boostrap done!
activate_proxy {{ name }}
echo "Cluster {{ name }} replication bootstrapped"
if [ $? -eq 0 ]; then
echo "DO NOT REMOVE THIS FILE" > {{ parameter_dict['bootstrap'] }}/{{ name }}_bootstrapped
# Mark boostrap done!
echo "Cluster {{ name }} replication bootstrapped"
echo "DO NOT REMOVE THIS FILE" > {{ parameter_dict['bootstrap'] }}/{{ name }}_bootstrapped
fi
else
else
echo "ERROR: Failed to bootstrap cluster {{ name }}... http_code $CODE"
echo "ERROR: Failed to bootstrap cluster {{ name }}... http_code $CODE"
fi
fi
...
...
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