Skip to content

Instantly share code, notes, and snippets.

@dawngerpony
Last active July 13, 2016 12:26
Show Gist options
  • Select an option

  • Save dawngerpony/58d9cd44d4f033a7094ebdae67452585 to your computer and use it in GitHub Desktop.

Select an option

Save dawngerpony/58d9cd44d4f033a7094ebdae67452585 to your computer and use it in GitHub Desktop.
Useful Neo4j CoCo commands
#!/bin/bash
while true; do
echo -n "RED: "; fleetctl ssh [email protected] uptime
echo -n "BLUE: "; fleetctl ssh [email protected] uptime
sleep 15
done
[email protected] 177bf386.../172.24.99.92 inactive dead
[email protected] 177bf386.../172.24.99.92 active running
[email protected] 177bf386.../172.24.99.92 inactive dead
[email protected] 07c72444.../172.24.151.154 active exited
[email protected] 07c72444.../172.24.151.154 inactive dead
[email protected] 07c72444.../172.24.151.154 active running
## measure resource usage on CoreOS box running Neo4j red.
fleetctl ssh [email protected] top
## Check the status of all sidekick processes
fleetctl list-units | grep ^neo | grep sidekick | awk '{print $1;}' | xargs -I '{}' fleetctl status {}
## Stop all sidekick processes
fleetctl list-units | grep ^neo | grep sidekick | awk '{print $1;}' | xargs -I '{}' fleetctl stop {}
## Capture the load average of both neo4j boxes every 10 seconds ad infinitum
while true; do echo -n "RED: "; fleetctl ssh [email protected] uptime; echo -n "BLUE: "; fleetctl ssh [email protected] uptime; sleep 10; done
## Moving the above script into its own file I can use tee to capture the output and send it to console as well for convenience.
./monitor-load.bash | tee load-average.out
## List all services that interact with Neo4j (read/writers and public API services, exclude sidekicks)
fleetctl list-units | egrep '(\-rw\-red|\-rw\-neo4j\-red|public\-[a-z]+\-api)' | grep -v sidekick
## Shut down all the above Neo4j-related services.
fleetctl list-units | egrep '(\-rw\-red|\-rw\-neo4j\-red|public\-[a-z]+\-api)' | grep -v sidekick | awk '{print $1;}' | xargs -I '{}' fleetctl stop {}
@dawngerpony
Copy link
Author

@dawngerpony
Copy link
Author

Starting public-api services:

fleetctl list-units | egrep '(public\-[a-z]+\-api)' | grep -v sidekick | awk '{print $1;}' | xargs -I '{}' fleetctl start {}

Checking status of rw/public-api services:

fleetctl list-units | egrep '(\-rw\-red|\-rw\-neo4j\-red|public\-[a-z]+\-api)' | grep -v sidekick | awk '{print $1;}' | xargs -I '{}' fleetctl status {} | egrep '( - |Active:)'

@dawngerpony
Copy link
Author

Starting all neo4j r/w services:

$ fleetctl list-units | egrep '(\-rw\-red|\-rw\-neo4j\-red)' | grep -v sidekick | awk '{print $1;}' | xargs -I '{}' fleetctl start {}
Unit [email protected] launched on 177bf386.../172.24.99.92
Unit [email protected] launched on 5dfe683f.../172.24.78.235
Unit [email protected] launched on 5e5b2ea8.../172.24.135.151
Unit [email protected] launched on 5e5b2ea8.../172.24.135.151
Unit [email protected] launched on 177bf386.../172.24.99.92
Unit [email protected] launched on 5e5b2ea8.../172.24.135.151
Unit [email protected] launched on 177bf386.../172.24.99.92
Unit [email protected] launched on 973adfff.../172.24.2.162
Unit [email protected] launched on 5dfe683f.../172.24.78.235
Unit [email protected] launched on 973adfff.../172.24.2.162
Unit [email protected] launched on 177bf386.../172.24.99.92
Unit [email protected] launched on 5dfe683f.../172.24.78.235
Unit [email protected] launched on 973adfff.../172.24.2.162
Unit [email protected] launched on 973adfff.../172.24.2.162
Unit [email protected] launched on 177bf386.../172.24.99.92
Unit [email protected] launched on 5e5b2ea8.../172.24.135.151
Unit [email protected] launched on 973adfff.../172.24.2.162
Unit [email protected] launched on 177bf386.../172.24.99.92
Unit [email protected] launched on 5e5b2ea8.../172.24.135.151
Unit [email protected] launched on 973adfff.../172.24.2.162
Unit [email protected] launched on 5e5b2ea8.../172.24.135.151
Unit [email protected] launched on 177bf386.../172.24.99.92
Unit [email protected] launched on 5e5b2ea8.../172.24.135.151
Unit [email protected] launched on 973adfff.../172.24.2.162
Unit [email protected] launched on 177bf386.../172.24.99.92
Unit [email protected] launched on 5dfe683f.../172.24.78.235
Unit [email protected] launched on 973adfff.../172.24.2.162

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment