mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-04 11:37:16 +00:00
Minimal PXC compat
This commit is contained in:
@@ -43,6 +43,12 @@ exit_status=0
|
||||
/tmp/$PORT/use < sakila-db/sakila-schema.sql
|
||||
exit_status=$((exit_status | $?))
|
||||
|
||||
# We can remove this once PXC's triggers can handle myisam tables
|
||||
if [ "${2:-""}" = "cluster" ]; then
|
||||
/tmp/$PORT/use -e "ALTER TABLE sakila.film_text DROP KEY idx_title_description"
|
||||
/tmp/$PORT/use -e "ALTER TABLE sakila.film_text ENGINE = 'InnoDB'"
|
||||
fi
|
||||
|
||||
/tmp/$PORT/use < sakila-db/sakila-data.sql
|
||||
exit_status=$((exit_status | $?))
|
||||
|
||||
|
42
sandbox/servers/pxc/5.5/my.sandbox.cnf
Normal file
42
sandbox/servers/pxc/5.5/my.sandbox.cnf
Normal file
@@ -0,0 +1,42 @@
|
||||
[client]
|
||||
user = msandbox
|
||||
password = msandbox
|
||||
port = PORT
|
||||
socket = /tmp/PORT/mysql_sandboxPORT.sock
|
||||
|
||||
[mysqld]
|
||||
port = PORT
|
||||
socket = /tmp/PORT/mysql_sandboxPORT.sock
|
||||
pid-file = /tmp/PORT/data/mysql_sandboxPORT.pid
|
||||
basedir = PERCONA_TOOLKIT_SANDBOX
|
||||
datadir = /tmp/PORT/data
|
||||
key_buffer_size = 16M
|
||||
innodb_buffer_pool_size = 16M
|
||||
innodb_data_home_dir = /tmp/PORT/data
|
||||
innodb_log_group_home_dir = /tmp/PORT/data
|
||||
innodb_data_file_path = ibdata1:10M:autoextend
|
||||
innodb_log_file_size = 5M
|
||||
log-bin = mysql-bin
|
||||
relay_log = mysql-relay-bin
|
||||
log_slave_updates
|
||||
server-id = PORT
|
||||
report-host = 127.0.0.1
|
||||
report-port = PORT
|
||||
log-error = /tmp/PORT/data/mysqld.log
|
||||
innodb_lock_wait_timeout = 3
|
||||
general_log
|
||||
general_log_file = genlog
|
||||
|
||||
binlog_format = ROW
|
||||
wsrep_provider = LIBGALERA
|
||||
wsrep_cluster_address = CLUSTER_AD
|
||||
wsrep_sst_receive_address = ADDR:RECEIVE_PRT
|
||||
wsrep_node_incoming_address= ADDR
|
||||
wsrep_slave_threads = 2
|
||||
wsrep_cluster_name = CLUSTER_NAME
|
||||
wsrep_provider_options = "gmcast.listen_addr=tcp://ADDR:LISTEN_PRT;"
|
||||
wsrep_sst_method = rsync
|
||||
wsrep_node_name = PORT
|
||||
innodb_locks_unsafe_for_binlog = 1
|
||||
innodb_autoinc_lock_mode = 2
|
||||
wsrep-replicate-myisam
|
@@ -40,6 +40,28 @@ make_sandbox() {
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "${type}" = "cluster" ]; then
|
||||
cp $PERCONA_TOOLKIT_BRANCH/sandbox/servers/pxc/$version/my.sandbox.cnf /tmp/$port
|
||||
|
||||
local ip="$(perl -MNet::Address::IP::Local -le 'print Net::Address::IP::Local->public')"
|
||||
local libgalera="$PERCONA_TOOLKIT_SANDBOX/lib/libgalera_smm.so"
|
||||
local cluster_name="${CLUSTER_NAME:-"pt_sandbox_cluster"}"
|
||||
local cluster_address="gcomm://"
|
||||
local listen_port=$(($port + 10))
|
||||
local receive_port=$(($port + 20))
|
||||
if [ -n "${master_port}" ]; then
|
||||
local master_listen_port=$(($master_port + 10))
|
||||
cluster_address="gcomm://$ip:$master_listen_port"
|
||||
fi
|
||||
|
||||
sed -e "s/ADDR/$ip/g" -i.bak "/tmp/$port/my.sandbox.cnf"
|
||||
sed -e "s!CLUSTER_AD!$cluster_address!g" -i.bak "/tmp/$port/my.sandbox.cnf"
|
||||
sed -e "s/CLUSTER_NAME/$cluster_name/g" -i.bak "/tmp/$port/my.sandbox.cnf"
|
||||
sed -e "s/RECEIVE_PRT/$receive_port/g" -i.bak "/tmp/$port/my.sandbox.cnf"
|
||||
sed -e "s/LISTEN_PRT/$listen_port/g" -i.bak "/tmp/$port/my.sandbox.cnf"
|
||||
sed -e "s!LIBGALERA!$libgalera!g" -i.bak "/tmp/$port/my.sandbox.cnf"
|
||||
fi
|
||||
|
||||
for file in `grep -rl PORT /tmp/$port`; do
|
||||
sed -e "s/PORT/$port/g" -i.bak $file
|
||||
# Use ! instead of / because the replacment has / (it's a directory)
|
||||
@@ -116,7 +138,7 @@ type=$1 # master, slave or master-master
|
||||
port=$2 # sandbox port number, e.g. 12345
|
||||
master_port=$3 # master port if slave or master-master
|
||||
|
||||
if [ "$type" != "master" ] && [ "$type" != "slave" ] && [ "$type" != "master-master" ]; then
|
||||
if [ "$type" != "master" ] && [ "$type" != "slave" ] && [ "$type" != "master-master" ] && [ "$type" != "cluster" ]; then
|
||||
die "Invalid sandbox type: $type. Valid types are master, slave, and master-master."
|
||||
fi
|
||||
|
||||
@@ -154,7 +176,7 @@ cd $PERCONA_TOOLKIT_BRANCH/sandbox
|
||||
# MySQL executables like PERCONA_TOOLKIT_SANDBOX/bin/mysqld_safe.
|
||||
|
||||
if [ -z "$PERCONA_TOOLKIT_SANDBOX" ]; then
|
||||
PERCONA_TOOLKIT_SANDBOX=`./mk-test-env checkconfig | grep PERCONA_TOOLKIT_SANDBOX | cut -d= -f2 | awk '{print $1}'`
|
||||
PERCONA_TOOLKIT_SANDBOX=`./test-env checkconfig | grep PERCONA_TOOLKIT_SANDBOX | cut -d= -f2 | awk '{print $1}'`
|
||||
if [ -z "$PERCONA_TOOLKIT_SANDBOX" ]; then
|
||||
die "PERCONA_TOOLKIT_SANDBOX environment variable is not set."
|
||||
fi
|
||||
|
@@ -284,17 +284,17 @@ fi
|
||||
case $opt in
|
||||
start)
|
||||
cd $PERCONA_TOOLKIT_BRANCH/sandbox
|
||||
./start-sandbox master 12345
|
||||
./start-sandbox "${2:-"master"}" 12345
|
||||
exit_status=$((exit_status | $?))
|
||||
set_mysql_version
|
||||
if [ $exit_status -eq 0 ]; then
|
||||
./start-sandbox slave 12346 12345
|
||||
./start-sandbox "${2:-"slave"}" 12346 12345
|
||||
exit_status=$((exit_status | $?))
|
||||
./start-sandbox slave 12347 12346
|
||||
./start-sandbox "${2:-"slave"}" 12347 12346
|
||||
exit_status=$((exit_status | $?))
|
||||
if [ $? -eq 0 -a "$MYSQL_VERSION" '>' "4.1" ]; then
|
||||
echo -n "Loading sakila database... "
|
||||
./load-sakila-db 12345
|
||||
./load-sakila-db 12345 "${2:-""}"
|
||||
exit_status=$((exit_status | $?))
|
||||
if [ $exit_status -ne 0 ]; then
|
||||
echo "FAILED"
|
||||
|
Reference in New Issue
Block a user