0

I've got Cassandra 3.0 and I'm trying to run nodetool inside a program in C (I'm using the cpp driver) but the only way I can think of is to use the system function to write in a file the result of the command : nodetool getendpoints etc., and then read the file to copy it in a char*.

Does the cpp-driver offer another posibility to use nodetool inside a C file?

Thank you beforehand

Elias
  • 1
  • 1
    I think this is relevant: https://stackoverflow.com/questions/5237482/how-do-i-execute-external-program-within-c-code-in-linux-with-arguments – Simon Fontana Oscarsson Oct 22 '18 at 14:07
  • The cpp driver is used with the CQL interface of Cassandra. CQL is used for DDL and DML (it is the data interface). Nodetool, on the other hand, uses the JMX interface, which uses Java mbeans. JMX is used to read metrics, configure Cassandra, etc. You can see CQL as the user interface to make queries and JMX as the admin interface Just fyi. – Simon Fontana Oscarsson Oct 22 '18 at 14:12
  • So what should I do? Because I need to know in which node a row of a table has been saved using that command or something similar without executing it outside the program. Can it be implemented? Can I use the popen function to do it? Sorry, I don't know much about it. – Elias Oct 22 '18 at 15:39
  • The question is why do you need to know where the data is located? Does this help? https://docs.datastax.com/en/developer/cpp-driver/2.9/topics/configuration/#token-aware-routing – Simon Fontana Oscarsson Oct 22 '18 at 21:41
  • Yes it does. Thank you so much for answering my question – Elias Oct 24 '18 at 09:02

0 Answers0