basho-labs / puppet-riak

A puppet module to deploy Riak clusters
Apache License 2.0
33 stars 37 forks source link

riak-admin automation options #62

Open danieldreier opened 9 years ago

danieldreier commented 9 years ago

I'm hoping to write types and providers in puppet that wrap riak-admin, for the purpose of automating cluster management operations. For example, we could change ring size in the live cluster, change config files, etc and do that all in the correct order automatically to avoid user error in manual change. Similarly, it would be great to automate the process of joining new nodes to a cluster, safely removing nodes, etc.

I'd really appreciate any input on other automation-friendly options for interacting with the functionality provided by riak-admin. I can't find analogous HTTP API endpoints, can't find a way to get JSON (or other structured output) from riak-admin, etc.

The two options I see are to either wrap riak-admin and parse the text output, or to improve my very basic erlang skills and use whatever libraries riak-admin uses to implement the functionality I need. However, the latter is likely to involve months of me learning a new language before I'm productive, and the former is a bit awkward, though common enough in the puppet world.

Are those the only options?

mbbroberg commented 9 years ago

The short answer is no, there is no HTTP API endpoints for admin.

The longer.. messier answer is that there are an undocumented few commands that have a --format flag, including cluster status. You can choose --format=csv or --format=json.

The trick is I have no idea which ones support it yet.. I have to dive into code and don't have the bandwidth to do so at the moment. Just FYI and we can research this further.

danieldreier commented 9 years ago

That's actually quite helpful. I'll just experiment as I go and see if the commands support the --format=json parameter. Do you know if that's intended as a reasonably stable interface? If it's deprecated or otherwise likely to disappear I'd just as soon not use it, since it looks like I'll have to implement some amount of text parsing anyway. (or maybe take the opportunity to learn some Erlang?)

Don't stress over the weekend, though - not a rush.

andrewjstone commented 9 years ago

@danieldreier It's a brand new interface actually, built upon clique. The goal is to move over all status to use it eventually, but that timeline is very uncertain and no-one is working on moving other things forward at the moment.

danieldreier commented 9 years ago

@andrewjstone that's awesome - thanks for pointing me to it. I was just looking around the other day to see what options there are for building CLI tools in Erlang and I didn't notice clique.