def configure_topology(): CASSANDRA_CONFIG_TOPOLOGY = '/etc/cassandra/cassandra-topology.properties' if exists(CASSANDRA_CONFIG_TOPOLOGY): run('rm ' + CASSANDRA_CONFIG_TOPOLOGY) for host in env.all_hosts: append(CASSANDRA_CONFIG_TOPOLOGY, extract_host(host) + '=DC1:RAC1')
def configure_cluster(): sed("/etc/mongodb.conf", ".*replSet =.*", "replSet = eventually") run("service mongodb restart") # the cluster has to be configured on only one node if env.host == extract_host(env.roledefs["db"][0]): rsconf = {"_id": "eventually", "version": 1, "members": []} id = 0 for machine in env.roledefs["db"]: host = extract_host(machine) host_conf = {"_id": id, "host": host} rsconf["members"].append(host_conf) id += 1 if exists("/tmp/init_repl_set.js"): run("rm /tmp/init_repl_set.js") append("/tmp/init_repl_set.js", "rs.initiate();") append("/tmp/init_repl_set.js", "rsconf = " + json.dumps(rsconf)) append("/tmp/init_repl_set.js", "rs.reconfig(rsconf, {force:true});") append("/tmp/init_repl_set.js", "rs.status();") run("mongo < /tmp/init_repl_set.js")
def configure_cluster(): sed('/etc/mongodb.conf', '.*replSet =.*', 'replSet = eventually') run('service mongodb restart') # the cluster has to be configured on only one node if env.host == extract_host(env.roledefs['db'][0]): rsconf = {"_id": "eventually", "version": 1, "members": []} id = 0 for machine in env.roledefs['db']: host = extract_host(machine) host_conf = {"_id": id, "host": host} rsconf['members'].append(host_conf) id += 1 if exists('/tmp/init_repl_set.js'): run('rm /tmp/init_repl_set.js') append('/tmp/init_repl_set.js', 'rs.initiate();') append('/tmp/init_repl_set.js', 'rsconf = ' + json.dumps(rsconf)) append('/tmp/init_repl_set.js', 'rs.reconfig(rsconf, {force:true});') append('/tmp/init_repl_set.js', 'rs.status();') run('mongo < /tmp/init_repl_set.js')
def configure_seeds(): sed(CASSANDRA_CONFIG_FILE, '- seeds: ".*"', '- seeds: "' + extract_host(env.all_hosts[0]) + '"')