Nodetool command from one node to another node is not working - shell

nodetool -h 10.16.252.129 -p 9042 -u cassandra -pw cassandra status
is giving error:
nodetool: Failed to connect to '10.16.252.129:9042' -
ConnectIOException: 'non-JRMP server at remote endpoint'.
This is in cassandra.yaml file:
rpc_address: 10.16.252.129
rpc_port: 9160

You have to use 7199 port here for nodetool command. However you need to check whether your port is open or not if not then you should open/allow this port on firewall.
You can find the JMX port configuration on cassandra-env.sh.
Then you should try to run below command:-
nodetool -h Hostname/IP -p 7199 -u username -pw password status
You can find more details about nodetool syntax and usage on below link.
http://cassandra.apache.org/doc/latest/tools/nodetool/compactionhistory.html

First of all, port 9042 is for the native binary protocol CQL client connections. Port 9160 is for legacy (deprecated) Thrift protocol client connections. Inter-node nodetool commands use the JMX (Java Management eXtensions) protocol over port 7199.
Do note that in order for remote JMX to work port 7199 will need to be open (firewall) and cassandra-env.sh has configuration lines for:
$JMX_PORT="7199"
JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.port=$JMX_PORT"
JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.rmi.port=$JMX_PORT"
JVM_OPTS="$JVM_OPTS -Djava.rmi.server.hostname=$HOST_IP"
You may also want to enable JMX password authentication:
JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.authenticate=true"
JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.password.file=/etc/cassandra/jmxremote.password"
Also, you shouldn't need to send the port or credentials. The cassandra/cassandra creds are the default for database auth, not JMX. If you enabled JMX password auth, then you'll need to send whatever username and password you defined in the password file. But otherwise, this should work (as long as both the current and target nodes have remote JMX enabled):
nodetool -h 10.16.252.148 status

Related

How to connect and run Redis commands on remote server?

We are running Redis on our enterprise cluster. I need to run Redis flush command to from my local edgenode. Is there a way I can connect to commands on remote Redis using bash scripts. Basically, we want to run Redis command from a remote server/
Thank you
You can use redis-cli
You can specify your remote Redis server host and port
redis-cli -h your.remote.server -p 1234
Or even with commands
redis-cli -h your.remote.server -p 1234 SET KEY VALUE
You also need to enable Redis to accept connections for other machines than the one it is running. Please see bind directive in redis.conf

default port of clickhouse did not change after I modify config.xml

I'm new to clickhouse.
Because my hadoop use the port 9000,conflict with clickhouse's default port
Here's my steps to modify the port:
①sudo gedit /etc/clickhouse-server/config.xml change all 9000 to 9500
②sudo service clickhouse-server restart
③clickhouse-client -u default --password
Connecting to localhost:9000 as user default.
Code: 210. DB::NetException: Connection refused (localhost:9000)
④clickhouse-client -u default --port 9500 --password
then connection is OK
-------------------------------------
My question is:
In the future,there will be other needs to modify the config.xml
why my modification did not take effect after I restart clickhouse sevice?
Thanks for for your reading and help~
clickhouse-client -- different application and it's a client and it has own configuration /etc/clickhouse-client/
By default it tries to connect to localhost:9000 . It has no information that clickhouse-server uses the port 9500
You can override default port for the client
cat /etc/clickhouse-client/config.xml
<config>
<port>9500</port>
....

DBVisualizer Hive SSH Tunnel Ignoring Server Information

I'm attempting to setup a connection to our Hadoop cluster via DBVisualizer.
In order to connect I need to SSH into a server on the domain and then I need to run the command to a remote server (I've not ssh'd onto the Hadoop cluster directly)
I have (figuratively)
Database Server: abcd.efg
Database Port: 12345
Database: Hello
configured for the Database section
SSH Host: hijk.efg
SSH Port: 678
When I attempt a connection, it returns
Could not open client transport with JDBC Uri:
jdbc:hive2://127.0.0.1:-----
Where 127.0.0.1 and ----- appear to be the defaults instead of what I entered.
Any idea how I get the SSH tunnel to use the server configuration I specify?
The SSH Tunnel is set up locally on the client, so connecting to the port on localhost tunnels you to the SSH Host/Port, which then sets up a connection to the database server/port you have specified. This page may help:
http://confluence.dbvis.com/display/UG100/Using+an+SSH+Tunnel
Best Regards,
Hans

Why does JMX connection to Amazon EC2 fail?

I set up JMX on one of services running on Amazon EC2 instance but it doesn't work properly. I'm using VisualVM to connect and after short period of pending it fails with timeout. Looks like it fails because of missing response data or lags. I checked that JMX port is enabled in security group and also tried with different port with no JMX enabled and also with port not enabled in security group settings and both fails immediately, so it looks different. My EC2 instance and desktop both have Ubuntu 12.04 and JDK 7 installed.
It turns out ports don't make sense since connection is SSL secured. I have a private key and have no idea how to use it with JConsole or VisualVM.
JMX needs an RMI registry operating on an open port. By default the RMI registry port is chosen randomly at the startup time and it doesn't play well with firewalls.
Since JDK7u4 you can use
-Dcom.sun.management.jmxremote.rmi.port=<port>
to set the RMI port to be used. Then you can enable that port in the security group.
Note the .rmi. part of the above setting because this usually gets confused with the com.sun.management.jmxremote.port setting. You should not!
This works for me. Set the JMX options on your server:
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=<some port>
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
-Djava.rmi.server.hostname=localhost
Open up an SSH tunnel:
ssh -i /path/to/key -D <some port> username#public_dns_address
Start VisualVM:
jvisualvm -J-Dnetbeans.system_socks_proxy=localhost:<some port> -J-Djava.net.useSystemProxies=true
Add a remote connection to the server. Add a JMX connection using the port you've specified for JMX.
To be clear, in all three cases above, should be the same port.

ssh to amazon EC2 over proxy

I have some problem connecting to my amazon EC2 server over ssh over proxy.
I have my username and password for http proxy port 8080.(dont have control over proxy)
Also I have my connection string which would work without proxy
ssh -i key.pem root#xx.compute.amazonaws.com
when I am trying to connect I am getting "No route to host" error
I tried to use putty, configured proxy + authentication file, But then I getting this error
"Unable to use this key file (OpenSSH SSH-2 private key)"
Also I dont know how putty inserts my proxy config, into ssh connection string, so I could try it in terminal
I was facing the same problem and this is what I used to connect, using corkscrew. My config file looks like this
Host AWS
Hostname <Public DNS>
Port 443
#Write the appropriate username depending on your AMI, eg : ubuntu, ec2-user
User ubuntu
IdentityFile </path to key file>
ProxyCommand /usr/bin/corkscrew 10.10.78.61 3128 %h %p
then I simply use this command to connect
ssh AWS
and it works flawlessly.
Note : You must edit your sshd_config file on the server to listen to ssh connections on port 443 (in addition to 22) and restart the ssh daemon.
Are you sure you can login as root? Try logging in as ec2-user instead.
Also, if you have assigned an elastic IP to your instance, the public DNS has probably changed. Log in to the aws console, and select your instance. Scroll down to look at the public DNS again and double check you are using the correct xx.compute.amazonaws.com addr.

Resources