You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Abdul Patel <ab...@gmail.com> on 2018/10/05 03:57:14 UTC
Connections info
Hi All,
Can we get number of users connected to each node in cassandra?
Also can we get from whixh app node they are connecting from?
Re: Connections info
Posted by Abdul Patel <ab...@gmail.com>.
Thanks will try both options
On Friday, October 5, 2018, Alain RODRIGUEZ <ar...@gmail.com> wrote:
> Hello Abdul,
>
> I was caught by a different topic while answering, sending the message
> over, even though it's similar to Romain's solution.
>
> There is the metric mentioned above, or to have more details such as the
> app node IP, you can use:
>
> $ sudo netstat -tupawn | grep 9042 | grep ESTABLISHED
>
> tcp 0 0 ::ffff:<C*node_ip>:*9042* :::*
> LISTEN -
>
> tcp 0 0 ::ffff:<C*node_ip>:*9042* ::ffff:<app_node_ip>:51486
> ESTABLISHED -
>
> tcp 0 0 ::ffff:<C*node_ip>:*9042* ::ffff:<app_node_ip>:37624
> ESTABLISHED -
> [...]
>
> tcp 0 0 ::ffff:<C*node_ip>:*9042* ::ffff:<app_node_ip>:49108
> ESTABLISHED -
>
> or to count them:
>
> $ sudo netstat -tupawn | grep 9042 | grep ESTABLISHED | wc -l
>
> 113
>
> I'm not sure about the '-tupawn' options, it gives me the format I need
> and I never wondered much about it I must say. Maybe some of the options
> are useless.
>
> Sending this command through ssh would allow you to gather the information
> in one place. You can also run similar commands on the clients (Apps) toI
> hope that helps.
>
> C*heers
> -----------------------
> Alain Rodriguez - @arodream - alain@thelastpickle.com
> France / Spain
>
> The Last Pickle - Apache Cassandra Consulting
> http://www.thelastpickle.com
>
> Le ven. 5 oct. 2018 à 06:28, Max C. <mc...@core43.com> a écrit :
>
>> Looks like the number of connections is available in JMX as:
>>
>> org.apache.cassandra.metrics:type=Client,name=connectedNativeClients
>>
>> http://cassandra.apache.org/doc/4.0/operating/metrics.html
>>
>> "Number of clients connected to this nodes native protocol server”
>>
>> As for where they’re coming from — I’m not sure how to get that from
>> JMX. Maybe you’ll have to use “lsof” or something to get that.
>>
>> - Max
>>
>> On Oct 4, 2018, at 8:57 pm, Abdul Patel <ab...@gmail.com> wrote:
>>
>> Hi All,
>>
>> Can we get number of users connected to each node in cassandra?
>> Also can we get from whixh app node they are connecting from?
>>
>>
>>
Re: Connections info
Posted by Alain RODRIGUEZ <ar...@gmail.com>.
Hello Abdul,
I was caught by a different topic while answering, sending the message
over, even though it's similar to Romain's solution.
There is the metric mentioned above, or to have more details such as the
app node IP, you can use:
$ sudo netstat -tupawn | grep 9042 | grep ESTABLISHED
tcp 0 0 ::ffff:<C*node_ip>:*9042* :::*
LISTEN -
tcp 0 0 ::ffff:<C*node_ip>:*9042*
::ffff:<app_node_ip>:51486 ESTABLISHED
-
tcp 0 0 ::ffff:<C*node_ip>:*9042*
::ffff:<app_node_ip>:37624 ESTABLISHED
-
[...]
tcp 0 0 ::ffff:<C*node_ip>:*9042*
::ffff:<app_node_ip>:49108 ESTABLISHED
-
or to count them:
$ sudo netstat -tupawn | grep 9042 | grep ESTABLISHED | wc -l
113
I'm not sure about the '-tupawn' options, it gives me the format I need and
I never wondered much about it I must say. Maybe some of the options are
useless.
Sending this command through ssh would allow you to gather the information
in one place. You can also run similar commands on the clients (Apps) toI
hope that helps.
C*heers
-----------------------
Alain Rodriguez - @arodream - alain@thelastpickle.com
France / Spain
The Last Pickle - Apache Cassandra Consulting
http://www.thelastpickle.com
Le ven. 5 oct. 2018 à 06:28, Max C. <mc...@core43.com> a écrit :
> Looks like the number of connections is available in JMX as:
>
> org.apache.cassandra.metrics:type=Client,name=connectedNativeClients
>
> http://cassandra.apache.org/doc/4.0/operating/metrics.html
>
> "Number of clients connected to this nodes native protocol server”
>
> As for where they’re coming from — I’m not sure how to get that from JMX.
> Maybe you’ll have to use “lsof” or something to get that.
>
> - Max
>
> On Oct 4, 2018, at 8:57 pm, Abdul Patel <ab...@gmail.com> wrote:
>
> Hi All,
>
> Can we get number of users connected to each node in cassandra?
> Also can we get from whixh app node they are connecting from?
>
>
>
Re: Connections info
Posted by Romain Hardouin <ro...@yahoo.fr.INVALID>.
Note that one "user"/application can open multiple connections. You have also the number of Thrift connections available in JMX if you run a legacy application.
Max is right, regarding where they're come from you can use lsof. For instance on AWS - but you can adapt it for your needs:
IP=...REGION=...
ssh $IP "sudo lsof -i -n | grep 9042 | grep -Po '(?<=->)[^:]+' | sort -u" | xargs -P 20 -I '{}' aws --output json --region $REGION ec2 describe-instances --filter Name=private-ip-address,Values={} --query 'Reservations[].Instances[*].Tags[*]' | jq '.[0][0] | map(select(.Key == "Name")) | .[0].Value' | sort | uniq -c
You'll have number of instances grouped by AWS name : 3 "name_ABC" 15 "name_example" 37 "name_test"
Best,Romain
Le vendredi 5 octobre 2018 à 06:28:51 UTC+2, Max C. <mc...@core43.com> a écrit :
Looks like the number of connections is available in JMX as:
org.apache.cassandra.metrics:type=Client,name=connectedNativeClients
http://cassandra.apache.org/doc/4.0/operating/metrics.html
"Number of clients connected to this nodes native protocol server”
As for where they’re coming from — I’m not sure how to get that from JMX. Maybe you’ll have to use “lsof” or something to get that.
- Max
On Oct 4, 2018, at 8:57 pm, Abdul Patel <ab...@gmail.com> wrote:
Hi All,
Can we get number of users connected to each node in cassandra?Also can we get from whixh app node they are connecting from?
Re: Connections info
Posted by "Max C." <mc...@core43.com>.
Looks like the number of connections is available in JMX as:
org.apache.cassandra.metrics:type=Client,name=connectedNativeClients
http://cassandra.apache.org/doc/4.0/operating/metrics.html <http://cassandra.apache.org/doc/4.0/operating/metrics.html>
"Number of clients connected to this nodes native protocol server”
As for where they’re coming from — I’m not sure how to get that from JMX. Maybe you’ll have to use “lsof” or something to get that.
- Max
> On Oct 4, 2018, at 8:57 pm, Abdul Patel <ab...@gmail.com> wrote:
>
> Hi All,
>
> Can we get number of users connected to each node in cassandra?
> Also can we get from whixh app node they are connecting from?