Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
2f31ca7
JE-59466
sych74 May 13, 2024
9c52c9f
JE-59466
sych74 May 13, 2024
90eb695
baseUrl
sych74 May 13, 2024
a1bbfdf
baseUrl
sych74 May 13, 2024
0119e29
baseUrl
sych74 May 13, 2024
f5f0b01
baseUrl
sych74 May 13, 2024
5a4855b
baseUrl
sych74 May 13, 2024
a95eeca
baseUrl
sych74 May 13, 2024
208383e
Update auto-cluster.jps
sych74 May 13, 2024
68f3b5a
baseUrl
sych74 May 13, 2024
0a4ceb7
baseUrl
sych74 May 13, 2024
4e42e03
JE-71499
sych74 May 13, 2024
2429d30
baseUrl
sych74 May 16, 2024
0ff6656
baseUrl
sych74 May 16, 2024
fb1dcb3
baseUrl
sych74 May 16, 2024
94fbe65
baseUrl
sych74 May 16, 2024
1b264c8
Merge pull request #25 from sych74/JE-71499
sych74 May 16, 2024
07049e9
baseUrl
sych74 May 22, 2024
9e51c94
baseUrl
sych74 May 22, 2024
0d7340c
Update common.yml
sych74 May 22, 2024
d614e12
Update master-master.jps
sych74 May 22, 2024
64a3320
Update master-slave.jps
sych74 May 22, 2024
8add870
Update proxy-galera.jps
sych74 May 22, 2024
bcfd5d8
Update proxy-master-slave.jps
sych74 May 22, 2024
c467e6f
Update common.yml
sych74 May 22, 2024
86fea83
Update proxy-common.yml
sych74 May 22, 2024
426e709
Merge pull request #354 from sych74/stage-cluster
sych74 May 22, 2024
a0d0266
baseUrl
sych74 Aug 16, 2024
394626f
Update auto-cluster.jps
sych74 Aug 16, 2024
461fba1
JE-72311
sych74 Aug 16, 2024
5142a35
Update master-slave.jps
sych74 Aug 16, 2024
537022c
JE-72311
sych74 Aug 16, 2024
4875024
Update auto-cluster-logic.jps
sych74 Aug 16, 2024
d278bfb
Update master-master.jps
sych74 Aug 16, 2024
6a8bff6
JE-72311
sych74 Aug 16, 2024
2753264
Update manifest.yml
sych74 Aug 29, 2024
b57fb58
Update auto-cluster.jps
sych74 Aug 29, 2024
fdeb70b
JE-72432
sych74 Aug 29, 2024
2b03683
Update auto-cluster-logic.jps
sych74 Aug 29, 2024
c551aea
Update master-slave.jps
sych74 Aug 29, 2024
6b33443
JE-72432
sych74 Aug 30, 2024
7378001
JE-72432
sych74 Sep 2, 2024
484b0b6
JE-72432
sych74 Sep 2, 2024
012d97b
Update master-master.jps
sych74 Sep 2, 2024
76f8c2c
Update master-slave.jps
sych74 Sep 2, 2024
0ee24c3
Update proxy-master-slave.jps
sych74 Sep 2, 2024
06e14e6
JE-72432
sych74 Sep 4, 2024
bec3c10
Update manifest.yml
sych74 Sep 4, 2024
7a69132
Update auto-cluster.jps
sych74 Sep 4, 2024
48d9a98
Update proxy-master-slave.jps
sych74 Sep 4, 2024
526022a
JE-64263
sych74 Sep 4, 2024
4427bc3
JE-64263
sych74 Sep 4, 2024
ef6f584
JE-64263
sych74 Sep 4, 2024
a0863a7
JE-64263
sych74 Sep 4, 2024
0c8fec1
JE-64263
sych74 Sep 4, 2024
a2c6116
Create firewallRules.js
sych74 Sep 5, 2024
cfd40fd
JE-64263
sych74 Sep 5, 2024
52b1da7
JE-64263
sych74 Sep 5, 2024
40af80f
JE-64263
sych74 Sep 5, 2024
26f91aa
JE-64263
sych74 Sep 5, 2024
9d2b296
Update master-master.jps
sych74 Sep 5, 2024
e08772b
JE-64263
sych74 Sep 5, 2024
18a03be
JE-64263
sych74 Sep 5, 2024
3059129
JE-64263
sych74 Sep 12, 2024
f94e739
Update proxy-common.yml
sych74 Sep 12, 2024
f27418c
JE-64263
sych74 Sep 12, 2024
1b61b45
JE-64263
sych74 Sep 12, 2024
437a6d1
JE-64263
sych74 Sep 12, 2024
275ce51
JE-64263
sych74 Sep 12, 2024
f70153e
JE-64263
sych74 Sep 12, 2024
db41dfc
JE-64263
sych74 Sep 13, 2024
bcf41ec
Update proxy-common.yml
sych74 Sep 13, 2024
bfa691f
JE-64263
sych74 Sep 13, 2024
f3367b8
JE-64263
sych74 Sep 13, 2024
79a3ec3
JE-64263
sych74 Sep 13, 2024
8705e7c
JE-64263
sych74 Sep 13, 2024
478b8a4
JE-64263
sych74 Sep 13, 2024
20cefc8
baseUrl
sych74 Sep 13, 2024
6bb25da
baseUrl
sych74 Sep 13, 2024
5821a49
baseUrl
sych74 Sep 13, 2024
27abc1e
baseUrl
sych74 Sep 13, 2024
00132a3
baseUrl
sych74 Sep 13, 2024
3ed40b1
baseUrl
sych74 Sep 13, 2024
8437d81
baseUrl
sych74 Sep 13, 2024
bc93c29
baseUrl
sych74 Sep 13, 2024
240714c
baseUrl
sych74 Sep 13, 2024
c0652d6
baseUrl
sych74 Sep 13, 2024
c05012d
baseUrl
sych74 Sep 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions addons/auto-clustering/scripts/auto-cluster-logic.jps
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ onInstall:
SCHEME: ${settings.scheme}

- install:
jps: https://raw.githubusercontent.com/jelastic-jps/mysql-cluster/master/addons/recovery/manifest.yml?_r=${fn.random}
jps: https://raw.githubusercontent.com/jelastic-jps/mysql-cluster/stage-addon/addons/recovery/manifest.yml?_r=${fn.random}
nodeGroup: sqldb
targetNodes: sqldb
settings:
install: true

- install:
jps: https://raw.githubusercontent.com/jelastic-jps/mysql-cluster/master/addons/check-corrupts/manifest.yml?_r=${fn.random}
jps: https://raw.githubusercontent.com/jelastic-jps/mysql-cluster/stage-addon/addons/check-corrupts/manifest.yml?_r=${fn.random}
nodeGroup: sqldb
targetNodes: sqldb
settings:
Expand Down
15 changes: 13 additions & 2 deletions scripts/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ actions:

setupAdminUser:
- cmd[${this.id}]: |-
wget ${baseUrl}/scripts/setupUser.sh -O ~/setupUser.sh &>> /var/log/run.log;
wget ${globals.db_cluster_path}/scripts/setupUser.sh -O ~/setupUser.sh;
bash ~/setupUser.sh ${globals.DB_USER} ${globals.DB_PASS} &>> /var/log/run.log;
user: root

Expand All @@ -88,7 +88,7 @@ actions:
pswd: ${globals.REPLICA_PSWD}

addCustomConfig:
- cmd[sqldb]: wget ${baseUrl}/configs/custom.cnf -O ${globals.customConfigFile} &>> /var/log/run.log;
- cmd[sqldb]: wget ${globals.db_cluster_path}/configs/custom.cnf -O ${globals.customConfigFile};
- env.file.AddFavorite:
nodeGroup: sqldb
path: ${globals.customConfigFile}
Expand Down Expand Up @@ -123,3 +123,14 @@ actions:
sed -i "s/expire_logs_days.*/binlog_expire_logs_seconds = 604800/" ${this.conf_file};
sed -i "/master_info_repository/d" ${this.conf_file};
sed -i "/relay_log_info_repository/d" ${this.conf_file};

- if (/mysql/.test("${nodes.sqldb.nodeType}") && '${fn.compare([nodes.sqldb.version], 8.0.33)}' == 1):
cmd[${this.id}]: |-
sed -i "/binlog_format/d" ${this.conf_file};

- if (/percona/.test("${nodes.sqldb.nodeType}") && '${fn.compare([nodes.sqldb.version], 8.0.33)}' == 1):
cmd[${this.id}]: |-
sed -i "s/log-slave-updates/log_replica_updates/" ${this.conf_file};
sed -i "s/slave-skip-errors/replica_skip_errors/" ${this.conf_file};
sed -i "s/expire_logs_days.*/binlog_expire_logs_seconds = 604800/" ${this.conf_file};
sed -i "/binlog_format/d" ${this.conf_file};
40 changes: 40 additions & 0 deletions scripts/firewallRules.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
var envName = "${env.name}",
bFireWallEnabled,
outputRule,
inputRule,
rules,
resp;

inputRule = {
"direction": "INPUT",
"name": name,
"protocol": "ALL",
"ports": ports,
"src": "ALL",
"priority": 1080,
"action": "ALLOW"
};
outputRule = {
"direction":'OUTPUT',
"name":name,
"protocol":'ALL',
"ports":ports,
"dst":'ALL',
"priority":1000,
"action":'ALLOW'
};

if (jelastic.environment.security) {
resp = jelastic.billing.account.GetOwnerQuotas(appid, session, 'firewall.enabled');
if (!resp || resp.result !== 0) return resp;
bFireWallEnabled = resp.array[0] ? resp.array[0].value : 0;
if (bFireWallEnabled) {
resp = jelastic.environment.security.AddRule(envName, session, inputRule, nodeGroup);
if (!resp || resp.result !== 0) return resp;
return jelastic.environment.security.AddRule(envName, session, outputRule, nodeGroup);
}
}

return {
result: 0
}
2 changes: 1 addition & 1 deletion scripts/galera.jps
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ id: mysql-galera-cluster
name: MariaDB Galera Cluster
description: MariaDB Galera Auto Clustering

baseUrl: https://raw.githubusercontent.com/jelastic-jps/mysql-cluster/v3.0.0
baseUrl: https://raw.githubusercontent.com/jelastic-jps/mysql-cluster/stage-cluster

success:
text: /texts/phpmyadmin-credentials.md
Expand Down
4 changes: 2 additions & 2 deletions scripts/master-master.jps
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ actions:

setupPrimaryPrimaryReplication:
- cmd[${globals.primary2_id}]: |-
curl --silent https://raw.githubusercontent.com/jelastic-jps/mysql-cluster/master/addons/recovery/scripts/db-recovery.sh > /tmp/db-recovery.sh;
curl --silent https://raw.githubusercontent.com/jelastic-jps/mysql-cluster/stage-addon/addons/recovery/scripts/db-recovery.sh > /tmp/db-recovery.sh;
bash /tmp/db-recovery.sh --scenario restore_primary_from_primary --donor-ip ${globals.primary1_ip};
user: root

Expand Down Expand Up @@ -143,6 +143,6 @@ actions:

setupSecondaryReplication:
- cmd[${this}]: |-
curl --silent https://raw.githubusercontent.com/jelastic-jps/mysql-cluster/master/addons/recovery/scripts/db-recovery.sh > /tmp/db-recovery.sh;
curl --silent https://raw.githubusercontent.com/jelastic-jps/mysql-cluster/stage-addon/addons/recovery/scripts/db-recovery.sh > /tmp/db-recovery.sh;
bash /tmp/db-recovery.sh --scenario restore_secondary_from_primary --donor-ip ${globals.primary1_ip} --additional-primary ${globals.primary2_ip};
user: root
2 changes: 1 addition & 1 deletion scripts/master-slave.jps
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,6 @@ actions:
- setGlobals:
PRIMARY_IP: ${nodes.sqldb.master.address}
- cmd[${this}]: |-
curl --silent https://raw.githubusercontent.com/jelastic-jps/mysql-cluster/master/addons/recovery/scripts/db-recovery.sh > /tmp/db-recovery.sh;
curl --silent https://raw.githubusercontent.com/jelastic-jps/mysql-cluster/stage-addon/addons/recovery/scripts/db-recovery.sh > /tmp/db-recovery.sh;
bash /tmp/db-recovery.sh --scenario restore_secondary_from_primary --donor-ip ${globals.PRIMARY_IP};
user: root
43 changes: 42 additions & 1 deletion scripts/proxy-common.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,44 @@
globals:
db_cluster_path: https://raw.githubusercontent.com/jelastic-jps/mysql-cluster/stage-cluster
proxy_web_port: 4848

actions:

setReplicaCommands:
- if ((/mariadb/.test("${nodes.sqldb.nodeType}")) && ('${fn.compare([nodes.sqldb.version], 11.0)}' >= 0)):
setGlobals:
show_slave_hosts: "SHOW REPLICA HOSTS"
- elif ((/mysql/.test("${nodes.sqldb.nodeType}")) && ('${fn.compare([nodes.sqldb.version], 8.1)}' >= 0)):
setGlobals:
show_slave_hosts: "SHOW REPLICAS"
- elif ((/percona/.test("${nodes.sqldb.nodeType}")) && ('${fn.compare([nodes.sqldb.version], 8.1)}' >= 0)):
setGlobals:
show_slave_hosts: "SHOW REPLICAS"
- else:
setGlobals:
show_slave_hosts: "SHOW SLAVE HOSTS"

disableOrchestrator:
- log: Disabling orchestrator
- cmd [proxy]: |-
mysql -h 127.0.0.1 -P3360 -uroot -e "DROP DATABASE IF EXISTS orchestrator;"
if systemctl list-unit-files --type=service | grep -q 'orchestrator.service'; then
systemctl stop orchestrator;
systemctl disable orchestrator;
fi
user: root

setupProxySQLGUI:
- log: ProxySQL GUI configuration
- cmd[proxy]: |-
MYSQL_PWD=admin mysql -h 127.0.0.1 -P6032 -uadmin -e "UPDATE global_variables SET variable_value='true' WHERE variable_name='admin-web_enabled';"
MYSQL_PWD=admin mysql -h 127.0.0.1 -P6032 -uadmin -e "UPDATE global_variables SET variable_value='${globals.proxy_web_port}' WHERE variable_name='admin-web_port';"
MYSQL_PWD=admin mysql -h 127.0.0.1 -P6032 -uadmin -e "UPDATE global_variables SET variable_value='${globals.ADMIN_USER}:${globals.ADMIN_PASS}' WHERE variable_name='admin-stats_credentials';"
MYSQL_PWD=admin mysql -h 127.0.0.1 -P6032 -uadmin -e "LOAD ADMIN VARIABLES TO RUNTIME; SAVE ADMIN VARIABLES TO DISK;"
- script[proxy]: ${globals.db_cluster_path}/scripts/firewallRules.js?_r=${fn.random}
ports: ${globals.proxy_web_port}
name: ProxySQL Admin Web

setupOrchestrator:
- log: Orchestrator configuration
- cmd [proxy]: |-
Expand All @@ -11,7 +51,7 @@ actions:
mysql -h 127.0.0.1 -P3360 -uroot -e "SET PASSWORD FOR 'admin'@'127.0.0.1' = PASSWORD('${globals.ORCH_PASS}');"
fi
mysql -h 127.0.0.1 -P3360 -uroot -e "FLUSH PRIVILEGES;"
wget ${baseUrl}/configs/orchestrator.conf.json -O /etc/orchestrator.conf.json &>> /var/log/run.log
wget ${globals.db_cluster_path}/configs/orchestrator.conf.json -O /etc/orchestrator.conf.json &>> /var/log/run.log
sed -i -e 's|orc_client_user|${globals.DB_USER}|g' /etc/orchestrator.conf.json
sed -i -e 's|orc_client_password|${globals.DB_PASS}|g' /etc/orchestrator.conf.json
sed -i -e 's|orc_server_user|admin|g' /etc/orchestrator.conf.json
Expand All @@ -31,6 +71,7 @@ actions:
MYSQL_PWD=admin mysql -h 127.0.0.1 -P6032 -uadmin -e "UPDATE global_variables SET variable_value=200 WHERE variable_name='admin-cluster_check_interval_ms';"
MYSQL_PWD=admin mysql -h 127.0.0.1 -P6032 -uadmin -e "UPDATE global_variables SET variable_value=100 WHERE variable_name='admin-cluster_check_status_frequency';"
MYSQL_PWD=admin mysql -h 127.0.0.1 -P6032 -uadmin -e "UPDATE global_variables SET variable_value='true' WHERE variable_name='admin-cluster_mysql_servers_save_to_disk';"
MYSQL_PWD=admin mysql -h 127.0.0.1 -P6032 -uadmin -e "UPDATE global_variables SET variable_value='false' WHERE variable_name='admin-hash_passwords';"
MYSQL_PWD=admin mysql -h 127.0.0.1 -P6032 -uadmin -e "UPDATE global_variables SET variable_value=1 WHERE variable_name='admin-cluster_mysql_servers_diffs_before_sync';"
MYSQL_PWD=admin mysql -h 127.0.0.1 -P6032 -uadmin -e "load admin variables to RUNTIME; save admin variables to disk;"
- forEach(n:nodes.proxy):
Expand Down
5 changes: 3 additions & 2 deletions scripts/proxy-galera.jps
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ id: mysql-proxy-galera-cluster
name: Galera/XtraDB Cluster with ProxySQL
description: Galera/XtraDB Cluster

baseUrl: https://raw.githubusercontent.com/jelastic-jps/mysql-cluster/v3.0.0
baseUrl: https://raw.githubusercontent.com/jelastic-jps/mysql-cluster/stage-cluster

success: /texts/proxy-entrypoint.md

Expand Down Expand Up @@ -53,8 +53,9 @@ onAfterClone:
onInstall:
- getReplicaUser
- resetProxyNodes
- setupOrchestrator
- disableOrchestrator
- setupProxySQLCluster
- setupProxySQLGUI
- if(${fn.compare([nodes.proxy.master.version], 2.0)} > 0): initGaleraForProxy2
- if(${fn.compare([nodes.proxy.master.version], 2.0)} < 0): initGaleraForProxy1
- forEach(nodes.sqldb):
Expand Down
10 changes: 4 additions & 6 deletions scripts/proxy-master-slave.jps
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ id: mysql-proxy-master-slave-cluster
name: MySQL/MariaDB/Percona Database Cluster with ProxySQL
description: ProxySQL Load Balancer Entry Point

baseUrl: https://raw.githubusercontent.com/jelastic-jps/mysql-cluster/v3.0.0
baseUrl: https://raw.githubusercontent.com/jelastic-jps/mysql-cluster/stage-cluster

success: /texts/proxy-entrypoint.md

Expand Down Expand Up @@ -56,11 +56,13 @@ onAfterMigrate:
db_pass: "${globals.DB_PASS}"

onInstall:
- setReplicaCommands
- getReplicaUser
- resetProxyNodes
- setupOrchestrator
- disableOrchestrator
- setupProxySQLCluster
- setupProxySQL
- setupProxySQLGUI
- if ('${globals.SCHEME}'.toLowerCase() == 'master'):
- setGlobals:
MAX_REPL_LAG: 0
Expand Down Expand Up @@ -103,9 +105,6 @@ actions:
cmd [proxy]: |-
MYSQL_PWD=admin mysql -h 127.0.0.1 -P6032 -uadmin -e "INSERT INTO mysql_servers (hostgroup_id, hostname, port) VALUES (10, 'node${this.id}', 3306);"
MYSQL_PWD=admin mysql -h 127.0.0.1 -P6032 -uadmin -e "LOAD MYSQL SERVERS TO RUNTIME; SAVE MYSQL SERVERS TO DISK;"
MYSQL_PWD=${globals.DB_PASS} mysql -u${globals.DB_USER} -hnode${this.id} -e "show slave hosts;"
/usr/local/orchestrator/orchestrator -c discover -i node${this.id} cli;
user: root

addSlave:
cmd[proxy]: |-
Expand All @@ -117,7 +116,6 @@ actions:
cmd[proxy]: |-
MYSQL_PWD=admin mysql -h 127.0.0.1 -P6032 -uadmin -e "DELETE FROM mysql_servers WHERE hostname = 'node${this.id}';"
MYSQL_PWD=admin mysql -h 127.0.0.1 -P6032 -uadmin -e "LOAD MYSQL SERVERS TO RUNTIME; SAVE MYSQL SERVERS TO DISK;"
MYSQL_PWD=${globals.ORCH_PASS} mysql -h 127.0.0.1 -P3360 -uadmin -e "DELETE FROM orchestrator.database_instance where hostname='node${this.id}-${env.domain}';"

getMastersIDs:
- script: |
Expand Down
2 changes: 1 addition & 1 deletion scripts/xtradb.jps
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ id: percona-xtradb-cluster
name: Percona XtraDB Cluster
description: Percona XtraDB Auto Clustering

baseUrl: https://raw.githubusercontent.com/jelastic-jps/mysql-cluster/v3.0.0
baseUrl: https://raw.githubusercontent.com/jelastic-jps/mysql-cluster/stage-cluster

success:
text: /texts/phpmyadmin-credentials.md
Expand Down
8 changes: 4 additions & 4 deletions texts/proxy-entrypoint-galera.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ ___

___

### Cluster Orchestrator Panel
### ProxySQL Web Panel

**Admin panel URL:** [http://proxy.${env.domain}](http://proxy.${env.domain}/)
**Username:** admin
**Password:** ${globals.ORCH_PASS}
**Web panel URL:** [https://node${nodes.proxy.master.id}-${env.domain}:${globals.proxy_web_port}](https://node${nodes.proxy.master.id}-${env.domain}:${globals.proxy_web_port})
**Username:** ${globals.ADMIN_USER}
**Password:** ${globals.ADMIN_PASS}

___

Expand Down
8 changes: 4 additions & 4 deletions texts/proxy-entrypoint.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ ___

___

### Cluster Orchestrator Panel
### ProxySQL Web Panel

**Admin panel URL:** [http://proxy.${env.domain}](http://proxy.${env.domain}/)
**Username:** admin
**Password:** ${globals.ORCH_PASS}
**Web panel URL:** [https://node${nodes.proxy.master.id}-${env.domain}:${globals.proxy_web_port}](https://node${nodes.proxy.master.id}-${env.domain}:${globals.proxy_web_port})
**Username:** ${globals.ADMIN_USER}
**Password:** ${globals.ADMIN_PASS}

___

Expand Down