4

I setup the DataStax Cassandra Sandbox on Azure using their image. I was able to run OpsCenter locally on the server without any issues. The install is Ubuntu which I am very new to.

Per this post Apache Cassandra remote access, I should be able to set my rpc_address to 0.0.0.0 to allow remote access to my database. However it says unable to connect when attempting a connection from DevCenter on my local Windows 8 PC.

Here are my settings: enter image description here

The contact host address is the virtual ip address shown in Azure for my VM. The port is the same one shown in the cassandra.yaml config file. I haven't configured any authorization and from what I have read I should just be able to connect using .NET or the management tools but neither works.

enter image description here

I also checked to see if the ports are open which they are as far as I can tell: enter image description here

Far I know it would be either 9160 or 9042.

Community
  • 1
  • 1
KingOfHypocrites
  • 9,316
  • 9
  • 47
  • 69
  • Have you ensured that C* is running? If so, can you access C* via cqlsh locally on the VM running Cassandra? Can you ping the Azure VM from the computer you're attempting to access it from? Is 137.x.x.x the WAN IP for the VM? – mbeacom Apr 30 '15 at 20:27
  • I am able to run cqlsh without issue... Connected to Test Cluster at localhost:9160. [cqlsh 4.1.1 | Cassandra 2.0.14.352 | DSE 4.6.5 | CQL spec 3.1.1 | Thrift protocol 19.39.0] Use HELP for help. cqlsh> – KingOfHypocrites Apr 30 '15 at 20:55
  • I was able to ping my SSH port using PsPing but not 9160 or 9042. Regular ping is disabled on Azure, so not sure if there is a difference in the type of ports, but I would think I should be able to ping those as well. – KingOfHypocrites Apr 30 '15 at 21:38
  • I realized that you have to create endpoints per port to route to the VM. I did that and I get a different error message when pinging remotely but I still can't connect to it. I am now trying to setup a static ip to see if that helps. – KingOfHypocrites May 01 '15 at 15:53

2 Answers2

5

Thanks to everyone who helped me figured this out. Ultimately the issue was that when setting up an Azure VM, the Virtual IP that is assigned is for the cloud service itself and not the virtual machine. Therefore even though it appears that the proper ports are exposed you are not able to access them from an external computer.

More info about it here (but read my instructions below first since this is much easier to do in the Azure Management Console).

You will notice when setting up your virtual machine that Azure automatically creates an endpoint for your SSH connection such as 55xxx. You won't be able to connect to the configured port of 22 as shown on the box itself, but instead will have to use the endpoint port of 55xxx, etc.

This is important to note because the same goes for the Cassandra ports 8888 (OpsCenter), and 9042 (native transport).

So you can either:

  1. Create endpoints for these ports and use them when connecting remotely.
  2. Create a public IP address that points to the VM itself rather than the cloud service.

I couldn't get the endpoints to work at first, but later got them working. This lead me to setup a public ip address. I did it the hard way using the Azure Powershell. This was painful and a lot of research. But, after spending the time to do this, I realized it can now be done in the preview console. Simply go to the IP Addresses settings on your VM and enable the "Instance IP Address" option.

Then you should be able to connect remotely to OpsCenter using the ip address that is returned after the setup is complete via your browser: (The New IP Address):8888

...then in DevCenter using the new ip address and port 9042.

If you used endpoints instead of setting up a public static ip (which you will want to do for security reasons and enable user access control via ip filters), then you will want to use those newly created port numbers instead along with your virtual ip address.

Secondly... you will need to set rpc_address to 0.0.0.0 in the cassandra.yaml file.

KingOfHypocrites
  • 9,316
  • 9
  • 47
  • 69
4

Far I know it would be either 9160 or 9042.

As you can see from your connection settings screenshot, DevCenter connects to Cassandra via the "Native Protocol." This refers to the Native Binary Protocol which (unless you altered native_transport_port in your cassandra.yaml) runs on port 9042. Thrift connects via port 9160, and I do not believe that you can configure DevCenter to connect with Thrift.

Next, check the values of listen_address and broadcast_address in your cassandra.yaml. At least one of these should be defined with your hostname or external IP address.

Set your "Native Protocol port" to 9042. Then try to connect to your external IP address.

Edit:

Check your system.log file and look for a line like this:

Starting listening for CQL clients on localhost/127.0.0.1:9042...

Whichever address you see there is the address that you need to connect to via DevCenter or a client. If that line shows 127.0.0.1, you have work to do.

Also, here are links to a similar question that I have helped out with in the past: How do I connect to local cassandra db

Did either of you have to assign a public IP to your vm?

Our (cloud based) Cassandra servers (in prod) have both internal and external IP addresses. I'll have to double-check tomorrow, but our Cassandra 2.0 configs had listen_address set to our external (public) IP and rpc_address either blank or set to the same.

Here are some docs that might help you get this configured:

Community
  • 1
  • 1
Aaron
  • 55,518
  • 11
  • 116
  • 132
  • Wouldn't he want to check the rpc_address, to ensure DSE is listening to the right interface for outbound connectivity? – mbeacom Apr 30 '15 at 21:47
  • Well, he did mention that he has set `rpc_address` to 0.0.0.0. If he still can't get this to work, then changing `rpc_address` is a good next step. – Aaron Apr 30 '15 at 21:51
  • I tried first setting my broadcast address to my Azure Virtual Public IP and left listen_address as localhost but that didn't work and I couldn't load OpsCenter even on the server itself. Then i tried changing listen_address to my Azure Virtual Public IP but the didn't work either. I couldn't connect remotely and when I load OpsCenter on the server itself it says cannot connect to cluster. – KingOfHypocrites Apr 30 '15 at 22:03
  • 1
    What is the IP address for 'seeds' in 'seed_provider' ? 127.0.0.1 ? What is your listen_address IP set to (not specifically, but in conjunction with the other addresses)? If you're hosting your C* cluster on the same intranet as the applications accessing it, you can set your listen_address (and broadcast_address) to your internal IP address. I would try to explicitly set rpc_address to your VMs outbound IP address if 0.0.0.0 isn't assigning it appropriately. – mbeacom Apr 30 '15 at 22:14
  • The seeds provider section is empty. Per the comments in the config it only gets set if I have more than one node. I am using the single node sandbox image. Localhost seems to be the only listen_address that works correctly. When I set it to the public ip of the server nothing works. – KingOfHypocrites Apr 30 '15 at 22:21
  • Not sure if this is relevant... Did either of you have to assign a public IP to your vm? http://blogs.technet.com/b/canitpro/archive/2014/10/28/step-by-step-assign-a-public-ip-to-a-vm-in-azure.aspx – KingOfHypocrites Apr 30 '15 at 22:30
  • listen_address should be the private ip, broadcast_address should be the public ip. See [here](http://stackoverflow.com/questions/18712650/cassandra-what-is-the-correct-configuration-for-ec2-multi-region) – LHWizard May 01 '15 at 15:31
  • 1
    Thanks Bryce and everyone else who helped. The problem was related to the way that azure uses the virtual ips. It is not a true ip to the machine itself. – KingOfHypocrites May 01 '15 at 17:45
  • @BryceAtNetwork23, I sent you a contact request via your website Aarons Tech Center which i guess routes to your FB profile. I wanted to send you some info of a SAAS product I have that is possibly being migrated to Cassandra to see if you would be interested in working on it. – KingOfHypocrites May 01 '15 at 17:45
  • Oddly enough i left broadcast address blank (which sets it automatically to listen_address) and set listen_address to localhost. Then rpc_address to 0.0.0.0. Not sure why it wouldn't let me set the listen or broadcast address to the public ip address, but after two days of playing with this I am happy to have it working. Nothing I was trying before was working since the IP was never accessible publicly. – KingOfHypocrites May 01 '15 at 18:04