def app_exposure(self, app, r): ''' Returns a reachable (host, port) pair that the app can be reached at ''' for node_id, role in app.nodes.iteritems(): if role == 'master': node = MonacoNode(node_id=node_id) node.refresh(r) return (node.FQDN, app.port) return None
from schema import Monaco, MonacoNode, MONACO_NEXT_APP_ID, MONACO_NEXT_TWEM_ID, MIN_APP_ID, MIN_TWEM_ID from redismgmt import RedisMgmt if __name__ == '__main__': rmgr = RedisMgmt() if len(sys.argv) == 1: # New cluster case # (Re)start the mgmt db, set as master, initialize this node as node_id=1, and launch monaco rmgr.restart_instance(app_id='mgmt') r = StrictRedis(port=config.config['mgmt_port']) r.slaveof() r.set(MONACO_NEXT_APP_ID, MIN_APP_ID) r.set(MONACO_NEXT_TWEM_ID, MIN_TWEM_ID) monaco = Monaco() node = MonacoNode(node_id='1') node.refresh(r) # not expecting anything node.hostname = config.config['hostname'] node.FQDN = config.config['IP'] node.write(r) monaco.new_node(node, r) proc = subprocess.Popen( ['start', 'monaco'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, ) (out, err) = proc.communicate() if proc.wait() != 0: print out, err sys.exit(1)
from redismgmt import RedisMgmt if __name__ == "__main__": rmgr = RedisMgmt() if len(sys.argv) == 1: # New cluster case # (Re)start the mgmt db, set as master, initialize this node as node_id=1, and launch monaco rmgr.restart_instance(app_id="mgmt") r = StrictRedis(port=config.config["mgmt_port"]) r.slaveof() r.set(MONACO_NEXT_APP_ID, MIN_APP_ID) r.set(MONACO_NEXT_TWEM_ID, MIN_TWEM_ID) monaco = Monaco() node = MonacoNode(node_id="1") node.refresh(r) # not expecting anything node.hostname = config.config["hostname"] node.FQDN = config.config["IP"] node.write(r) monaco.new_node(node, r) proc = subprocess.Popen(["start", "monaco"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) (out, err) = proc.communicate() if proc.wait() != 0: print out, err sys.exit(1) print "The node details should be edited from the Web Interface to set memory capacity before use" elif len(sys.argv) == 3: