Adding a replication test that builds 2 MySQL servers

This commit is contained in:
Shane Hathaway 2009-10-03 22:23:31 +00:00
parent 3b25b89222
commit fcff8ebed5
5 changed files with 305 additions and 0 deletions

View File

@ -0,0 +1,141 @@
[buildout]
develop = ../..
parts =
mysqlconf
mysql
mysqlinit
MySQL-python
zope2
instance
zopepy
pidproxy
supervisor
find-links =
http://dist.plone.org
http://download.zope.org/ppix/
http://download.zope.org/distribution/
http://effbot.org/downloads
http://packages.willowrise.org
extends =
http://dist.plone.org/release/3.3.1/versions.cfg
versions = versions
[versions]
zc.buildout = 1.4.1
ZODB3 = 3.8.3-polling
zope.proxy = 3.4.2
[mysqlconf]
recipe = collective.recipe.template
input = ${buildout:directory}/../my.cnf.in
output = ${buildout:directory}/parts/mysqlconf/my.cnf
datadir = ${buildout:directory}/var/mysql
logdir = ${buildout:directory}/var/log
server-id = 1
read-only = 0
port = 23306
[mysql]
recipe = zc.recipe.cmmi
url = http://mysql.mirrors.pair.com/Downloads/MySQL-5.1/mysql-5.1.39.tar.gz
md5sum = 55a398daeb69a778fc46573623143268
extra_options =
--localstatedir=${mysqlconf:datadir}
--sysconfdir=${buildout:directory}/parts/mysqlconf
--with-unix-socket-path=${mysqlconf:datadir}/mysqld.sock
--with-plugins=innobase,myisam
# This MySQL instance should not load configuration from /etc
patch = ${buildout:directory}/../mysql-no-read-etc.patch
[mysqlinit]
recipe = iw.recipe.cmd
on_install = true
on_update = true
cmds =
test -e ${buildout:directory}/bin/mysql || \
ln -s ${mysql:location}/bin/mysql ${buildout:directory}/bin/mysql
test -e ${mysqlconf:datadir}/plone && exit 0
mkdir -p ${mysqlconf:datadir}
${mysql:location}/bin/mysql_install_db
${mysql:location}/bin/mysqld_safe &
sleep 5
${buildout:directory}/bin/mysql -u root << EOF
SHOW MASTER STATUS;
CREATE DATABASE plone;
GRANT ALL ON plone.* TO 'plone'@'localhost' IDENTIFIED BY 'plonepass';
GRANT REPLICATION SLAVE ON *.* TO 'repl'@'localhost' IDENTIFIED BY 'slavepass';
FLUSH PRIVILEGES;
EOF
kill `cat ${mysqlconf:datadir}/mysqld.pid`
[MySQL-python]
recipe = zc.recipe.egg:custom
environment = MySQL-python-env
rpath = ${mysql:location}/lib/mysql
[MySQL-python-env]
# This is needed to help MySQL-python find the mysql_config script
PATH=${mysql:location}/bin:%(PATH)s
[zope2]
recipe = plone.recipe.zope2install
# update zope by updating this URL:
url = ${versions:zope2-url}
# fake eggs are required to satisfy Zope dependencies while
# zope is not yet eggified.
fake-zope-eggs = true
additional-fake-eggs =
pytz
skip-fake-eggs =
ZODB3
ZConfig
zope.proxy
[instance]
recipe = plone.recipe.zope2instance
zope2-location = ${zope2:location}
# The line below sets only the initial password. It will not change an
# existing password.
user = admin:123
http-address = 18080
rel-storage =
type mysql
db plone
user plone
passwd plonepass
keep-history false
replica-conf ${buildout:directory}/replicas.conf
eggs =
PILwoTK
Plone
MySQL-python
RelStorage
environment-vars =
PTS_LANGUAGES en
# installs a python interpreter named "py" that runs with your
# full Zope environment
[zopepy]
recipe = zc.recipe.egg
eggs = ${instance:eggs}
interpreter = py
extra-paths = ${instance:zope2-location}/lib/python
scripts = zopepy zodbconvert
[pidproxy]
recipe = zc.recipe.egg
eggs = supervisor
scripts = pidproxy
[supervisor]
recipe = collective.recipe.supervisor
port = 127.0.0.1:29001
serverurl = http://127.0.0.1:29001
programs =
10 mysql ${buildout:directory}/bin/pidproxy [${mysqlconf:datadir}/mysqld.pid ${mysql:location}/bin/mysqld_safe] ${mysql:location} true
20 instance ${instance:location}/bin/runzope ${instance:location} true

View File

@ -0,0 +1,6 @@
# The list of replicas for RelStorage to contact.
# Note that MySQL interprets "localhost" specially. We have to
# use "127.0.0.1" instead.
localhost
127.0.0.1:23306
127.0.0.1:23307

90
repltest/my.cnf.in Normal file
View File

@ -0,0 +1,90 @@
#
# The MySQL database server configuration file.
#
[client]
socket = ${datadir}/mysqld.sock
port = ${port}
[mysqld_safe]
socket = ${datadir}/mysqld.sock
nice = 0
[mysqld]
#
# * Basic Settings
#
socket = ${datadir}/mysqld.sock
port = ${port}
pid-file = ${datadir}/mysqld.pid
basedir = ${mysql:location}
datadir = ${datadir}
tmpdir = /tmp
skip-external-locking
bind-address = 127.0.0.1
#
# * Fine Tuning
#
key_buffer = 16M
max_allowed_packet = 32M
thread_stack = 128K
thread_cache_size = 8
myisam-recover = BACKUP
#max_connections = 100
#table_cache = 64
#thread_concurrency = 10
#
# * Query Cache Configuration
#
query_cache_limit = 1M
query_cache_size = 16M
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
#log = ${logdir}/mysql.log
#
# Error logging goes to syslog. This is a Debian improvement :)
#
# Here you can see queries with especially long duration
#log_slow_queries = ${logdir}/mysql-slow.log
#long_query_time = 2
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
server-id = ${server-id}
log_bin = ${datadir}/mysql-bin.log
binlog_format = ROW
read_only = ${read-only}
expire_logs_days = 10
max_binlog_size = 100M
sync_binlog = 1
#binlog_do_db = include_database_name
#binlog_ignore_db = include_database_name
#
# * InnoDB
#
innodb_data_file_path = ibdata1:10M:autoextend
innodb_buffer_pool_size=64M
innodb_log_file_size=16M
innodb_log_buffer_size=8M
innodb_flush_log_at_trx_commit=1
innodb_file_per_table
innodb_locks_unsafe_for_binlog=1
[mysqldump]
quick
quote-names
max_allowed_packet = 32M
[mysql]
#no-auto-rehash # faster start of mysql but no tab completion
[isamchk]
key_buffer = 16M

View File

@ -0,0 +1,12 @@
--- mysys/default.c.orig 2009-09-28 15:44:21.000000000 -0600
+++ mysys/default.c 2009-09-28 15:44:57.000000000 -0600
@@ -1123,9 +1123,6 @@
#else
- errors += add_directory(alloc, "/etc/", dirs);
- errors += add_directory(alloc, "/etc/mysql/", dirs);
-
#if defined(DEFAULT_SYSCONFDIR)
if (DEFAULT_SYSCONFDIR[0])
errors += add_directory(alloc, DEFAULT_SYSCONFDIR, dirs);

View File

@ -0,0 +1,56 @@
[buildout]
parts =
mysqlconf
mysql
mysqlinit
pidproxy
supervisor
[mysqlconf]
recipe = collective.recipe.template
input = ${buildout:directory}/../my.cnf.in
output = ${buildout:directory}/parts/mysqlconf/my.cnf
datadir = ${buildout:directory}/var/mysql
logdir = ${buildout:directory}/var/log
server-id = 2
read-only = 1
port = 23307
[mysql]
recipe = zc.recipe.cmmi
url = http://mysql.mirrors.pair.com/Downloads/MySQL-5.1/mysql-5.1.39.tar.gz
md5sum = 55a398daeb69a778fc46573623143268
extra_options =
--localstatedir=${mysqlconf:datadir}
--sysconfdir=${buildout:directory}/parts/mysqlconf
--with-unix-socket-path=${mysqlconf:datadir}/mysqld.sock
--with-plugins=innobase,myisam
# This MySQL instance should not load configuration from /etc
patch = ${buildout:directory}/../mysql-no-read-etc.patch
[mysqlinit]
recipe = iw.recipe.cmd
on_install = true
on_update = true
cmds =
test -e ${buildout:directory}/bin/mysql || \
ln -s ${mysql:location}/bin/mysql ${buildout:directory}/bin/mysql
test -e ${mysqlconf:datadir}/mysql && exit 0
mkdir -p ${mysqlconf:datadir}
${mysql:location}/bin/mysql_install_db
[pidproxy]
recipe = zc.recipe.egg
eggs = supervisor
scripts = pidproxy
[supervisor]
recipe = collective.recipe.supervisor
port = 127.0.0.1:29002
serverurl = http://127.0.0.1:29002
programs =
10 mysql ${buildout:directory}/bin/pidproxy [${mysqlconf:datadir}/mysqld.pid ${mysql:location}/bin/mysqld_safe] ${mysql:location} true