You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Weijun Li <we...@gmail.com> on 2010/02/09 10:06:39 UTC

Unable connect Thrift client to cassandra remotely (connection refused)

Hello,

 

I installed Cassandra  0.50 and started the instance without any problem.
The problem is: if I run

 

bin/cassandra-cli --host localhost -port 9160

 

it worked perfectly.

 

But whenever I tried to connect from any non-localhost and non-127.0.0.1
address (from other server or same server with domain name), I got
"connection refused", --no matter how I open port, disable firewall or
change port number.

 

So is there any default restriction in Cassandra that doesn't allow
non-localhost client connection? How can I get Cassandra-cli to work
remotely on an Cassandra instance? Also it seems to have same issue for
nodeprobe.

 

-bash-3.1# bin/cassandra-cli --host [xxxx-hostname] -port 9160

Exception java.net.ConnectException: Connection refused

org.apache.thrift.transport.TTransportException: java.net.ConnectException:
Connection refused

        at org.apache.thrift.transport.TSocket.open(TSocket.java:185)

        at org.apache.cassandra.cli.CliMain.connect(CliMain.java:65)

        at org.apache.cassandra.cli.CliMain.main(CliMain.java:151)

Caused by: java.net.ConnectException: Connection refused

        at java.net.PlainSocketImpl.socketConnect(Native Method)

        at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)

        at
java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)

        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)

        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)

        at java.net.Socket.connect(Socket.java:519)

        at java.net.Socket.connect(Socket.java:469)

        at org.apache.thrift.transport.TSocket.open(TSocket.java:180)

        ... 2 more

 

Thanks,

-Weijun


Re: Unable connect Thrift client to cassandra remotely (connection refused)

Posted by Kamal <kb...@gmail.com>.
Hi

i'm using apache-cassandra-0.6.1. I am also trying to connnect to remotely and
always get java.net.ConnectException.

I have ensured Firewall is turned off in both windows machine. 

I changed ThrifAddress to 192.168.2.55 as suggested in this thread but still get
same exception.

Exception connecting to 192.168.2.55/9160 - java.net.ConnectException: Connectio
n refused: connect

Am i missing anything here?? Please help..





RE: Unable connect Thrift client to cassandra remotely (connection refused)

Posted by Weijun Li <we...@gmail.com>.
Hi Jack, thanks a million! You saved my life :-)

I changed ThriftAddress from localhost to the server domain name and it now
works perfectly!

-Weijun

-----Original Message-----
From: Jack Culpepper [mailto:jackculpepper@gmail.com] 
Sent: Tuesday, February 09, 2010 1:12 AM
To: cassandra-user@incubator.apache.org
Subject: Re: Unable connect Thrift client to cassandra remotely (connection
refused)

Read the Miscellaneous section of this page:

http://wiki.apache.org/cassandra/StorageConfiguration

The default config binds only to localhost. You have to change
<ThriftAddress> if you want to connect remotely. Best,

Jack

On Tue, Feb 9, 2010 at 1:06 AM, Weijun Li <we...@gmail.com> wrote:
> Hello,
>
>
>
> I installed Cassandra  0.50 and started the instance without any problem.
> The problem is: if I run
>
>
>
> bin/cassandra-cli --host localhost -port 9160
>
>
>
> it worked perfectly.
>
>
>
> But whenever I tried to connect from any non-localhost and non-127.0.0.1
> address (from other server or same server with domain name), I got
> “connection refused”, --no matter how I open port, disable firewall or
> change port number.
>
>
>
> So is there any default restriction in Cassandra that doesn’t allow
> non-localhost client connection? How can I get Cassandra-cli to work
> remotely on an Cassandra instance? Also it seems to have same issue for
> nodeprobe.
>
>
>
> -bash-3.1# bin/cassandra-cli --host [xxxx-hostname] -port 9160
>
> Exception java.net.ConnectException: Connection refused
>
> org.apache.thrift.transport.TTransportException:
java.net.ConnectException:
> Connection refused
>
>         at org.apache.thrift.transport.TSocket.open(TSocket.java:185)
>
>         at org.apache.cassandra.cli.CliMain.connect(CliMain.java:65)
>
>         at org.apache.cassandra.cli.CliMain.main(CliMain.java:151)
>
> Caused by: java.net.ConnectException: Connection refused
>
>         at java.net.PlainSocketImpl.socketConnect(Native Method)
>
>         at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
>
>         at
> java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
>
>         at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
>
>         at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
>
>         at java.net.Socket.connect(Socket.java:519)
>
>         at java.net.Socket.connect(Socket.java:469)
>
>         at org.apache.thrift.transport.TSocket.open(TSocket.java:180)
>
>         ... 2 more
>
>
>
> Thanks,
>
> -Weijun


Re: Unable connect Thrift client to cassandra remotely (connection refused)

Posted by Jack Culpepper <ja...@gmail.com>.
Read the Miscellaneous section of this page:

http://wiki.apache.org/cassandra/StorageConfiguration

The default config binds only to localhost. You have to change
<ThriftAddress> if you want to connect remotely. Best,

Jack

On Tue, Feb 9, 2010 at 1:06 AM, Weijun Li <we...@gmail.com> wrote:
> Hello,
>
>
>
> I installed Cassandra  0.50 and started the instance without any problem.
> The problem is: if I run
>
>
>
> bin/cassandra-cli --host localhost -port 9160
>
>
>
> it worked perfectly.
>
>
>
> But whenever I tried to connect from any non-localhost and non-127.0.0.1
> address (from other server or same server with domain name), I got
> “connection refused”, --no matter how I open port, disable firewall or
> change port number.
>
>
>
> So is there any default restriction in Cassandra that doesn’t allow
> non-localhost client connection? How can I get Cassandra-cli to work
> remotely on an Cassandra instance? Also it seems to have same issue for
> nodeprobe.
>
>
>
> -bash-3.1# bin/cassandra-cli --host [xxxx-hostname] -port 9160
>
> Exception java.net.ConnectException: Connection refused
>
> org.apache.thrift.transport.TTransportException: java.net.ConnectException:
> Connection refused
>
>         at org.apache.thrift.transport.TSocket.open(TSocket.java:185)
>
>         at org.apache.cassandra.cli.CliMain.connect(CliMain.java:65)
>
>         at org.apache.cassandra.cli.CliMain.main(CliMain.java:151)
>
> Caused by: java.net.ConnectException: Connection refused
>
>         at java.net.PlainSocketImpl.socketConnect(Native Method)
>
>         at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
>
>         at
> java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
>
>         at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
>
>         at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
>
>         at java.net.Socket.connect(Socket.java:519)
>
>         at java.net.Socket.connect(Socket.java:469)
>
>         at org.apache.thrift.transport.TSocket.open(TSocket.java:180)
>
>         ... 2 more
>
>
>
> Thanks,
>
> -Weijun