cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gerard Maas <gerard.m...@gmail.com>
Subject Re: Best way to get Cassandra status in Bash
Date Mon, 04 Jan 2016 14:51:23 GMT
(Hit enter too fast)

In particular, `nodetool status` will give you a summary of the status of
the cluster. See the documentation for the parameters it takes.

-kr, Gerard.

On Mon, Jan 4, 2016 at 3:49 PM, Gerard Maas <gerard.maas@gmail.com> wrote:

> I think you are looking for the nodetool utility:
> https://docs.datastax.com/en/cassandra/2.1/cassandra/tools/toolsNodetool_r.html
>
> On Mon, Jan 4, 2016 at 1:47 PM, Giovanni Usai <
> giovanni.usai@francelabs.com> wrote:
>
>> Hello,
>> I would gladly welcome the help of the community on the following issue I
>> am having while starting Cassandra.
>>
>> I am starting Cassandra by a Bash script in this way:
>>
>> - $CASSANDRA_HOME/bin/cassandra -p $CASSANDRA_PID_FILE
>> and then, I submit some updates via
>> - $CASSANDRA_HOME/bin/cqlsh -f
>> $DATAFARI_HOME/bin/common/config/cassandra/tables
>>
>> => First question: is it a good idea? Or, are there better ways to do
>> start Cassandra?
>>
>>
>> If it is a good idea to use Bash, this is my need: when something goes
>> wrong (e.g. privileges issue on  Cassandra's data directory, etc), I would
>> like to detect it to be able to apply some countermeasures.
>>
>> => Second question: do you know what's the best way to get the Cassandra
>> and CQLSH status from Bash (if it is possible)?
>>
>> These are all the approaches that I have already tried, with no chance:
>> - use the return code of Cassandra script ($? Bash operator), but it
>> returns all the times 0 even if something goes wrong.
>> - grep the Cassandra logs looking for "Exception" or "Error" (after
>> redirection with &> ), but it doesn't work as they are not yet flushed by
>> Cassandra (as a result, the calling bash exits).
>> - get the output of the Cassandra script with something like
>> cassandra_return=$($CASSANDRA_HOME/bin/cassandra -p $CASSANDRA_PID_FILE),
>> but the variable is empty all the times.
>> - detach Cassandra process from calling script with '&' operator and then
>> grep the logs or get the return code, but it doesn't work neither.
>>
>> Furthermore, when CQLSH script cannot connect to Cassandra, it prints
>> this error on console:
>> Connection error: ('Unable to connect to any servers', {'127.0.0.1':
>> error(111, "Tried connecting to [('127.0.0.1', 9042)]. Last error:
>> Connection refused")})
>> and then kills the calling script.
>>
>> Just for your information, we are embedding Cassandra in our open source
>> product "Datafari".
>>
>> Thanks for your help and
>> --
>>
>> Best regards,
>>
>> *Giovanni Usai * <giovanni.usai@francelabs.com>
>> giovanni.usai@francelabs.com
>>
>>
>> www.francelabs.com
>>
>> CEEI Nice Premium
>> 1 Bd. MaƮtre Maurice Slama
>> 06200 Nice FRANCE
>>
>> Ph: +33 (0)9 72 43 72 85
>>
>
>

Mime
  • Unnamed multipart/related (inline, None, 0 bytes)
View raw message