Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cassandra how to see active user connections

Tags:

cassandra

In cassandra (am using DSE),

  1. how do I check how many users are connected to the database? Any way to check node wise?
  2. Is there any auditing info stored which will tell me which all users connected along with info such as IP address and driver used etc?
  3. In Opscenter there is a metric called "Native clients", where is this info stored in the db to query for? Does this include internal communication between the nodes and backups etc?
like image 473
nmakb Avatar asked Jan 14 '19 00:01

nmakb


1 Answers

  1. How do I check how many users are connected to the database? Any way to check node wise?

  2. Is there any auditing info stored which will tell me which all users connected along with info such as IP address and driver used etc?

DSE has a performance service feature which you can enable to make this information available via cql. To enable this particular capability, configure the following in dse.yaml as described in the docs:

user_level_latency_tracking_options:                                            
   enabled: true 

With this enabled, you can now query a variety of tables, for example:

cqlsh> select * from dse_perf.user_io;

 node_ip   | conn_id         | last_activity                   | read_latency | total_reads | total_writes | user_ip   | username  | write_latency
-----------+-----------------+---------------------------------+--------------+-------------+--------------+-----------+-----------+---------------
 127.0.0.1 | 127.0.0.1:55116 | 2019-01-14 14:08:19.399000+0000 |         1000 |           1 |            0 | 127.0.0.1 | anonymous |             0
 127.0.0.1 | 127.0.0.1:55252 | 2019-01-14 14:07:39.399000+0000 |            0 |           0 |            1 | 127.0.0.1 | anonymous |          1000

(2 rows)
cqlsh> select * from dse_perf.user_object_io;

 node_ip   | conn_id         | keyspace_name | table_name | last_activity                   | read_latency | read_quantiles | total_reads | total_writes | user_ip   | username  | write_latency | write_quantiles
-----------+-----------------+---------------+------------+---------------------------------+--------------+----------------+-------------+--------------+-----------+-----------+---------------+-----------------
 127.0.0.1 | 127.0.0.1:55252 |             s |          t | 2019-01-14 14:07:39.393000+0000 |            0 |           null |           0 |            1 | 127.0.0.1 | anonymous |          1000 |            null
 127.0.0.1 | 127.0.0.1:55116 |             s |          t | 2019-01-14 14:08:19.393000+0000 |         1000 |           null |           1 |            0 | 127.0.0.1 | anonymous |             0 |            null

Note that there is a cost to enabling the performance service, and it can be enabled and disabled selectively using dsetool perf userlatencytracking [enable|disable].

In a future release of Apache Cassandra (4.0+) and DSE (likely 7.0+), there will be a nodetool clientstats command (CASSANDRA-14275), and a corresponding system_views.clients table (CASSANDRA-14458) that includes connection info. This will include the driver name, if the driver client provides one (newer ones do).

  1. In Opscenter there is a metric called "Native clients", where is this info stored in the db to query for? Does this include internal communication between the nodes and backups etc?

I'm not too up to speed on OpsCenter. From what I know OpsCenter typically stores it's data in the OpsCenter keyspace, you can configure data collection parameters by following this doc.

like image 135
Andy Tolbert Avatar answered Sep 22 '22 20:09

Andy Tolbert