On a mac this works (different sed, use an actual newline): " nodetool info -T | grep ^Token | awk '{ print $3 }' | tr \\n , | sed -e 's/,$/\ >/' "
Otherwise the last token will have an 'n' appended which you may not notice. On Fri, Dec 5, 2014 at 4:34 PM, Robert Coli <rc...@eventbrite.com> wrote: > On Wed, Dec 3, 2014 at 10:10 AM, Robert Wille <rwi...@fold3.com> wrote: > >> Load and ownership didn’t correlate nearly as well as I expected. I have >> lots and lots of very small records. I would expect very high correlation. >> >> I think the moral of the story is that I shouldn’t delete the system >> directory. If I have issues with a node, I should recommission it properly. >> > > If you always specify initial_token in cassandra.yaml, then you are > protected from some cases similar to the one that you seem to have just > encountered. > > Wish I had actually managed to post this on a blog, but : > > > --- cut --- > > example of why : > > https://issues.apache.org/jira/browse/CASSANDRA-5571 > > 11:22 < rcoli> but basically, explicit is better than implicit > 11:22 < rcoli> the only reason ppl let cassandra pick tokens is that it's > semi-complex to do "right" with vnodes > 11:22 < rcoli> but once it has picked tokens > 11:22 < rcoli> you know what they are > 11:22 < rcoli> why have a risky conf file that relies on implicit state? > 11:23 < rcoli> just put the tokens in the conf file. done. > 11:23 < rcoli> then you can use auto_bootstrap:false even if you lose > system keyspace, etc. > > I plan to write a short blog post about this, but... > > I recommend that anyone using Cassandra, vnodes or not, always explicitly > populate their initial_token line in cassandra.yaml. There are a number of > cases where you will lose if you do not do so, and AFAICT no cases where > you lose by doing so. > > If one is using vnodes and wants to do this, the process goes like : > > 1) set num_tokens to the desired number of vnodes > 2) start node/bootstrap > 3) use a one liner like jeffj's : > > " > nodetool info -T | grep ^Token | awk '{ print $3 }' | tr \\n , | sed -e > 's/,$/\n/' > " > > to get a comma delimited list of the vnode tokens > > 4) insert this comma delimited list in initial_tokens, and comment out > num_tokens (though it is a NOOP) > > --- cut --- > > =Rob > >