File: setupCluster.js

package info (click to toggle)
golang-github-rluisr-mysqlrouter-go 1.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 264 kB
  • sloc: sh: 215; javascript: 15; makefile: 11
file content (16 lines) | stat: -rw-r--r-- 721 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
var dbPass = "mysql"
var clusterName = "devCluster"

try {
    print('Setting up InnoDB cluster...\n');
    shell.connect('root@mysql-server-1:3306', dbPass)
    var cluster = dba.createCluster(clusterName);
    print('Adding instances to the cluster.');
    cluster.addInstance({user: "root", host: "mysql-server-2", password: dbPass}, {recoveryMethod: 'incremental'})
    print('.');
    cluster.addInstance({user: "root", host: "mysql-server-3", password: dbPass}, {recoveryMethod: 'incremental'})
    print('.\nInstances successfully added to the cluster.');
    print('\nInnoDB cluster deployed successfully.\n');
} catch (e) {
    print('\nThe InnoDB cluster could not be created.\n\nError: ' + e.message + '\n');
}