I am using cassandra 3.6 and 3 node of cassandra
seed node is in 111.1.11.111 this ip
and two other node is in 222.2.22.222 this ip
I changed the below port in cassandra.yml
storage_port: node3=7000, node2=7005
ssl_storage_port: node3=7001, node2=7006
native_transport_port: node3=9042, node2=9043
rpc_port: node3=9160, node2=9161
but when I want to connect node2 using cqlsh 222.2.22.222 this will connect to 9042 default node3.
where did i change the config to ask or give the port to connect which node I want to connect I do.
cqlsh commands accept host and port. Here is the generic syntax
cqlsh [options] [host [port]]
In your case, in order to connect to node2, it would be
cqlsh 222.2.22.222 9043
Reference for cqlsh.
Related
i know this may be basic problem but as i am new to cassandra and did not find solution of it anywhere so When i am trying to make connection in DataStax Dev Center to cassandra server, it is giving me below exception.
Below is system configuration:
Operating System: Windows 10 pro(64- Bit)
apache-cassandra-3.11.2
Below is cassandra.yaml configuration:
start_native_transport: true
broadcast_rpc_address: 1.2.3.4
native_transport_port_ssl: 9142
listen_address: 192.168.2.22
rpc_address: 192.x.x.x
I have done these changes in cassandra.yaml file: start_rpc: true rpc_port: 9042
when running this command on cmd: nodetool -h localhost -p 9042 status
getting this error: Failed to connect to 'localhost:9042' - ConnectIOException: 'non-JRMP server at remote endpoint'.
Any help would be appreciated.
Seems like you have configured native-transport-port as :9142, but you are trying to connect to 9042 port with dev center. Please correct it and verify.
You have set rpc (rpc_port) to use the the same port as cql (native_transport_port). Are you sure you want to use rpc? This is the old deprecated interface and should not be used unless you need it for backwards compatibility.
If you actually do want to use rpc then it has to be another port than native_transport_port.
You should use jmx port (7199 default) for nodetool
I have found answer of this question and below are configurations which need to configure once you install Cassandra for first time:
broadcast_rpc_address: 192.168.2.22(ip address of system on which Cassandra is installed
rpc_address: 0.0.0.0
I have deployed a 4 node datastax cluster in GCP. I can ssh into each of the VM nodes but cqlsh is not recognized.Can you please help me to understand where I am going wrong
error:
Connection error: ('Unable to connect to any servers',
{'127.0.0.1': error(111, "Tried connecting to [('127.0.0.1',
9042)]. Last error: Connection refused")})
If your cluster is working correctly, then the nodes must know about each other by their own IPs (internal or external). So Cassandra isn't configured to bind 9042 to 127.0.0.1, which means trying to cqlsh to 127.0.0.1:9042 won't work.
One way to check, would be just to do a nodetool status, and use one of those IP addresses. But, as you're on GCP, you may have both internal and external IP addresses, so in that case it really depends on which IP is set as your broadcast_rpc_address. You can check them all by grepping your cassandra.yaml.
$ grep "_address:" cassandra.yaml
listen_address: 192.168.1.3
broadcast_address: 10.20.15.1
# listen_on_broadcast_address: false
rpc_address: 192.168.1.3
broadcast_rpc_address: 10.20.15.1
In this case, your cqlsh command would look something like this:
cqlsh 10.20.15.1 -u youruser -p yourpassword
I've just started working with Cassandra (homebrew install), version 3.7 and cqlsh version 5.0.1. , OS X El Capitan
Cassandra starts up fine and the cluster is operational instantly.
Cqlsh is not working (on any of the nodes) and emits the following error:
Connection error: ('Unable to connect to any servers', {'127.0.0.1':
error(61, "Tried connecting to [('127.0.0.1', 9042)]. Last error:
Connection refused")})
Edit cqlsh and change DEFAULT_HOST = IP and then run cqlsh.
I think the first step you should be doing is running netstat -ntpl. This should list down all the ports active on the system. Check for Local Address there you shall find a IP prepended with 9042.
Use this IP to connect ie cqlsh IP . If you do not find the 9042 port in the netstat output than check your cassandra.yaml file. Grep for native_transport_port see if it is 9042 or something different.
If different than connect on that port via cqlsh.
For future reference, if someone else gets it.
I'm running [cqlsh 5.0.1 | Cassandra 3.11.4 | CQL spec 3.4.4].
Add start_native_transport: true field in cassandra.yaml file, by default it doesn't enables it and so no rpc communication with client.
Now try connecting with cqlsh rpc_endpoint(rpc addr set in cassandra.yaml).
I am trying to configure Cassandra Datastax Community Edition for remote connection on windows,
Cassandra Server is installed on a Windows 7 PC, With the local CQLSH it connects perfectly to the local server.
But when i try to connect with CQLSH from another PC in the same Network, i get this error message:
Connection error: ('Unable to connect to any servers', {'MYHOST':
error(10061, "Tried connecting to [('HOST_IP', 9042)]. Last error: No
connection could be made because the target machine actively refused
it")})
So i am wondering how to configure correctly (what changes should i make on cassandra.yaml config file) the Cassandra server to allow remote connections.
Thank you in advance!
How about this:
Make these changes in the cassandra.yaml config file:
start_rpc: true
rpc_address: 0.0.0.0
broadcast_rpc_address: [node-ip]
listen_address: [node-ip]
seed_provider:
- class_name: ...
- seeds: "[node-ip]"
reference: https://gist.github.com/andykuszyk/7644f334586e8ce29eaf8b93ec6418c4
Remote access to Cassandra is via its thrift port for Cassandra 2.0. In Cassandra 2.0.x, the default cqlsh listen port is 9160 which is defined in cassandra.yaml by the rpc_port parameter. By default, Cassandra 2.0.x and earlier enables Thrift by configuring start_rpc to true in the cassandra.yaml file.
In Cassandra 2.1, the cqlsh utility uses the native protocol. In Cassandra 2.1, which uses the Datastax python driver, the default cqlsh listen port is 9042.
The cassandra node should be bound to the IP address of your server's network card - it shouldn't be 127.0.0.1 or localhost which is the loopback interface's IP, binding to this will prevent direct remote access. To configure the bound address, use the rpc_address parameter in cassandra.yaml. Setting this to 0.0.0.0 will listen on all network interfaces.
Have you checked that the remote machine can connect to the Cassandra node? Is there a firewall between the machines? You can try these steps to test this out:
1) Ensure you can connect to that IP from the server you are on:
$ ssh user#xxx.xxx.xx.xx
2) Check the node's status and also confirm it shows the same IP:
$nodetool status
3) Run the command to connect with the IP (only specify the port if you are not using the default):
$ cqlsh xxx.xxx.xx.xx
Alternate solution to Kat. Worked with Ubuntu 16.04
ssh into server server_user#**.**.**.**
Stop cassandra if running:
Check if running with ps aux | grep cassandra
If running, will output a large block of commands / flags, e.g.
ubuntu 14018 4.6 70.1 2335692 712080 pts/2 Sl+ 04:15 0:11 java -Xloggc:./../logs/gc.log ........
Note 14018 in the example is the process id
Stop with kill <process_id> (in this case 14018)
edit cassandra.yaml file to be the following
rpc_address: 0.0.0.0
broadcast_rpc_address: **.**.**.** <- your server's IP (cannot be set to 0.0.0.0)
Restart cassandra ./bin/cassandra -f (from within cassandra root)
Open another terminal on local machine & connect via cqlsh **.**.**.** (your server's IP) to test.
The ./bin/nodetool status address reported my localhost IP (127.0.0.1), but cqlsh remotely still worked despite that.
I am unable to connect to any nodes through opscenter. In opscenter it says that agents need to be connected inorder for opscenter to work. I checked in datastax-agent/agent.log file and found below errors.
ERROR [clojure-agent-send-off-pool-0] 2016-01-27 09:30:54,545 Can't connect to Cassandra (All host(s) tried for query failed (tried: /127.0.0.1:9042 (com.datastax.driver.core.TransportException: [/127.0.0.1:9042] Cannot connect))), retrying soon.
I checked port 9042 and 7199 both are listening..
x.x.x.10:9042 :::* LISTEN 497 499005 28550/java
pls advise.. what needs to be checked for this. Thanks
Leave broadcast_rpc_address to rpc_address as it is to point to their respective ip address as below: and changing to 0.0.0.0 is not required.
10.154.3.10 - Cassandra.yaml
broadcast_rpc_address: 10.154.3.10
rpc_address: 10.154.3.10
10.154.3.10 - address.yaml
stomp_interface: 10.154.3.XX --> (Mention the IP of opscenter server)
hosts: ["10.154.3.10"]
Restart the datastax-agent, and in agent.log, no errors will be seen.
There are few basic settings in cassandra.yaml to tune network connection params.
listen_address : localhost
Address or interface to bind to and tell other Cassandra nodes to connect to. Specifying it to localhost will always do the Right Thing. Setting listen_address to 0.0.0.0 is always wrong
rpc_address : 0.0.0.0
That unlike listen_address, you can specify 0.0.0.0, but you must also set broadcast_rpc_address to a value other than 0.0.0.0
broadcast_rpc_address: localhost
This setting will be usefull probably for redirect conversation between nodes from broadcast_rpc_address to rpc_address (i.e. Machine has two network interfaces)
If all settings is correct for you environment try to connect with console client cqlsh and try to use nodetool for monitoring state of your nodes. After try to run OPC center