Permalink
Browse files

need to commit/push more often

  • Loading branch information...
1 parent 455b533 commit 7ecb77ad7ceaf2391805ef7b25af6b3aea6c99d3 @truthtrap truthtrap committed Apr 16, 2012
Showing with 21 additions and 7 deletions.
  1. +2 −2 decommission.py
  2. +1 −0 monitor.py
  3. +12 −3 prepare.py
  4. +6 −2 remaster.py
View
@@ -69,8 +69,8 @@ def log(message, logging='warning'):
log('remove redis.conf', 'info')
os.system("/bin/rm -f /etc/redis/redis.conf")
# and empty the cron as well
- log('empty the cron', 'info')
- os.system("/bin/echo | /usr/bin/crontab")
+ #log('empty the cron', 'info')
+ #os.system("/bin/echo | /usr/bin/crontab")
# make sure we make a clean AMI, with all monit checks monitored
log("finally, monitor all (monit), but 'redis' and slave", 'info')
View
@@ -251,6 +251,7 @@ def put(self):
if monitoring in ['on', 'all']:
# first get all we need
[names, values, units, dimensions] = self.collect(monitoring)
+ print [names, values, units, dimensions]
while len(names) > 0:
names20 = names[:20]
values20 = values[:20]
View
@@ -57,7 +57,7 @@ def log(message, logging='warning'):
# we are going to work with local files, we need our path
path = os.path.dirname(os.path.abspath(__file__))
-def provision(key, access, cluster, size, maxmemory = -1, persistence="no", snapshot=None, rdb=None):
+def provision(key, access, cluster, size, maxmemory=-1, policy=None, persistence="no", snapshot=None, rdb=None):
log('start provisioning', 'info')
# ec2 is region specific
region_info = RegionInfo(name=region,
@@ -130,6 +130,9 @@ def prepare():
if maxmemory > 0:
os.system("/bin/sed 's/^# maxmemory <bytes>.*$/maxmemory {0}/' -i {1}".format(maxmemory, dst))
+ if policy != None:
+ os.system("/bin/sed 's/^# maxmemory-policy.*$/maxmemory-policy {0}/' -i {1}".format(policy, dst))
+
# and root's cron will be set accordingly as well
log('setting up cron', 'info')
os.system("/bin/sed 's:INSTALLPATH:{0}:' {1} | /usr/bin/crontab".format(path, cron))
@@ -200,9 +203,15 @@ def meminfo():
rdb = None
maxmemory = -1
+ policy = None
try:
if userdata['maxmemory'] == 'on':
maxmemory = int(0.6 * (meminfo()['MemTotal'] * 1024))
+
+ try:
+ policy = userdata['maxmemory-policy']
+ except:
+ pass
except:
pass
@@ -211,5 +220,5 @@ def meminfo():
# Usefult for playing around with this project
size = 5 if size == 0 else size
- provision(sys.argv[1], sys.argv[2], cluster, size, maxmemory,
- persistence=persistence, snapshot=snapshot, rdb=rdb)
+ provision(sys.argv[1], sys.argv[2], cluster, size, maxmemory, policy,
+ persistence=persistence, snapshot=snapshot, rdb=rdb)
View
@@ -66,12 +66,16 @@ def log(message, logging='info'):
if link_status != "up":
log('how long are we down?', 'info')
link_down_since_seconds = info['master_link_down_since_seconds']
+ master_sync_in_progress = info['master_sync_in_progress']
- down = (link_down_since_seconds > 30)
+ # if not syncing, and link down longer than 30s
+ down = ((master_sync_in_progress == 0) and
+ (link_down_since_seconds > 30))
else:
down = False
+
except Exception as e:
- log('we are down, or we were master, in case we should not be here ', 'info')
+ log('master are down, or we were master, in any case we should not be here ', 'info')
down = True
if down:

0 comments on commit 7ecb77a

Please sign in to comment.