Docker file/image to deploy Percona XtraDB Cluster 5.6 for dev/tests.

Quickstart

$ git clone https://github.com/alyu/docker.git
$ cd docker/percona-xtradb-5.6/centos
$ ./build.sh
$ ./start-servers.sh 3
$ ./bootstrap-cluster.sh
$ ssh root@172.17.0.2 (root123)
$ mysql -uroot -proot123 -e "show status like '%wsrep%'"

Percona XtraDB Cluster 5.6 Dockerfile

# Percona XtraDB Cluster 5.6
#
# VERSION 1.0
# DOCKER-VERSION 0.81
#
# tag: latest
FROM centos:latest
MAINTAINER Alex Yu <alex@alexyu.se>

RUN yum -y update
RUN echo 'root:root123' | chpasswd
RUN yum -y install openssh-server openssh-clients which
# unsafe

Tags: 

Parallel load a mysqldump

pload.sh

#!/usr/bin/env bash

[[ $# -ne 6 ]] && echo "$(basename $0) <dumpfile> <# of splits/chunks. max 20> <# of mysql clients> <db user> <db password> <db schema>" && exit 1
user=$4
password=$5
schema=$6

#add multiple hosts if available
declare -a hosts=('127.0.0.1' '127.0.0.1')
MYSQL_CMD=mysql

dumpfile=$1
splits=$2
clients=$3

declare -a splitfiles=('xaa'  'xab'  'xac'  'xad'  'xae'  'xaf'  'xag'  'xah'  'xai'  'xaj'  'xak'  'xal' 'xam'  'xan'  'xao'  'xap'  'xaq'  'xar'  'xas'  'xat')

# split file

Tags: 

Config ini file parser in Go

Trying to get my hands a little dirty learning the Go language.
This is a simple config ini file parser. It's avalable at http://github.com/alyu/configparser .

Supports reading/writing the INI file format in addition to:

  • Reading/writing duplicate section names (ex: MySQL NDB engine's config.ini)
  • Options without values (ex: can be used to group a set of hostnames)
  • Options without a named section (ex: a simple option=value file)
  • Find sections with regexp pattern matching on section names, ex: dc1.east.webservers where regex is '.webservers'
  • # or ; as comment delimiter
  • = or : as value delimiter
package configparser_test

import (
    "fmt"
    "github.com/alyu/configparser"
    "log"
)

// Read and modify a configuration file
func Example() {
    config, err := configparser.Read("/etc/config.ini")
    if err != nil {
        log.Fatal(err)
    }
    // Print the full configuration
    fmt.Println(config)

    // get a section
    section, err := config.Section("MYSQLD DEFAULT")
    if err != nil {
        log.Fatal(err)
    } else {
        fmt.Printf("TotalSendBufferMemory=%s\n", section.ValueOf("TotalSendBufferMemory"))

        // set new value
        var oldValue = section.SetValueFor("TotalSendBufferMemory", "256M")
        fmt.Printf("TotalSendBufferMemory=%s, old value=%s\n", section.ValueOf("TotalSendBufferMemory"), oldValue)

        // delete option
        oldValue = section.Delete("DefaultOperationRedoProblemAction")
        fmt.Println("Deleted DefaultOperationRedoProblemAction: " + oldValue)

        // add new options
        section.Add("innodb_buffer_pool_size", "64G")
        section.Add("innodb_buffer_pool_instances", "8")
    }

    // add a new section and options
    section = config.NewSection("NDBD MGM")
    section.Add("NodeId", "2")
    section.Add("HostName", "10.10.10.10")
    section.Add("PortNumber", "1186")
    section.Add("ArbitrationRank", "1")

    // find all sections ending with .webservers
    sections, err := config.Find(".webservers$")
    if err != nil {
        log.Fatal(err)
    }
    for _, section := range sections {
        fmt.Print(section)
    }
    // or
    config.PrintSection("dc1.webservers")

    sections, err = config.Delete("NDB_MGMD DEFAULT")
    if err != nil {
        log.Fatal(err)
    }
    // deleted sections
    for _, section := range sections {
        fmt.Print(section)
    }

    options := section.Options()
    fmt.Println(options["HostName"])

    // save the new config. the original will be renamed to /etc/config.ini.bak
    err = configparser.Save(config, "/etc/config.ini")
    if err != nil {
        log.Fatal(err)
    }
}

Tags: 

Vagrant box with Severalnines database cluster deployment scripts

Prerequisites

General

Using Vagrant's Multi-VM environment makes launching several VMs to form a cluster painless and it's easy to quickly start playing with the various database clusters and our Severalnines's ClusterControl in a contained environment.

NOTE: The vagrant box file's size is 390MB and can take some time to download.
(Mar/14): ClusterControl 1.2.5, MySQL Cluster 7.3, Percona XtraDB Cluster 5.6, Codership 5.6, MongoDB 2.4.x
(May/13): MySQL Cluster 7.2.12, Codership Galera 5.5.29(Source distribution, wsrep_23.7.3.r3853), Percona XtraDB Cluster 5.5.30-30.2(Percona Server (GPL), Release 30.2, wsrep_23.7.4.r3843), Mongodb 2.4.x

This vagrant box comes with a set of Severalnines's database cluster deployment scripts to bootstrap the following:

  • 3 node Galera Cluster for MySQL (Codership and Percona builds).
  • 4 node MySQL Cluster. 2 SQL nodes, 2 MGM nodes and 2 Data nodes.
  • 1 sharded MongoDB Cluster with config servers and routers on 3 hosts.

Tags: 

Pages

Subscribe to Front page feed