wakame 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +20 -0
- data/README.rdoc +63 -0
- data/Rakefile +86 -0
- data/VERSION +1 -0
- data/app_generators/wakame/templates/README +0 -0
- data/app_generators/wakame/templates/Rakefile +18 -0
- data/app_generators/wakame/templates/bin/wakame-agent +9 -0
- data/app_generators/wakame/templates/bin/wakame-master +9 -0
- data/app_generators/wakame/templates/bin/wakameadm +9 -0
- data/app_generators/wakame/templates/cluster/resources/apache_app/apache_app.rb +54 -0
- data/app_generators/wakame/templates/cluster/resources/apache_app/conf/apache2.conf +46 -0
- data/app_generators/wakame/templates/cluster/resources/apache_app/conf/envvars-app +7 -0
- data/app_generators/wakame/templates/cluster/resources/apache_app/conf/sites-app.conf +23 -0
- data/app_generators/wakame/templates/cluster/resources/apache_app/conf/system-app.conf +67 -0
- data/app_generators/wakame/templates/cluster/resources/apache_app/init.d/apache2-app +192 -0
- data/app_generators/wakame/templates/cluster/resources/apache_lb/apache_lb.rb +56 -0
- data/app_generators/wakame/templates/cluster/resources/apache_lb/conf/apache2.conf +46 -0
- data/app_generators/wakame/templates/cluster/resources/apache_lb/conf/envvars-lb +6 -0
- data/app_generators/wakame/templates/cluster/resources/apache_lb/conf/sites-lb.conf +54 -0
- data/app_generators/wakame/templates/cluster/resources/apache_lb/conf/system-lb.conf +75 -0
- data/app_generators/wakame/templates/cluster/resources/apache_lb/init.d/apache2-lb +192 -0
- data/app_generators/wakame/templates/cluster/resources/apache_www/apache_www.rb +50 -0
- data/app_generators/wakame/templates/cluster/resources/apache_www/conf/apache2.conf +47 -0
- data/app_generators/wakame/templates/cluster/resources/apache_www/conf/envvars-www +7 -0
- data/app_generators/wakame/templates/cluster/resources/apache_www/conf/sites-www.conf +23 -0
- data/app_generators/wakame/templates/cluster/resources/apache_www/conf/system-www.conf +63 -0
- data/app_generators/wakame/templates/cluster/resources/apache_www/init.d/apache2-www +192 -0
- data/app_generators/wakame/templates/cluster/resources/ec2_elastic_ip/ec2_elastic_ip.rb +39 -0
- data/app_generators/wakame/templates/cluster/resources/mysql_master/conf/my.cnf +154 -0
- data/app_generators/wakame/templates/cluster/resources/mysql_master/init.d/mysql +185 -0
- data/app_generators/wakame/templates/cluster/resources/mysql_master/mysql_master.rb +174 -0
- data/app_generators/wakame/templates/config/boot.rb +85 -0
- data/app_generators/wakame/templates/config/cluster.rb +64 -0
- data/app_generators/wakame/templates/config/environments/common.rb +0 -0
- data/app_generators/wakame/templates/config/environments/ec2.rb +3 -0
- data/app_generators/wakame/templates/config/environments/stand_alone.rb +0 -0
- data/app_generators/wakame/templates/config/init.d/wakame-agent +72 -0
- data/app_generators/wakame/templates/config/init.d/wakame-master +73 -0
- data/app_generators/wakame/wakame_generator.rb +124 -0
- data/bin/wakame +18 -0
- data/contrib/imagesetup.sh +77 -0
- data/lib/ext/eventmachine.rb +86 -0
- data/lib/ext/shellwords.rb +172 -0
- data/lib/ext/uri.rb +15 -0
- data/lib/wakame/action.rb +156 -0
- data/lib/wakame/actions/destroy_instances.rb +39 -0
- data/lib/wakame/actions/launch_cluster.rb +31 -0
- data/lib/wakame/actions/migrate_service.rb +65 -0
- data/lib/wakame/actions/propagate_instances.rb +95 -0
- data/lib/wakame/actions/reload_service.rb +21 -0
- data/lib/wakame/actions/scaleout_when_high_load.rb +44 -0
- data/lib/wakame/actions/shutdown_cluster.rb +22 -0
- data/lib/wakame/actions/shutdown_vm.rb +19 -0
- data/lib/wakame/actions/start_service.rb +64 -0
- data/lib/wakame/actions/stop_service.rb +49 -0
- data/lib/wakame/actions/util.rb +71 -0
- data/lib/wakame/actor/daemon.rb +37 -0
- data/lib/wakame/actor/service_monitor.rb +21 -0
- data/lib/wakame/actor/system.rb +46 -0
- data/lib/wakame/actor.rb +33 -0
- data/lib/wakame/agent.rb +226 -0
- data/lib/wakame/amqp_client.rb +219 -0
- data/lib/wakame/command/action_status.rb +62 -0
- data/lib/wakame/command/actor.rb +23 -0
- data/lib/wakame/command/clone_service.rb +12 -0
- data/lib/wakame/command/launch_cluster.rb +15 -0
- data/lib/wakame/command/migrate_service.rb +21 -0
- data/lib/wakame/command/propagate_service.rb +24 -0
- data/lib/wakame/command/shutdown_cluster.rb +15 -0
- data/lib/wakame/command/status.rb +81 -0
- data/lib/wakame/command.rb +31 -0
- data/lib/wakame/command_queue.rb +44 -0
- data/lib/wakame/configuration.rb +93 -0
- data/lib/wakame/daemonize.rb +96 -0
- data/lib/wakame/event.rb +232 -0
- data/lib/wakame/event_dispatcher.rb +154 -0
- data/lib/wakame/graph.rb +79 -0
- data/lib/wakame/initializer.rb +162 -0
- data/lib/wakame/instance_counter.rb +78 -0
- data/lib/wakame/logger.rb +12 -0
- data/lib/wakame/manager/commands.rb +134 -0
- data/lib/wakame/master.rb +369 -0
- data/lib/wakame/monitor/agent.rb +50 -0
- data/lib/wakame/monitor/service.rb +183 -0
- data/lib/wakame/monitor.rb +69 -0
- data/lib/wakame/packets.rb +160 -0
- data/lib/wakame/queue_declare.rb +14 -0
- data/lib/wakame/rule.rb +116 -0
- data/lib/wakame/rule_engine.rb +202 -0
- data/lib/wakame/runner/administrator_command.rb +112 -0
- data/lib/wakame/runner/agent.rb +81 -0
- data/lib/wakame/runner/master.rb +93 -0
- data/lib/wakame/scheduler.rb +251 -0
- data/lib/wakame/service.rb +914 -0
- data/lib/wakame/template.rb +189 -0
- data/lib/wakame/trigger.rb +66 -0
- data/lib/wakame/triggers/instance_count_update.rb +45 -0
- data/lib/wakame/triggers/load_history.rb +107 -0
- data/lib/wakame/triggers/maintain_ssh_known_hosts.rb +43 -0
- data/lib/wakame/triggers/process_command.rb +34 -0
- data/lib/wakame/triggers/shutdown_unused_vm.rb +16 -0
- data/lib/wakame/util.rb +569 -0
- data/lib/wakame/vm_manipulator.rb +186 -0
- data/lib/wakame.rb +59 -0
- data/tasks/ec2.rake +127 -0
- data/tests/cluster.json +3 -0
- data/tests/conf/a +1 -0
- data/tests/conf/b +1 -0
- data/tests/conf/c +1 -0
- data/tests/setup_agent.rb +39 -0
- data/tests/setup_master.rb +28 -0
- data/tests/test_actor.rb +54 -0
- data/tests/test_agent.rb +218 -0
- data/tests/test_amqp_client.rb +94 -0
- data/tests/test_graph.rb +36 -0
- data/tests/test_master.rb +167 -0
- data/tests/test_monitor.rb +47 -0
- data/tests/test_rule_engine.rb +127 -0
- data/tests/test_scheduler.rb +123 -0
- data/tests/test_service.rb +60 -0
- data/tests/test_template.rb +67 -0
- data/tests/test_uri_amqp.rb +19 -0
- data/tests/test_util.rb +71 -0
- data/wakame_generators/resource/resource_generator.rb +54 -0
- data/wakame_generators/resource/templates/apache_app/apache_app.rb +60 -0
- data/wakame_generators/resource/templates/apache_app/conf/apache2.conf +46 -0
- data/wakame_generators/resource/templates/apache_app/conf/envvars-app +7 -0
- data/wakame_generators/resource/templates/apache_app/conf/sites-app.conf +23 -0
- data/wakame_generators/resource/templates/apache_app/conf/system-app.conf +67 -0
- data/wakame_generators/resource/templates/apache_app/init.d/apache2-app +192 -0
- data/wakame_generators/resource/templates/apache_lb/apache_lb.rb +67 -0
- data/wakame_generators/resource/templates/apache_lb/conf/apache2.conf +46 -0
- data/wakame_generators/resource/templates/apache_lb/conf/envvars-lb +6 -0
- data/wakame_generators/resource/templates/apache_lb/conf/sites-lb.conf +54 -0
- data/wakame_generators/resource/templates/apache_lb/conf/system-lb.conf +75 -0
- data/wakame_generators/resource/templates/apache_lb/init.d/apache2-lb +192 -0
- data/wakame_generators/resource/templates/apache_www/apache_www.rb +56 -0
- data/wakame_generators/resource/templates/apache_www/conf/apache2.conf +47 -0
- data/wakame_generators/resource/templates/apache_www/conf/envvars-www +7 -0
- data/wakame_generators/resource/templates/apache_www/conf/sites-www.conf +23 -0
- data/wakame_generators/resource/templates/apache_www/conf/system-www.conf +63 -0
- data/wakame_generators/resource/templates/apache_www/init.d/apache2-www +192 -0
- data/wakame_generators/resource/templates/ec2_elastic_ip/ec2_elastic_ip.rb +39 -0
- data/wakame_generators/resource/templates/mysql_master/conf/my.cnf +154 -0
- data/wakame_generators/resource/templates/mysql_master/init.d/mysql +185 -0
- data/wakame_generators/resource/templates/mysql_master/mysql_master.rb +119 -0
- metadata +289 -0
@@ -0,0 +1,185 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
#
|
3
|
+
### BEGIN INIT INFO
|
4
|
+
# Provides: mysql
|
5
|
+
# Required-Start: $remote_fs $syslog mysql-ndb
|
6
|
+
# Required-Stop: $remote_fs $syslog mysql-ndb
|
7
|
+
# Should-Start: $network $named $time
|
8
|
+
# Should-Stop: $network $named $time
|
9
|
+
# Default-Start: 2 3 4 5
|
10
|
+
# Default-Stop: 0 1 6
|
11
|
+
# Short-Description: Start and stop the mysql database server daemon
|
12
|
+
# Description: Controls the main MySQL database server daemon "mysqld"
|
13
|
+
# and its wrapper script "mysqld_safe".
|
14
|
+
### END INIT INFO
|
15
|
+
#
|
16
|
+
|
17
|
+
[ -n $WAKAME_ROOT ] || { echo "WAKAME_ROOT env was not set" >&2; exit 1; }
|
18
|
+
|
19
|
+
set -e
|
20
|
+
set -u
|
21
|
+
${DEBIAN_SCRIPT_DEBUG:+ set -v -x}
|
22
|
+
|
23
|
+
test -x /usr/sbin/mysqld || exit 0
|
24
|
+
|
25
|
+
. /lib/lsb/init-functions
|
26
|
+
|
27
|
+
SELF=$(cd $(dirname $0); pwd -P)/$(basename $0)
|
28
|
+
CONF=$WAKAME_ROOT/tmp/config/mysql_master/conf/my.cnf
|
29
|
+
MYADMIN="/usr/bin/mysqladmin --defaults-file=$CONF"
|
30
|
+
|
31
|
+
# priority can be overriden and "-s" adds output to stderr
|
32
|
+
ERR_LOGGER="logger -p daemon.err -t /etc/init.d/mysql -i"
|
33
|
+
|
34
|
+
# Safeguard (relative paths, core dumps..)
|
35
|
+
cd /
|
36
|
+
umask 077
|
37
|
+
|
38
|
+
# mysqladmin likes to read /root/.my.cnf. This is usually not what I want
|
39
|
+
# as many admins e.g. only store a password without a username there and
|
40
|
+
# so break my scripts.
|
41
|
+
export HOME=/etc/mysql/
|
42
|
+
|
43
|
+
## Fetch a particular option from mysql's invocation.
|
44
|
+
#
|
45
|
+
# Usage: void mysqld_get_param option
|
46
|
+
mysqld_get_param() {
|
47
|
+
/usr/sbin/mysqld --print-defaults \
|
48
|
+
| tr " " "\n" \
|
49
|
+
| grep -- "--$1" \
|
50
|
+
| tail -n 1 \
|
51
|
+
| cut -d= -f2
|
52
|
+
}
|
53
|
+
|
54
|
+
## Do some sanity checks before even trying to start mysqld.
|
55
|
+
sanity_checks() {
|
56
|
+
# check for config file
|
57
|
+
if [ ! -r $CONF ]; then
|
58
|
+
echo "WARNING: $CONF cannot be read." | $ERR_LOGGER
|
59
|
+
fi
|
60
|
+
|
61
|
+
# check for diskspace shortage
|
62
|
+
datadir=`mysqld_get_param datadir`
|
63
|
+
if LC_ALL=C BLOCKSIZE= df --portability $datadir/. | tail -n 1 | awk '{ exit ($4>4096) }'; then
|
64
|
+
log_failure_msg "$0: ERROR: The partition with $datadir is too full!"
|
65
|
+
echo "ERROR: The partition with $datadir is too full!" | $ERR_LOGGER
|
66
|
+
exit 1
|
67
|
+
fi
|
68
|
+
}
|
69
|
+
|
70
|
+
## Checks if there is a server running and if so if it is accessible.
|
71
|
+
#
|
72
|
+
# check_alive insists on a pingable server
|
73
|
+
# check_dead also fails if there is a lost mysqld in the process list
|
74
|
+
#
|
75
|
+
# Usage: boolean mysqld_status [check_alive|check_dead] [warn|nowarn]
|
76
|
+
mysqld_status () {
|
77
|
+
ping_output=`$MYADMIN ping 2>&1`; ping_alive=$(( ! $? ))
|
78
|
+
|
79
|
+
ps_alive=0
|
80
|
+
pidfile=`mysqld_get_param pid-file`
|
81
|
+
if [ -f "$pidfile" ] && ps `cat $pidfile` >/dev/null 2>&1; then ps_alive=1; fi
|
82
|
+
|
83
|
+
if [ "$1" = "check_alive" -a $ping_alive = 1 ] ||
|
84
|
+
[ "$1" = "check_dead" -a $ping_alive = 0 -a $ps_alive = 0 ]; then
|
85
|
+
return 0 # EXIT_SUCCESS
|
86
|
+
else
|
87
|
+
if [ "$2" = "warn" ]; then
|
88
|
+
echo -e "$ps_alive processes alive and '$MYADMIN ping' resulted in\n$ping_output\n" | $ERR_LOGGER -p daemon.debug
|
89
|
+
fi
|
90
|
+
return 1 # EXIT_FAILURE
|
91
|
+
fi
|
92
|
+
}
|
93
|
+
|
94
|
+
#
|
95
|
+
# main()
|
96
|
+
#
|
97
|
+
|
98
|
+
case "${1:-''}" in
|
99
|
+
'start')
|
100
|
+
sanity_checks;
|
101
|
+
# Start daemon
|
102
|
+
log_daemon_msg "Starting MySQL database server" "mysqld"
|
103
|
+
if mysqld_status check_alive nowarn; then
|
104
|
+
log_progress_msg "already running"
|
105
|
+
log_end_msg 0
|
106
|
+
else
|
107
|
+
/usr/bin/mysqld_safe --defaults-file="$CONF" --skip-character-set-client-handshake > /dev/null 2>&1 &
|
108
|
+
# 6s was reported in #352070 to be too few when using ndbcluster
|
109
|
+
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14; do
|
110
|
+
sleep 1
|
111
|
+
if mysqld_status check_alive nowarn ; then break; fi
|
112
|
+
log_progress_msg "."
|
113
|
+
done
|
114
|
+
if mysqld_status check_alive warn; then
|
115
|
+
log_end_msg 0
|
116
|
+
# Now start mysqlcheck or whatever the admin wants.
|
117
|
+
output=$(/etc/mysql/debian-start)
|
118
|
+
[ -n "$output" ] && log_action_msg "$output"
|
119
|
+
else
|
120
|
+
log_end_msg 1
|
121
|
+
log_failure_msg "Please take a look at the syslog"
|
122
|
+
fi
|
123
|
+
fi
|
124
|
+
|
125
|
+
;;
|
126
|
+
|
127
|
+
'stop')
|
128
|
+
# * As a passwordless mysqladmin (e.g. via ~/.my.cnf) must be possible
|
129
|
+
# at least for cron, we can rely on it here, too. (although we have
|
130
|
+
# to specify it explicit as e.g. sudo environments points to the normal
|
131
|
+
# users home and not /root)
|
132
|
+
log_daemon_msg "Stopping MySQL database server" "mysqld"
|
133
|
+
if ! mysqld_status check_dead nowarn; then
|
134
|
+
set +e
|
135
|
+
shutdown_out=`$MYADMIN shutdown 2>&1`; r=$?
|
136
|
+
set -e
|
137
|
+
if [ "$r" -ne 0 ]; then
|
138
|
+
log_end_msg 1
|
139
|
+
[ "$VERBOSE" != "no" ] && log_failure_msg "Error: $shutdown_out"
|
140
|
+
log_daemon_msg "Killing MySQL database server by signal" "mysqld"
|
141
|
+
killall -15 mysqld
|
142
|
+
server_down=
|
143
|
+
for i in 1 2 3 4 5 6 7 8 9 10; do
|
144
|
+
sleep 1
|
145
|
+
if mysqld_status check_dead nowarn; then server_down=1; break; fi
|
146
|
+
done
|
147
|
+
if test -z "$server_down"; then killall -9 mysqld; fi
|
148
|
+
fi
|
149
|
+
fi
|
150
|
+
|
151
|
+
if ! mysqld_status check_dead warn; then
|
152
|
+
log_end_msg 1
|
153
|
+
log_failure_msg "Please stop MySQL manually and read /usr/share/doc/mysql-server-5.0/README.Debian.gz!"
|
154
|
+
exit -1
|
155
|
+
else
|
156
|
+
log_end_msg 0
|
157
|
+
fi
|
158
|
+
;;
|
159
|
+
|
160
|
+
'restart')
|
161
|
+
set +e; $SELF stop; set -e
|
162
|
+
$SELF start
|
163
|
+
;;
|
164
|
+
|
165
|
+
'reload'|'force-reload')
|
166
|
+
log_daemon_msg "Reloading MySQL database server" "mysqld"
|
167
|
+
$MYADMIN reload
|
168
|
+
log_end_msg 0
|
169
|
+
;;
|
170
|
+
|
171
|
+
'status')
|
172
|
+
if mysqld_status check_alive nowarn; then
|
173
|
+
log_action_msg "$($MYADMIN version)"
|
174
|
+
else
|
175
|
+
log_action_msg "MySQL is stopped."
|
176
|
+
exit 3
|
177
|
+
fi
|
178
|
+
;;
|
179
|
+
|
180
|
+
*)
|
181
|
+
echo "Usage: $SELF start|stop|restart|reload|force-reload|status"
|
182
|
+
exit 1
|
183
|
+
;;
|
184
|
+
esac
|
185
|
+
|
@@ -0,0 +1,119 @@
|
|
1
|
+
|
2
|
+
class MySQL_Master < Wakame::Service::Resource
|
3
|
+
|
4
|
+
def_attribute :duplicable, false
|
5
|
+
def_attribute :mysqld_basedir, '/home/wakame/mysql'
|
6
|
+
def_attribute :mysqld_server_id, 1
|
7
|
+
def_attribute :mysqld_port, 3306
|
8
|
+
|
9
|
+
def_attribute :ebs_volume, ''
|
10
|
+
def_attribute :ebs_device, '/dev/sdm'
|
11
|
+
def_attribute :ebs_mount_option, 'noatime'
|
12
|
+
|
13
|
+
def basedir
|
14
|
+
File.join(Wakame.config.root_path, 'cluster', 'resources', 'mysql_master')
|
15
|
+
end
|
16
|
+
|
17
|
+
def mysqld_datadir
|
18
|
+
File.expand_path('data', mysqld_basedir)
|
19
|
+
end
|
20
|
+
|
21
|
+
def mysqld_log_bin
|
22
|
+
File.expand_path('mysql-bin.log', mysqld_datadir)
|
23
|
+
end
|
24
|
+
|
25
|
+
def render_config(template)
|
26
|
+
template.cp(%w(init.d/mysql))
|
27
|
+
template.render(%w(conf/my.cnf))
|
28
|
+
template.chmod("init.d/mysql", 0755)
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
def start(svc, action)
|
33
|
+
vm_manipulator = Wakame::VmManipulator.create
|
34
|
+
|
35
|
+
# $ echo "GRANT REPLICATION SLAVE, REPLICATION CLIENT, RELOAD ON *.* TO 'wakame-repl'@'%' IDENTIFIED BY 'wakame-slave';" | /usr/bin/mysql -h#{mysql_master_ip} -uroot
|
36
|
+
|
37
|
+
require 'right_aws'
|
38
|
+
ec2 = RightAws::Ec2.new(Wakame.config.aws_access_key, Wakame.config.aws_secret_key)
|
39
|
+
|
40
|
+
res = ec2.describe_volumes([self.ebs_volume])[0]
|
41
|
+
ec2_instance_id = res[:aws_instance_id]
|
42
|
+
if res[:aws_status] == 'in-use' && ec2_instance_id == svc.agent.attr[:instance_id]
|
43
|
+
# Nothin to be done
|
44
|
+
elsif res[:aws_status] == 'in-use' && ec2_instance_id != svc.agent.attr[:instance_id]
|
45
|
+
ec2.detach_volume(self.ebs_volume)
|
46
|
+
cond = ConditionalWait.new { |c|
|
47
|
+
c.poll {
|
48
|
+
res1 = ec2.describe_volumes([self.ebs_volume])[0]
|
49
|
+
res1[:aws_status] == 'available'
|
50
|
+
}
|
51
|
+
}
|
52
|
+
cond.wait
|
53
|
+
|
54
|
+
ec2.attach_volume(self.ebs_volume, svc.agent.attr[:instance_id], self.ebs_device)
|
55
|
+
cond = ConditionalWait.new { |c|
|
56
|
+
c.poll {
|
57
|
+
res1 = ec2.describe_volumes([self.ebs_volume])[0]
|
58
|
+
res1[:aws_status] == 'in-use'
|
59
|
+
}
|
60
|
+
}
|
61
|
+
cond.wait
|
62
|
+
|
63
|
+
elsif res[:aws_status] == 'available'
|
64
|
+
ec2.attach_volume(self.ebs_volume, svc.agent.attr[:instance_id], self.ebs_device)
|
65
|
+
cond = ConditionalWait.new { |c|
|
66
|
+
c.poll {
|
67
|
+
res1 = ec2.describe_volumes([self.ebs_volume])[0]
|
68
|
+
res1[:aws_status] == 'in-use'
|
69
|
+
}
|
70
|
+
}
|
71
|
+
cond.wait
|
72
|
+
|
73
|
+
end
|
74
|
+
|
75
|
+
cond = ConditionalWait.new { |cond|
|
76
|
+
cond.wait_event(Wakame::Event::ServiceOnline) { |event|
|
77
|
+
event.instance_id == svc.instance_id
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
action.actor_request(svc.agent.agent_id,
|
82
|
+
'/service_monitor/register',
|
83
|
+
svc.instance_id,
|
84
|
+
:command, "/usr/bin/mysqladmin --defaults-file=#{svc.agent.root_path}/tmp/config/mysql_master/conf/my.cnf ping > /dev/null") { |req|
|
85
|
+
}
|
86
|
+
|
87
|
+
action.actor_request(svc.agent.agent_id, '/system/mount', self.ebs_device, self.mysqld_datadir, self.ebs_mount_option) { |req|
|
88
|
+
req.wait
|
89
|
+
Wakame.log.debug("MySQL volume was mounted: #{self.mysqld_datadir}")
|
90
|
+
}
|
91
|
+
|
92
|
+
action.actor_request(svc.agent.agent_id, '/daemon/start', 'mysql_master', 'init.d/mysql') { |req|
|
93
|
+
req.wait
|
94
|
+
Wakame.log.debug("MySQL process started")
|
95
|
+
}
|
96
|
+
|
97
|
+
cond.wait
|
98
|
+
end
|
99
|
+
|
100
|
+
def stop(svc, action)
|
101
|
+
cond = ConditionalWait.new { |cond|
|
102
|
+
cond.wait_event(Wakame::Event::ServiceOffline) { |event|
|
103
|
+
event.instance_id == svc.instance_id
|
104
|
+
}
|
105
|
+
}
|
106
|
+
|
107
|
+
action.actor_request(svc.agent.agent_id, '/daemon/stop', 'mysql_master', 'init.d/mysql') { |req| req.wait }
|
108
|
+
action.actor_request(svc.agent.agent_id, '/system/umount', self.mysqld_datadir) { |req|
|
109
|
+
req.wait
|
110
|
+
Wakame.log.debug("MySQL volume unmounted")
|
111
|
+
}
|
112
|
+
|
113
|
+
cond.wait
|
114
|
+
|
115
|
+
action.actor_request(svc.agent.agent_id,
|
116
|
+
'/service_monitor/unregister',
|
117
|
+
svc.instance_id).request
|
118
|
+
end
|
119
|
+
end
|
metadata
ADDED
@@ -0,0 +1,289 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: wakame
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.4.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- axsh co.,Ltd.
|
8
|
+
- Masahiro Fujiwara
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2009-06-26 00:00:00 +09:00
|
14
|
+
default_executable: wakame
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: amqp
|
18
|
+
type: :runtime
|
19
|
+
version_requirement:
|
20
|
+
version_requirements: !ruby/object:Gem::Requirement
|
21
|
+
requirements:
|
22
|
+
- - ">="
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 0.6.0
|
25
|
+
version:
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: amazon-ec2
|
28
|
+
type: :runtime
|
29
|
+
version_requirement:
|
30
|
+
version_requirements: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 0.3.6
|
35
|
+
version:
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: right_aws
|
38
|
+
type: :runtime
|
39
|
+
version_requirement:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: 1.10.0
|
45
|
+
version:
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: eventmachine
|
48
|
+
type: :runtime
|
49
|
+
version_requirement:
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.12.8
|
55
|
+
version:
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: rake
|
58
|
+
type: :runtime
|
59
|
+
version_requirement:
|
60
|
+
version_requirements: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: 0.8.7
|
65
|
+
version:
|
66
|
+
- !ruby/object:Gem::Dependency
|
67
|
+
name: log4r
|
68
|
+
type: :runtime
|
69
|
+
version_requirement:
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 1.0.5
|
75
|
+
version:
|
76
|
+
- !ruby/object:Gem::Dependency
|
77
|
+
name: daemons
|
78
|
+
type: :runtime
|
79
|
+
version_requirement:
|
80
|
+
version_requirements: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: 1.0.10
|
85
|
+
version:
|
86
|
+
- !ruby/object:Gem::Dependency
|
87
|
+
name: rubigen
|
88
|
+
type: :runtime
|
89
|
+
version_requirement:
|
90
|
+
version_requirements: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: 1.5.2
|
95
|
+
version:
|
96
|
+
- !ruby/object:Gem::Dependency
|
97
|
+
name: jeweler
|
98
|
+
type: :runtime
|
99
|
+
version_requirement:
|
100
|
+
version_requirements: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: 1.0.0
|
105
|
+
version:
|
106
|
+
description: ""
|
107
|
+
email:
|
108
|
+
- m-fujiwara@axsh.net
|
109
|
+
executables:
|
110
|
+
- wakame
|
111
|
+
extensions: []
|
112
|
+
|
113
|
+
extra_rdoc_files:
|
114
|
+
- README.rdoc
|
115
|
+
files:
|
116
|
+
- History.txt
|
117
|
+
- README.rdoc
|
118
|
+
- Rakefile
|
119
|
+
- VERSION
|
120
|
+
- app_generators/wakame/templates/README
|
121
|
+
- app_generators/wakame/templates/Rakefile
|
122
|
+
- app_generators/wakame/templates/bin/wakame-agent
|
123
|
+
- app_generators/wakame/templates/bin/wakame-master
|
124
|
+
- app_generators/wakame/templates/bin/wakameadm
|
125
|
+
- app_generators/wakame/templates/cluster/resources/apache_app/apache_app.rb
|
126
|
+
- app_generators/wakame/templates/cluster/resources/apache_app/conf/apache2.conf
|
127
|
+
- app_generators/wakame/templates/cluster/resources/apache_app/conf/envvars-app
|
128
|
+
- app_generators/wakame/templates/cluster/resources/apache_app/conf/sites-app.conf
|
129
|
+
- app_generators/wakame/templates/cluster/resources/apache_app/conf/system-app.conf
|
130
|
+
- app_generators/wakame/templates/cluster/resources/apache_app/init.d/apache2-app
|
131
|
+
- app_generators/wakame/templates/cluster/resources/apache_lb/apache_lb.rb
|
132
|
+
- app_generators/wakame/templates/cluster/resources/apache_lb/conf/apache2.conf
|
133
|
+
- app_generators/wakame/templates/cluster/resources/apache_lb/conf/envvars-lb
|
134
|
+
- app_generators/wakame/templates/cluster/resources/apache_lb/conf/sites-lb.conf
|
135
|
+
- app_generators/wakame/templates/cluster/resources/apache_lb/conf/system-lb.conf
|
136
|
+
- app_generators/wakame/templates/cluster/resources/apache_lb/init.d/apache2-lb
|
137
|
+
- app_generators/wakame/templates/cluster/resources/apache_www/apache_www.rb
|
138
|
+
- app_generators/wakame/templates/cluster/resources/apache_www/conf/apache2.conf
|
139
|
+
- app_generators/wakame/templates/cluster/resources/apache_www/conf/envvars-www
|
140
|
+
- app_generators/wakame/templates/cluster/resources/apache_www/conf/sites-www.conf
|
141
|
+
- app_generators/wakame/templates/cluster/resources/apache_www/conf/system-www.conf
|
142
|
+
- app_generators/wakame/templates/cluster/resources/apache_www/init.d/apache2-www
|
143
|
+
- app_generators/wakame/templates/cluster/resources/ec2_elastic_ip/ec2_elastic_ip.rb
|
144
|
+
- app_generators/wakame/templates/cluster/resources/mysql_master/conf/my.cnf
|
145
|
+
- app_generators/wakame/templates/cluster/resources/mysql_master/init.d/mysql
|
146
|
+
- app_generators/wakame/templates/cluster/resources/mysql_master/mysql_master.rb
|
147
|
+
- app_generators/wakame/templates/config/boot.rb
|
148
|
+
- app_generators/wakame/templates/config/cluster.rb
|
149
|
+
- app_generators/wakame/templates/config/environments/common.rb
|
150
|
+
- app_generators/wakame/templates/config/environments/ec2.rb
|
151
|
+
- app_generators/wakame/templates/config/environments/stand_alone.rb
|
152
|
+
- app_generators/wakame/templates/config/init.d/wakame-agent
|
153
|
+
- app_generators/wakame/templates/config/init.d/wakame-master
|
154
|
+
- app_generators/wakame/wakame_generator.rb
|
155
|
+
- bin/wakame
|
156
|
+
- contrib/imagesetup.sh
|
157
|
+
- lib/ext/eventmachine.rb
|
158
|
+
- lib/ext/shellwords.rb
|
159
|
+
- lib/ext/uri.rb
|
160
|
+
- lib/wakame.rb
|
161
|
+
- lib/wakame/action.rb
|
162
|
+
- lib/wakame/actions/destroy_instances.rb
|
163
|
+
- lib/wakame/actions/launch_cluster.rb
|
164
|
+
- lib/wakame/actions/migrate_service.rb
|
165
|
+
- lib/wakame/actions/propagate_instances.rb
|
166
|
+
- lib/wakame/actions/reload_service.rb
|
167
|
+
- lib/wakame/actions/scaleout_when_high_load.rb
|
168
|
+
- lib/wakame/actions/shutdown_cluster.rb
|
169
|
+
- lib/wakame/actions/shutdown_vm.rb
|
170
|
+
- lib/wakame/actions/start_service.rb
|
171
|
+
- lib/wakame/actions/stop_service.rb
|
172
|
+
- lib/wakame/actions/util.rb
|
173
|
+
- lib/wakame/actor.rb
|
174
|
+
- lib/wakame/actor/daemon.rb
|
175
|
+
- lib/wakame/actor/service_monitor.rb
|
176
|
+
- lib/wakame/actor/system.rb
|
177
|
+
- lib/wakame/agent.rb
|
178
|
+
- lib/wakame/amqp_client.rb
|
179
|
+
- lib/wakame/command.rb
|
180
|
+
- lib/wakame/command/action_status.rb
|
181
|
+
- lib/wakame/command/actor.rb
|
182
|
+
- lib/wakame/command/clone_service.rb
|
183
|
+
- lib/wakame/command/launch_cluster.rb
|
184
|
+
- lib/wakame/command/migrate_service.rb
|
185
|
+
- lib/wakame/command/propagate_service.rb
|
186
|
+
- lib/wakame/command/shutdown_cluster.rb
|
187
|
+
- lib/wakame/command/status.rb
|
188
|
+
- lib/wakame/command_queue.rb
|
189
|
+
- lib/wakame/configuration.rb
|
190
|
+
- lib/wakame/daemonize.rb
|
191
|
+
- lib/wakame/event.rb
|
192
|
+
- lib/wakame/event_dispatcher.rb
|
193
|
+
- lib/wakame/graph.rb
|
194
|
+
- lib/wakame/initializer.rb
|
195
|
+
- lib/wakame/instance_counter.rb
|
196
|
+
- lib/wakame/logger.rb
|
197
|
+
- lib/wakame/manager/commands.rb
|
198
|
+
- lib/wakame/master.rb
|
199
|
+
- lib/wakame/monitor.rb
|
200
|
+
- lib/wakame/monitor/agent.rb
|
201
|
+
- lib/wakame/monitor/service.rb
|
202
|
+
- lib/wakame/packets.rb
|
203
|
+
- lib/wakame/queue_declare.rb
|
204
|
+
- lib/wakame/rule.rb
|
205
|
+
- lib/wakame/rule_engine.rb
|
206
|
+
- lib/wakame/runner/administrator_command.rb
|
207
|
+
- lib/wakame/runner/agent.rb
|
208
|
+
- lib/wakame/runner/master.rb
|
209
|
+
- lib/wakame/scheduler.rb
|
210
|
+
- lib/wakame/service.rb
|
211
|
+
- lib/wakame/template.rb
|
212
|
+
- lib/wakame/trigger.rb
|
213
|
+
- lib/wakame/triggers/instance_count_update.rb
|
214
|
+
- lib/wakame/triggers/load_history.rb
|
215
|
+
- lib/wakame/triggers/maintain_ssh_known_hosts.rb
|
216
|
+
- lib/wakame/triggers/process_command.rb
|
217
|
+
- lib/wakame/triggers/shutdown_unused_vm.rb
|
218
|
+
- lib/wakame/util.rb
|
219
|
+
- lib/wakame/vm_manipulator.rb
|
220
|
+
- tasks/ec2.rake
|
221
|
+
- tests/cluster.json
|
222
|
+
- tests/conf/a
|
223
|
+
- tests/conf/b
|
224
|
+
- tests/conf/c
|
225
|
+
- tests/setup_agent.rb
|
226
|
+
- tests/setup_master.rb
|
227
|
+
- tests/test_actor.rb
|
228
|
+
- tests/test_agent.rb
|
229
|
+
- tests/test_amqp_client.rb
|
230
|
+
- tests/test_graph.rb
|
231
|
+
- tests/test_master.rb
|
232
|
+
- tests/test_monitor.rb
|
233
|
+
- tests/test_rule_engine.rb
|
234
|
+
- tests/test_scheduler.rb
|
235
|
+
- tests/test_service.rb
|
236
|
+
- tests/test_template.rb
|
237
|
+
- tests/test_uri_amqp.rb
|
238
|
+
- tests/test_util.rb
|
239
|
+
- wakame_generators/resource/resource_generator.rb
|
240
|
+
- wakame_generators/resource/templates/apache_app/apache_app.rb
|
241
|
+
- wakame_generators/resource/templates/apache_app/conf/apache2.conf
|
242
|
+
- wakame_generators/resource/templates/apache_app/conf/envvars-app
|
243
|
+
- wakame_generators/resource/templates/apache_app/conf/sites-app.conf
|
244
|
+
- wakame_generators/resource/templates/apache_app/conf/system-app.conf
|
245
|
+
- wakame_generators/resource/templates/apache_app/init.d/apache2-app
|
246
|
+
- wakame_generators/resource/templates/apache_lb/apache_lb.rb
|
247
|
+
- wakame_generators/resource/templates/apache_lb/conf/apache2.conf
|
248
|
+
- wakame_generators/resource/templates/apache_lb/conf/envvars-lb
|
249
|
+
- wakame_generators/resource/templates/apache_lb/conf/sites-lb.conf
|
250
|
+
- wakame_generators/resource/templates/apache_lb/conf/system-lb.conf
|
251
|
+
- wakame_generators/resource/templates/apache_lb/init.d/apache2-lb
|
252
|
+
- wakame_generators/resource/templates/apache_www/apache_www.rb
|
253
|
+
- wakame_generators/resource/templates/apache_www/conf/apache2.conf
|
254
|
+
- wakame_generators/resource/templates/apache_www/conf/envvars-www
|
255
|
+
- wakame_generators/resource/templates/apache_www/conf/sites-www.conf
|
256
|
+
- wakame_generators/resource/templates/apache_www/conf/system-www.conf
|
257
|
+
- wakame_generators/resource/templates/apache_www/init.d/apache2-www
|
258
|
+
- wakame_generators/resource/templates/ec2_elastic_ip/ec2_elastic_ip.rb
|
259
|
+
- wakame_generators/resource/templates/mysql_master/conf/my.cnf
|
260
|
+
- wakame_generators/resource/templates/mysql_master/init.d/mysql
|
261
|
+
- wakame_generators/resource/templates/mysql_master/mysql_master.rb
|
262
|
+
has_rdoc: true
|
263
|
+
homepage: http://wakame.rubyforge.org/
|
264
|
+
post_install_message:
|
265
|
+
rdoc_options:
|
266
|
+
- --charset=UTF-8
|
267
|
+
require_paths:
|
268
|
+
- lib
|
269
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
270
|
+
requirements:
|
271
|
+
- - ">="
|
272
|
+
- !ruby/object:Gem::Version
|
273
|
+
version: "0"
|
274
|
+
version:
|
275
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
276
|
+
requirements:
|
277
|
+
- - ">="
|
278
|
+
- !ruby/object:Gem::Version
|
279
|
+
version: "0"
|
280
|
+
version:
|
281
|
+
requirements: []
|
282
|
+
|
283
|
+
rubyforge_project: wakame
|
284
|
+
rubygems_version: 1.3.1
|
285
|
+
signing_key:
|
286
|
+
specification_version: 2
|
287
|
+
summary: A distributed service framework on top of Cloud environments.
|
288
|
+
test_files: []
|
289
|
+
|