Percona Xtradb Cluster image building scripts

Making a new datastore pxc image with the Percona Xtradb Cluster 5.5
packages from the public ubuntu repository.

Ran into some odd issues when booting the image where the guest agent
would start and stop the pxc service and about 60% of the time the
upstart process would start mysql when the guest was expecting mysql
to be stopped.

Implements: blueprint support-pxc-56
Change-Id: I0f95341e4e89572f784d87ff593939d1b464779c
This commit is contained in:
Craig Vyvial 2015-07-07 16:57:49 -05:00
parent 4ae66606e8
commit 30faa45209
6 changed files with 54 additions and 8 deletions

1
.gitignore vendored
View File

@ -22,3 +22,4 @@ options.rc
*.log
.local.conf
scripts/local.conf.d/local.conf.d
*.config/

View File

@ -0,0 +1,14 @@
#!/bin/sh
# CONTEXT: GUEST during CONSTRUCTION as ROOT
# PURPOSE: Install controller base required packages
set -e
set -o xtrace
export DEBIAN_FRONTEND=noninteractive
apt-get -y install percona-xtradb-cluster-server percona-xtrabackup
# Don't auto start mysql (we'll start it up in guest)
update-rc.d mysql defaults
update-rc.d mysql disable

View File

@ -0,0 +1,10 @@
#!/bin/sh
# CONTEXT: GUEST during PRE-CONSTRUCTION as ROOT
# PURPOSE: Force a repo update
set -e
set -o xtrace
apt-get update

View File

@ -0,0 +1,11 @@
#!/bin/sh
set -e
#CONTEXT: chroot on host
#PURPOSE: Allows mysqld to create temporary files when restoring backups
cat <<EOF >>/etc/apparmor.d/local/usr.sbin.mysqld
/tmp/ rw,
/tmp/** rwk,
EOF

View File

@ -58,7 +58,7 @@ function build_guest_image() {
exit 1
fi
SERVICE_TYPE=$1
VALID_SERVICES='mysql percona redis cassandra couchbase mongodb postgresql couchdb vertica db2'
VALID_SERVICES='mysql percona redis cassandra couchbase mongodb postgresql couchdb vertica db2 pxc'
if ! [[ " $VALID_SERVICES " =~ " $SERVICE_TYPE " ]]; then
exclaim "You did not pass in a valid image type. Valid types are:" $VALID_SERVICES
exit 1

View File

@ -482,6 +482,9 @@ function cmd_set_datastore() {
elif [ "$DATASTORE_TYPE" == "percona" ]; then
PACKAGES=${PACKAGES:-"percona-server-server-5.5"}
VERSION="5.5"
elif [ "$DATASTORE_TYPE" == "pxc" ]; then
PACKAGES=${PACKAGES:-"percona-xtradb-cluster-server"}
VERSION="5.5"
elif [ "$DATASTORE_TYPE" == "mongodb" ]; then
PACKAGES=${PACKAGES:-"mongodb-org"}
VERSION="3.0"
@ -635,22 +638,29 @@ function mod_confs() {
fi
if [ "$DATASTORE_TYPE" = "vertica" ]; then
# Setting cluster_member_count to 2 to decrease cluster spawn time.
iniset $TROVE_CONF vertica cluster_member_count 2
# Vertica needs more time than mysql for its boot/start/stop operations.
iniset $TROVE_TASKMANAGER_CONF DEFAULT agent_call_high_timeout 300
iniset $TROVE_TASKMANAGER_CONF DEFAULT cluster_usage_timeout 2000
iniset $TROVE_TASKMANAGER_CONF DEFAULT resize_time_out 900
iniset $TROVE_TASKMANAGER_CONF DEFAULT usage_timeout 1500
setup_cluster_configs
# Setting flavor to be >= 2GB RAM for Vertica guest instances in test.conf.
sed -i "s/m1.rd-tiny/m1.small/g" $TEST_CONF
sed -i "s/m1.rd-smaller/m1.medium/g" $TEST_CONF
fi
if [ "$DATASTORE_TYPE" = "pxc" ]; then
setup_cluster_configs
fi
}
function setup_cluster_configs() {
# Setting cluster_member_count to 2 to decrease cluster spawn time.
iniset $TROVE_CONF $DATASTORE_TYPE cluster_member_count 2
# Setting cluster configs
iniset $TROVE_TASKMANAGER_CONF DEFAULT agent_call_high_timeout 300
iniset $TROVE_TASKMANAGER_CONF DEFAULT cluster_usage_timeout 2000
iniset $TROVE_TASKMANAGER_CONF DEFAULT resize_time_out 900
iniset $TROVE_TASKMANAGER_CONF DEFAULT usage_timeout 1500
}
function add_test_flavors() {
add_flavor 'tinier' 6 506 10 1 0