question

nancycookprc_184190 avatar image
nancycookprc_184190 asked Erick Ramirez edited

DS201 Exercises 16 and 17 - is altering native_transport_port the correct workaround

I have been working through the exercises associated with the DS201 course and found them to be excellent! I ran into a bit of a snag in some of the final exercises and, though I got my setup to work for what I needed to do, I know this can't be the truly correct way of handling the issues.

In Ex 16 we begin with a fresh slate and create a singe node, altering the .yaml file with the supplied file labwork/config_node. Soon we need to run a stress test.

Mine errors. As I look at the output on the screen, I see all this information about connection problems and 127.0.0.1:9041.

That config_node file set the native_transport_port to 9042 and so I wonder if that is the problem. I shut down my node, edit my cassandra.yaml (altering native_transport_port to 9041), restart my node and run the stress test without further issuer. Yeah! - problem solved. Or so I think...

Now Ex 17 comes along and I need to enter cqlsh. Now it's looking for 9042, not 9041.


Not knowing what else to do I once again take down the node, change that value in the .yaml file back to 9042, restart my node and complete the remaining exercises without incident.

So it seems like the stress program and cqlsh had their own ideas about what port(?) was needed to connect to my cluster. Why did what I did work and what should have been done? (I'm quite sure in real life you don't have to redo the .yaml everytime you want to run a stress test.)

**note-If you respond to my question, please know I am in no way an administrator and can barely get around in linux at this point. I know about code and data and tables (relational - now learning Cassandra), but not server stuff . You can "dumb down" your answer as much as you like and I will take no offense.

Thank you so much for reading through my long post and for your help!

Nancy


ds201
7 comments
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

nancycookprc_184190 avatar image nancycookprc_184190 commented ·

addendum - I guess I can't paste in screen shots after all. The first blank spot in my post (after trying stress) had things like

TransportExceptions: [localhose/0:0:0:0:0:0:1:9041] cannot connect), localhost/127.0.0.1:9041

The second from cqlsh had

('Unable to connect to any servers', {127.0.0.1: error (111, "tried connecting to [('127.0.0.1, 9042)]. Last error: Connection refussed")})

0 Likes 0 ·
Erick Ramirez avatar image Erick Ramirez ♦♦ nancycookprc_184190 commented ·

That's correct. You can't paste screenshots directly to a post but you can click the "Insert Image" button on the editor. It will allow you to insert an image with your post. Cheers!

0 Likes 0 ·
Erick Ramirez avatar image Erick Ramirez ♦♦ commented ·

@nancycookprc_184190 Let me have a look at the exercises you cited and I'll get back to you. Cheers!

0 Likes 0 ·
nancycookprc_184190 avatar image nancycookprc_184190 commented ·

@Erick Ramirez Thank you so much! I look forward to hearing from you.

0 Likes 0 ·
Erick Ramirez avatar image Erick Ramirez ♦♦ commented ·

@nancycookprc_184190 Apologies for the very long delay in getting back to you. I'm posting a response now. Cheers!

0 Likes 0 ·
rb2017houser_184626 avatar image rb2017houser_184626 commented ·

Hello Nancy!

Thank you.

This message is to express my appreciation for your having provided a solution to the connection problem of not being able to insert data when using the cassandra-stress tool.

Setting parameters in the cassandra.yaml file is a clever find.

I saw the port was wrong and was seeking a way to fix it.

Below the line is the primary portion of the message that communicates the issue.

------------------------------------------------------------------------------------------------------

java.lang.RuntimeException: com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: localhost/127.0.0.1:9041 (com.datastax.driver.core.exceptions.TransportException: [localhost/127.0.0.1:9041] Cannot connect), localhost/0:0:0:0:0:0:0:1:9041 (com.datastax.driver.core.exceptions.TransportException: [localhost/0:0:0:0:0:0:0:1:9041] Cannot connect))

0 Likes 0 ·
nancycookprc_184190 avatar image nancycookprc_184190 rb2017houser_184626 commented ·

Thanks for your encouragement!

0 Likes 0 ·

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered Erick Ramirez edited

@nancycookprc_184190 Step 2 of exercise 16 required you to run these 3 commands:

tar -xf dse-6.0.0-bin.tar.gz
mv dse-6.0.0 node
labwork/config_node

The third command asked you to run the script config_node which based on your description, it doesn't sound like you ran it:

I shut down my node, edit my cassandra.yaml (altering native_transport_port to 9041), restart my node and run the stress test without further issuer.

If you ran the script, it would have re-written/reconfigured your cassandra.yaml so that Cassandra would have been running/listening on port 9041.

In exercise 17, you are right that cqlsh connects to port 9042 by default:

Now Ex 17 comes along and I need to enter cqlsh. Now it's looking for 9042, not 9041.

But as you already noted, the Cassandra instance is listening on port 9041 so you needed to specify the IP and port on the command line like this:

$ cqlsh 127.0.0.1:9041

For more info, see the cqlsh startup options reference document.

We probably need to be clearer about the instructions in exercise 17. Thank you for bringing this up and I will pass it on to the Curriculum Team who are responsible for the courses on DataStax Academy. Cheers!

2 comments Share
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

nancycookprc_184190 avatar image nancycookprc_184190 commented ·

Thanks for your help!

Actually, though, I did run the config_node ("In Ex 16 we begin with a fresh slate and create a singe node, altering the .yaml file with the supplied file labwork/config_node. Soon we need to run a stress test."). I kept screen shots of much of my work. I just checked and that file set the value to 9042.

Your first quote relates to what I did to overcome the hurdle of the stress test not working while looking for 9041. That is when I specifically went in and tinkered with the .yaml.

Regarding the reminder that cqlsh can accept the extra bits - thanks! I had totally forgotten about that. I'll look over that page you linked to for more ideas. :)

So I guess you want the .yaml to be set to whatever the stress test might want and then specifically note the node when connecting with cql.


Thanks again!

Nancy

0 Likes 0 ·
Erick Ramirez avatar image Erick Ramirez ♦♦ nancycookprc_184190 commented ·

@nancycookprc_184190 For what it's worth, this is not necessary:

So I guess you want the .yaml to be set to whatever the stress test might want and then specifically note the node when connecting with cql.

When running cassandra-stress, it is not necessary to override the default CQL port with -port native=9041. That was only done as part of the lab to reinforce to new users the various possible configuration options. Cheers!

0 Likes 0 ·