Skip to content

Instantly share code, notes, and snippets.

@ibspoof
Created August 1, 2016 21:04
Show Gist options
  • Select an option

  • Save ibspoof/a50475d5c629ea703b3265505a8c0b3f to your computer and use it in GitHub Desktop.

Select an option

Save ibspoof/a50475d5c629ea703b3265505a8c0b3f to your computer and use it in GitHub Desktop.

Revisions

  1. ibspoof created this gist Aug 1, 2016.
    40 changes: 40 additions & 0 deletions fabulous_file_for_cb.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,40 @@
    from fabric.api import *
    from fabric.api import env
    import time
    import re


    # env.hosts = ['10.200.20.146', '10.200.20.156', '10.200.20.168', '10.200.20.154']
    env.hosts = ['10.200.20.158', '10.200.20.146', '10.200.20.156', '10.200.20.168', '10.200.20.154']

    env.user = 'datastax'
    env.password = 'datastax'

    seed = '10.200.20.158'

    @parallel
    def clean_dse():
    # run("ps aux | grep cassandra")
    sudo("service dse stop")
    sudo("rm -rf /var/lib/cassandra/*/*")
    #run("ls -la")

    @parallel
    def boot_dse():
    sudo("service dse start")


    @parallel
    def update_seed():
    sudo("sed --follow-symlinks -i 's# - seeds: .*# - seeds: \"" + seed + "\"#g' /etc/dse/cassandra/cassandra.yaml")


    def tail_log():
    sudo("tail -100 /var/log/cassandra/system.log")
    time.sleep(1)


    def is_launched():
    output = run("nodetool status")
    if (re.search('127.0.0.1', output) > -1):
    print "this node is down"