1
votes

I am running Cassandra 1.2.1 on a remote Windows server. I set the yaml settings as following;

rpc_address: 0.0.0.0 start_native_transport: true

I can connect the remote Cassandra server from my laptop by typing the IP address and port number;

connect XXX.XX.XX.XX/9160;

on cassandra-cli.bat

But I can not connect the remote Cassandra server from my .Net Application. I use casssandra-sharp;

XmlConfigurator.Configure();
using (ICluster cluster = ClusterManager.GetCluster("main"))
          Console.WriteLine("succeded");
ClusterManager.Shutdown();

Here is the App.config;

  <configSections>
    <section name="CassandraSharp" type="CassandraSharp.SectionHandler, CassandraSharp" />
  </configSections>

  <CassandraSharp>
    <Cluster name="main">
      <Endpoints>
        <Server>XXX.XX.XX.XX</Server>
      </Endpoints>
    </Cluster>
  </CassandraSharp>

The application throws "Can't find any valid endpoint" exception. When I run Cassandra locally and try to connect, this code block perfectly works.

On remote server 9160 and 7000 ports are allowed on firewall. Any idea about the problem?

2

2 Answers

4
votes

@rs_atl is right, it is a connectivity issue.

If you are using a client library and going to execute CQL commands, you need to set;

start_native_transport: true

which you already did. Just two lines below, you will see;

native_transport_port: 9042

in yaml file. That means you need to allow port number 9042 on firewall.

If you also using a cloud service like Azure do not forget to add an End Point.

0
votes

If your code works locally but does not work on another machine, the only logical conclusion is there must be a connectivity issue.