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

Connect to localhost is ok,but the ip fails.

I'm using cassandra 0.7 .
And in storage-conf .

# The address to bind the Thrift RPC service to
rpc_address: localhost
# port for Thrift to listen on
rpc_port: 9160

In my client , the code below works successfully.

        TSocket socket = new TSocket("localhost", 9160);
        TTransport trans =
Boolean.valueOf(System.getProperty("cassandra.framed", "true")) ? new
TFramedTransport(
                socket) : socket;
        trans.open();

But if i changed "localhost" to the localhost's ip , throws out the
"java.net.ConnectException: Connection refused".

And the connecting to other ip also fails.

-- 
Best regards,

Ivy Tang

Re: Connect to localhost is ok,but the ip fails.

Posted by Benjamin Black <b...@b3k.us>.
correct, 0.0.0.0 is a wildcard.

On Thu, Sep 9, 2010 at 1:19 PM, Aaron Morton <aa...@thelastpickle.com> wrote:
> I  set this to 0.0.0.0 I think the original storage_config.xml had a comment
> that it would make thrift respond on all interfaces.
> Aaron
> On 09 Sep, 2010,at 08:37 PM, Benjamin Black <b...@b3k.us> wrote:
>
> when you say "localhost's ip" do you mean 127.0.0.1 or do you mean an
> ip on its local interface?
>
> On Thu, Sep 9, 2010 at 1:29 AM, Ying Tang <iv...@gmail.com> wrote:
>> oh.solve it.
>>
>> Change the rpc_address to my localhost's ip ,then in the client code ,the
>> TSocket can connect to the ip.
>>
>> On Thu, Sep 9, 2010 at 4:14 AM, Ying Tang <iv...@gmail.com> wrote:
>>>
>>> no , i didn't change the yaml file.
>>>
>>> On Thu, Sep 9, 2010 at 4:10 AM, Benjamin Black <b...@b3k.us> wrote:
>>>>
>>>> Do you mean you are changing the yaml file?  Does 'netstat -an | grep
>>>> 9160' indicate cassandra is bound to ipv4 or ipv6 (tcp vs tcp6 in the
>>>> netstat output)?
>>>>
>>>>
>>>> b
>>>>
>>>> On Thu, Sep 9, 2010 at 1:06 AM, Ying Tang <iv...@gmail.com> wrote:
>>>> > I'm using cassandra 0.7 .
>>>> > And in storage-conf .
>>>> >
>>>> > # The address to bind the Thrift RPC service to
>>>> > rpc_address: localhost
>>>> > # port for Thrift to listen on
>>>> > rpc_port: 9160
>>>> >
>>>> > In my client , the code below works successfully.
>>>> >
>>>> >         TSocket socket = new TSocket("localhost", 9160);
>>>> >         TTransport trans =
>>>> > Boolean.valueOf(System.getProperty("cassandra.framed", "true")) ? new
>>>> > TFramedTransport(
>>>> >                 socket) : socket;
>>>> >         trans.open();
>>>> >
>>>> > But if i changed "localhost" to the localhost's ip , throws out the
>>>> > "java.net.ConnectException: Connection refused".
>>>> >
>>>> > And the connecting to other ip also fails.
>>>> >
>>>> > --
>>>> > Best regards,
>>>> > Ivy Tang
>>>> >
>>>> >
>>>> >
>>>
>>>
>>>
>>> --
>>> Best regards,
>>> Ivy Tang
>>>
>>>
>>
>>
>>
>> --
>> Best regards,
>> Ivy Tang
>>
>>
>>
>

Re: Connect to localhost is ok,but the ip fails.

Posted by Aaron Morton <aa...@thelastpickle.com>.
I  set this to 0.0.0.0 I think the original storage_config.xml had a comment that it would make thrift respond on all interfaces. 

Aaron

On 09 Sep, 2010,at 08:37 PM, Benjamin Black <b...@b3k.us> wrote:

when you say "localhost's ip" do you mean 127.0.0.1 or do you mean an
ip on its local interface?

On Thu, Sep 9, 2010 at 1:29 AM, Ying Tang <iv...@gmail.com> wrote:
> oh.solve it.
>
> Change the rpc_address to my localhost's ip ,then in the client code ,the
> TSocket can connect to the ip.
>
> On Thu, Sep 9, 2010 at 4:14 AM, Ying Tang <iv...@gmail.com> wrote:
>>
>> no , i didn't change the yaml file.
>>
>> On Thu, Sep 9, 2010 at 4:10 AM, Benjamin Black <b...@b3k.us> wrote:
>>>
>>> Do you mean you are changing the yaml file?  Does 'netstat -an | grep
>>> 9160' indicate cassandra is bound to ipv4 or ipv6 (tcp vs tcp6 in the
>>> netstat output)?
>>>
>>>
>>> b
>>>
>>> On Thu, Sep 9, 2010 at 1:06 AM, Ying Tang <iv...@gmail.com> wrote:
>>> > I'm using cassandra 0.7 .
>>> > And in storage-conf .
>>> >
>>> > # The address to bind the Thrift RPC service to
>>> > rpc_address: localhost
>>> > # port for Thrift to listen on
>>> > rpc_port: 9160
>>> >
>>> > In my client , the code below works successfully.
>>> >
>>> >         TSocket socket = new TSocket("localhost", 9160);
>>> >         TTransport trans =
>>> > Boolean.valueOf(System.getProperty("cassandra.framed", "true")) ? new
>>> > TFramedTransport(
>>> >                 socket) : socket;
>>> >         trans.open();
>>> >
>>> > But if i changed "localhost" to the localhost's ip , throws out the
>>> > "java.net.ConnectException: Connection refused".
>>> >
>>> > And the connecting to other ip also fails.
>>> >
>>> > --
>>> > Best regards,
>>> > Ivy Tang
>>> >
>>> >
>>> >
>>
>>
>>
>> --
>> Best regards,
>> Ivy Tang
>>
>>
>
>
>
> --
> Best regards,
> Ivy Tang
>
>
>

Re: Connect to localhost is ok,but the ip fails.

Posted by Benjamin Black <b...@b3k.us>.
when you say "localhost's ip" do you mean 127.0.0.1 or do you mean an
ip on its local interface?

On Thu, Sep 9, 2010 at 1:29 AM, Ying Tang <iv...@gmail.com> wrote:
> oh.solve it.
>
> Change the rpc_address to my localhost's ip ,then in the client code ,the
> TSocket can connect to the ip.
>
> On Thu, Sep 9, 2010 at 4:14 AM, Ying Tang <iv...@gmail.com> wrote:
>>
>> no , i didn't change the yaml file.
>>
>> On Thu, Sep 9, 2010 at 4:10 AM, Benjamin Black <b...@b3k.us> wrote:
>>>
>>> Do you mean you are changing the yaml file?  Does 'netstat -an | grep
>>> 9160' indicate cassandra is bound to ipv4 or ipv6 (tcp vs tcp6 in the
>>> netstat output)?
>>>
>>>
>>> b
>>>
>>> On Thu, Sep 9, 2010 at 1:06 AM, Ying Tang <iv...@gmail.com> wrote:
>>> > I'm using cassandra 0.7 .
>>> > And in storage-conf .
>>> >
>>> > # The address to bind the Thrift RPC service to
>>> > rpc_address: localhost
>>> > # port for Thrift to listen on
>>> > rpc_port: 9160
>>> >
>>> > In my client , the code below works successfully.
>>> >
>>> >         TSocket socket = new TSocket("localhost", 9160);
>>> >         TTransport trans =
>>> > Boolean.valueOf(System.getProperty("cassandra.framed", "true")) ? new
>>> > TFramedTransport(
>>> >                 socket) : socket;
>>> >         trans.open();
>>> >
>>> > But if i changed "localhost" to the localhost's ip , throws out the
>>> > "java.net.ConnectException: Connection refused".
>>> >
>>> > And the connecting to other ip also fails.
>>> >
>>> > --
>>> > Best regards,
>>> > Ivy Tang
>>> >
>>> >
>>> >
>>
>>
>>
>> --
>> Best regards,
>> Ivy Tang
>>
>>
>
>
>
> --
> Best regards,
> Ivy Tang
>
>
>

Re: Connect to localhost is ok,but the ip fails.

Posted by Ying Tang <iv...@gmail.com>.
oh.solve it.

Change the rpc_address to my localhost's ip ,then in the client code ,the
TSocket can connect to the ip.

On Thu, Sep 9, 2010 at 4:14 AM, Ying Tang <iv...@gmail.com> wrote:

> no , i didn't change the yaml file.
>
>
> On Thu, Sep 9, 2010 at 4:10 AM, Benjamin Black <b...@b3k.us> wrote:
>
>> Do you mean you are changing the yaml file?  Does 'netstat -an | grep
>> 9160' indicate cassandra is bound to ipv4 or ipv6 (tcp vs tcp6 in the
>> netstat output)?
>>
>>
>> b
>>
>> On Thu, Sep 9, 2010 at 1:06 AM, Ying Tang <iv...@gmail.com> wrote:
>> > I'm using cassandra 0.7 .
>> > And in storage-conf .
>> >
>> > # The address to bind the Thrift RPC service to
>> > rpc_address: localhost
>> > # port for Thrift to listen on
>> > rpc_port: 9160
>> >
>> > In my client , the code below works successfully.
>> >
>> >         TSocket socket = new TSocket("localhost", 9160);
>> >         TTransport trans =
>> > Boolean.valueOf(System.getProperty("cassandra.framed", "true")) ? new
>> > TFramedTransport(
>> >                 socket) : socket;
>> >         trans.open();
>> >
>> > But if i changed "localhost" to the localhost's ip , throws out the
>> > "java.net.ConnectException: Connection refused".
>> >
>> > And the connecting to other ip also fails.
>> >
>> > --
>> > Best regards,
>> > Ivy Tang
>> >
>> >
>> >
>>
>
>
>
> --
> Best regards,
>
> Ivy Tang
>
>
>
>


-- 
Best regards,

Ivy Tang

Re: Connect to localhost is ok,but the ip fails.

Posted by Ying Tang <iv...@gmail.com>.
no , i didn't change the yaml file.

On Thu, Sep 9, 2010 at 4:10 AM, Benjamin Black <b...@b3k.us> wrote:

> Do you mean you are changing the yaml file?  Does 'netstat -an | grep
> 9160' indicate cassandra is bound to ipv4 or ipv6 (tcp vs tcp6 in the
> netstat output)?
>
>
> b
>
> On Thu, Sep 9, 2010 at 1:06 AM, Ying Tang <iv...@gmail.com> wrote:
> > I'm using cassandra 0.7 .
> > And in storage-conf .
> >
> > # The address to bind the Thrift RPC service to
> > rpc_address: localhost
> > # port for Thrift to listen on
> > rpc_port: 9160
> >
> > In my client , the code below works successfully.
> >
> >         TSocket socket = new TSocket("localhost", 9160);
> >         TTransport trans =
> > Boolean.valueOf(System.getProperty("cassandra.framed", "true")) ? new
> > TFramedTransport(
> >                 socket) : socket;
> >         trans.open();
> >
> > But if i changed "localhost" to the localhost's ip , throws out the
> > "java.net.ConnectException: Connection refused".
> >
> > And the connecting to other ip also fails.
> >
> > --
> > Best regards,
> > Ivy Tang
> >
> >
> >
>



-- 
Best regards,

Ivy Tang

Re: Connect to localhost is ok,but the ip fails.

Posted by Benjamin Black <b...@b3k.us>.
Do you mean you are changing the yaml file?  Does 'netstat -an | grep
9160' indicate cassandra is bound to ipv4 or ipv6 (tcp vs tcp6 in the
netstat output)?


b

On Thu, Sep 9, 2010 at 1:06 AM, Ying Tang <iv...@gmail.com> wrote:
> I'm using cassandra 0.7 .
> And in storage-conf .
>
> # The address to bind the Thrift RPC service to
> rpc_address: localhost
> # port for Thrift to listen on
> rpc_port: 9160
>
> In my client , the code below works successfully.
>
>         TSocket socket = new TSocket("localhost", 9160);
>         TTransport trans =
> Boolean.valueOf(System.getProperty("cassandra.framed", "true")) ? new
> TFramedTransport(
>                 socket) : socket;
>         trans.open();
>
> But if i changed "localhost" to the localhost's ip , throws out the
> "java.net.ConnectException: Connection refused".
>
> And the connecting to other ip also fails.
>
> --
> Best regards,
> Ivy Tang
>
>
>