You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@zookeeper.apache.org by Nathan Findley <na...@zenlok.com> on 2013/03/22 12:17:10 UTC

Best way to update node using command line

Could somebody suggest a simple way to alter a data node via the command 
line? I would prefer to use the default utilities that come with the 
download made available by apache.org. The only requirement is that I 
need to be able to specify newlines in the node's data.

Regards,
Nate

-- 
CTO
Zenlok株式会社


Re: Best way to update node using command line

Posted by Nathan Findley <na...@zenlok.com>.
On 03/26/2013 01:37 AM, Alexander Shraer wrote:
> I'm not sure how to do that, sorry, perhaps someone else has an idea.
>
> But you can take a look at ZooKeeperMain.java and perhaps add such an
> option if its not there.
>
> Thanks,
> Alex
>

No worries.  Much appreciated.

-- 
CTO
Zenlok株式会社


Re: Best way to update node using command line

Posted by Alexander Shraer <sh...@gmail.com>.
I'm not sure how to do that, sorry, perhaps someone else has an idea.

But you can take a look at ZooKeeperMain.java and perhaps add such an
option if its not there.

Thanks,
Alex

On Mon, Mar 25, 2013 at 12:48 AM, Nathan Findley <na...@zenlok.com> wrote:
> On 03/25/2013 04:27 PM, Alexander Shraer wrote:
>>
>> yeah, it splits using spaces.
>> but try this:
>>
>>> bin/zkCli.sh -server 127.0.0.1:2797 set /configs/collection1/nate  "test
>>> me \n here"
>>
>>
>> Alex
>>
>>
>>
>>
> Alex,
>
> Thanks for your input, but when I try that the value stored is not a
> newline, but a literal string "test me \n here".  I am hoping to be able to
> alter node value so that it contains newlines.  Can I redirect a file's
> contents into the set command?
>
>
> Regards,
> Nate
>
> --
> CTO
> Zenlok株式会社
>

Re: Best way to update node using command line

Posted by Nathan Findley <na...@zenlok.com>.
On 03/25/2013 04:27 PM, Alexander Shraer wrote:
> yeah, it splits using spaces.
> but try this:
>
>> bin/zkCli.sh -server 127.0.0.1:2797 set /configs/collection1/nate  "test me \n here"
>
> Alex
>
>
>
>
Alex,

Thanks for your input, but when I try that the value stored is not a 
newline, but a literal string "test me \n here".  I am hoping to be able 
to alter node value so that it contains newlines.  Can I redirect a 
file's contents into the set command?

Regards,
Nate

-- 
CTO
Zenlok株式会社


Re: Best way to update node using command line

Posted by Alexander Shraer <sh...@gmail.com>.
yeah, it splits using spaces.
but try this:

> bin/zkCli.sh -server 127.0.0.1:2797 set /configs/collection1/nate  "test me \n here"


Alex



On Sun, Mar 24, 2013 at 11:22 PM, Nathan Findley <na...@zenlok.com> wrote:
> On 03/25/2013 03:11 PM, Alexander Shraer wrote:
>>
>> Hi Nate,
>>
>> You can use ZooKeeper CLI.
>>
>>> bin/zkCli.sh -server <host:port>
>>
>> starts the CLI in interactive mode but if you do
>>
>>> bin/zkCli.sh -server <host:port> command args
>>
>> It will just run that one command. There is also a similar way of
>> doing it with the C cli.
>>
>> The code for the java CLI is in ZooKeeperMain.java.
>>
>> Alex
>>
>> On Sun, Mar 24, 2013 at 8:48 PM, Nathan Findley <na...@zenlok.com> wrote:
>>>
>>> On 03/22/2013 08:17 PM, Nathan Findley wrote:
>>>>
>>>> Could somebody suggest a simple way to alter a data node via the command
>>>> line? I would prefer to use the default utilities that come with the
>>>> download made available by apache.org. The only requirement is that I
>>>> need
>>>> to be able to specify newlines in the node's data.
>>>>
>>>> Regards,
>>>> Nate
>>>>
>>> Is this a poorly phrased question or am I missing something that is
>>> obvious?
>>>
>>> --
>>> CTO
>>> Zenlok株式会社
>>>
> Alex,
>
> Just to illustrate my ignorance, when using zkCli.sh I am trying to add a
> newline to the data:
>
> [zk: localhost:2181(CONNECTED) 21] set /configs/collection1/nate test me \n
> here
> Command failed: java.lang.NumberFormatException: For input string: "me"
> [zk: localhost:2181(CONNECTED) 22]
>
> I am doing this because I am using zookeeper + solr 4, which writes to a
> data properties file inside zookeeper that I would like to edit, but has
> more than one line.
>
>
> Regards,
> Nate
>
> --
> CTO
> Zenlok株式会社
>

Re: Best way to update node using command line

Posted by Nathan Findley <na...@zenlok.com>.
On 03/25/2013 03:11 PM, Alexander Shraer wrote:
> Hi Nate,
>
> You can use ZooKeeper CLI.
>
>> bin/zkCli.sh -server <host:port>
> starts the CLI in interactive mode but if you do
>
>> bin/zkCli.sh -server <host:port> command args
> It will just run that one command. There is also a similar way of
> doing it with the C cli.
>
> The code for the java CLI is in ZooKeeperMain.java.
>
> Alex
>
> On Sun, Mar 24, 2013 at 8:48 PM, Nathan Findley <na...@zenlok.com> wrote:
>> On 03/22/2013 08:17 PM, Nathan Findley wrote:
>>> Could somebody suggest a simple way to alter a data node via the command
>>> line? I would prefer to use the default utilities that come with the
>>> download made available by apache.org. The only requirement is that I need
>>> to be able to specify newlines in the node's data.
>>>
>>> Regards,
>>> Nate
>>>
>> Is this a poorly phrased question or am I missing something that is obvious?
>>
>> --
>> CTO
>> Zenlok株式会社
>>
Alex,

Just to illustrate my ignorance, when using zkCli.sh I am trying to add 
a newline to the data:

[zk: localhost:2181(CONNECTED) 21] set /configs/collection1/nate test me 
\n here
Command failed: java.lang.NumberFormatException: For input string: "me"
[zk: localhost:2181(CONNECTED) 22]

I am doing this because I am using zookeeper + solr 4, which writes to a 
data properties file inside zookeeper that I would like to edit, but has 
more than one line.

Regards,
Nate

-- 
CTO
Zenlok株式会社


Re: Best way to update node using command line

Posted by Alexander Shraer <sh...@gmail.com>.
Hi Nate,

You can use ZooKeeper CLI.

> bin/zkCli.sh -server <host:port>

starts the CLI in interactive mode but if you do

> bin/zkCli.sh -server <host:port> command args

It will just run that one command. There is also a similar way of
doing it with the C cli.

The code for the java CLI is in ZooKeeperMain.java.

Alex

On Sun, Mar 24, 2013 at 8:48 PM, Nathan Findley <na...@zenlok.com> wrote:
> On 03/22/2013 08:17 PM, Nathan Findley wrote:
>>
>> Could somebody suggest a simple way to alter a data node via the command
>> line? I would prefer to use the default utilities that come with the
>> download made available by apache.org. The only requirement is that I need
>> to be able to specify newlines in the node's data.
>>
>> Regards,
>> Nate
>>
>
> Is this a poorly phrased question or am I missing something that is obvious?
>
> --
> CTO
> Zenlok株式会社
>

Re: Best way to update node using command line

Posted by Nathan Findley <na...@zenlok.com>.
On 03/22/2013 08:17 PM, Nathan Findley wrote:
> Could somebody suggest a simple way to alter a data node via the 
> command line? I would prefer to use the default utilities that come 
> with the download made available by apache.org. The only requirement 
> is that I need to be able to specify newlines in the node's data.
>
> Regards,
> Nate
>

Is this a poorly phrased question or am I missing something that is obvious?

-- 
CTO
Zenlok株式会社