I have 1 node test Cassandra claster (IP 192.168.108.198). In Cassandra.yaml listen_address: localhost.
I can connect to it via DBeaver (using ssh port forwarding ), and work in it.
I wrote .net app for using it, but it cant connect to cassandra: "All hosts tried for query failed (tried 192.168.108.198:9042: SocketException". It happens on the last row, as below. Is it problem with cassandra config or my app?
_connectionConfig = connectionConfig; _socketOptions = new SocketOptions(); _socketOptions.SetReadTimeoutMillis(90000); _cluster = Cluster.Builder() .WithPort(_connectionConfig.ConnectionPort) .AddContactPoints(_connectionConfig.ConnectionStrings) .WithSocketOptions(_socketOptions) .WithQueryOptions(new QueryOptions().SetConsistencyLevel(ConsistencyLevel.One)) .WithAuthProvider(new PlainTextAuthProvider(_connectionConfig.UserName, _connectionConfig.UserPassword)) .Build(); _session = _cluster.Connect(_connectionConfig.KeySpaceName);
CodePudding user response:
So, i corrected some settings in Cassandra.yaml, and now connection is going fine, appender other problems, but right settings are:
- class_name: org.apache.cassandra.locator.SimpleSeedProvider
parameters:
# seeds is actually a comma-delimited list of addresses.
# Ex: "<ip1>,<ip2>,<ip3>"
- seeds: "192.168.108.198"
listen_address: 192.168.108.198
rpc_address: 192.168.108.198
192.168.108.198 - Cassandra IP.