gan in the target detection application

2023-01-23   ES  

There are several client script tools in the BIN directory in Zookeeper installation directory. This article involves the node operation of zkcl.sh to Zookeeper server;

After the establishment of a Zookeeper cluster that can run normally (Set up zookeeper cluster), you can use the zkcl.sh client to operate the zookeeper; after entering the bin directory, execute the zkcl.sh command:

can see the above output information, indicating that it has been connected to the Zookeeper server normally, and directly use zkcl.sh to log in to the client. On the designated Zookeeper server, you can use the connection command with an address, as follows:

zkCli.sh -server  ip:port

1. Create nodes

Use the Create command, you can create a zookeeper node:

create [-s] [-e] path data acl

-S and -E Specify node characteristics: order or temporary node, and in default, if the -S or -E parameters are not added, the lasting node is created

ACL: Used to control permissions. In the case of default, no permissions control.

PATH: Node Road Time

data: The data saved by the node

Example:

WatchedEvent state:SyncConnected type:None path:null
create /zk-user yzr
Created /zk-user
[zk: localhost:2181(CONNECTED) 1] 

After executing the Create /ZK-User YZR command, a node called /zk-user is created under the root node of Zookeeper, and the data content of the node is “yzr”;

2. Read node data

Read that there are two related commands, one is LS, which is used to view the distribution of the node. The other is to view the data and attributes of the specific nodes.

Use LS, you can view all the sub -nodes under the specified node of Zookeeper, but you can only see the sub -node under the specified node, that is, the first -level sub -node, other sub -nodes are invisible.

The first deployment of the Zookeeper cluster, the default at the root node “/” there is a reserved node of/zookeeper:

[zk: localhost:2181(CONNECTED) 1] ls /
[zk-user, zookeeper]
[zk: localhost:2181(CONNECTED) 2] 

You can see that there are two first-level sub-nodes under the root node, .zk-user and zookeeper sub-node.

Use get to get the data content and attribute information of the specified node specified by ZooKeeper: Get Path [Watch]

[zk: localhost:2181(CONNECTED) 2] get /zk-user
yzr
cZxid = 0x300000002
ctime = Wed Jul 26 19:32:54 CST 2017
mZxid = 0x300000002
mtime = Wed Jul 26 19:32:54 CST 2017
pZxid = 0x300000002
cversion = 0
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 3
numChildren = 0
[zk: localhost:2181(CONNECTED) 3] 

From the output information, you can see that the first line is the data content of the node, and the remaining content is the data structure of the zookeeper node.

3. Update node data content

Use the set command to update the data content of the specified node:

set path data [version]

Data is a new content of the update. After followed by a Version parameter, in Zookeeper, the data of the node has a version concept. Version is used to specify which data version of this update operation is based on ZNODE.

[zk: localhost:2181(CONNECTED) 3] set /zk-user lyf
cZxid = 0x300000002
ctime = Wed Jul 26 19:32:54 CST 2017
mZxid = 0x300000003
mtime = Wed Jul 26 19:47:15 CST 2017
pZxid = 0x300000002
cversion = 0
dataVersion = 1
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 3
numChildren = 0
[zk: localhost:2181(CONNECTED) 4] 

/zk-user node data content is changed to LYF, and the value of the dataVersion becomes 1. The data version of the node has changed.

4. Delete nodes

delete command can delete the specified node on the zookeeper:

delete path [version]

[zk: localhost:2181(CONNECTED) 4] delete /zk-user
[zk: localhost:2181(CONNECTED) 5] ls /
[zookeeper]
[zk: localhost:2181(CONNECTED) 6] 

execute the above command to delete the/zk-user node. One thing to pay attention to is that if you want to delete a specified node, the node must have no sub-node, otherwise it will be reported to NODE NOT EMPTY error;

5. Command help

Use H command to view all the commands supported under zkcl.sh:

[zk: localhost:2181(CONNECTED) 6] h
ZooKeeper -server host:port cmd args
        stat path [watch]
        set path data [version]
        ls path [watch]
        delquota [-n|-b] path
        ls2 path [watch]
        setAcl path acl
        setquota -n|-b val path
        history 
        redo cmdno
        printwatches on|off
        delete path [version]
        sync path
        listquota path
        rmr path
        get path [watch]
        create [-s] [-e] path data acl
        addauth scheme auth
        quit 
        getAcl path
        close 
        connect host:port
[zk: localhost:2181(CONNECTED) 7] 

6. Other nodes

Stat Path [watch]: View status information of the specified node:

[zk: localhost:2181(CONNECTED) 7] stat /zookeeper
cZxid = 0x0
ctime = Thu Jan 01 08:00:00 CST 1970
mZxid = 0x0
mtime = Thu Jan 01 08:00:00 CST 1970
pZxid = 0x0
cversion = -1
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 0
numChildren = 1
[zk: localhost:2181(CONNECTED) 8] 

ls2: Wait for the two commands of LS+ STAT, the role is their combination:

[zk: localhost:2181(CONNECTED) 8] ls2 /zookeeper
[quota]
cZxid = 0x0
ctime = Thu Jan 01 08:00:00 CST 1970
mZxid = 0x0
mtime = Thu Jan 01 08:00:00 CST 1970
pZxid = 0x0
cversion = -1
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 0
numChildren = 1
[zk: localhost:2181(CONNECTED) 9] 

RMR Path: Delete at the joint level, delete the current path node and all its sub -nodes

[zk: localhost:2181(CONNECTED) 14] create /zk-test 123
Created /zk-test
[zk: localhost:2181(CONNECTED) 15] create /zk-test/info 456
Created /zk-test/info
[zk: localhost:2181(CONNECTED) 16] ls /
[zk-test, zookeeper]
[zk: localhost:2181(CONNECTED) 17] ls /zk-test
[info]
[zk: localhost:2181(CONNECTED) 18] rmr /zk-test
[zk: localhost:2181(CONNECTED) 19] ls
[zk: localhost:2181(CONNECTED) 20] ls /
[zookeeper]
[zk: localhost:2181(CONNECTED) 21] 

setquota: Set the quota, -N the number of designated sub-nodes, -b is the data length of limited sub-nodes. After exceeding the quota, zookeeper will not report an error, but record in the log information (you can view zookeeeper.out)

Listquota Path: View the quota information of the path node

delquota [-n | -b] Path: Delete the quota information of the node path

Connect Host: Port and Close: Connect other Zookeeper servers and close servers in the current connection

History and Redo CMDNO: View all commands and execution of the historical commands of the specified CMD number performed by the client

[zk: localhost:2181(CONNECTED) 21] history
11 – create /zk-test/info/data
12 – ls /zk-test
13 – ls /
14 – create /zk-test 123
15 – create /zk-test/info 456
16 – ls /
17 – ls /zk-test
18 – rmr /zk-test
19 – ls
20 – ls /
21 – history
[zk: localhost:2181(CONNECTED) 22] redo 14
Created /zk-test
[zk: localhost:2181(CONNECTED) 23] 

Quit: Exit the client

[zk: localhost:2181(CONNECTED) 23] quit
Quitting…
2017-07-26 20:17:31,138 [myid:] – INFO  [main:[email protected]] – Session: 0x15d7e8ab8ca0000 closed
2017-07-26 20:17:31,146 [myid:] – INFO  [main-EventThread:[email protected]] – EventThread shut down for session: 0x15d7e8ab8ca0000
[[email protected] bin]# 

source

Related Posts

PyTorch-Losses and optimizers understanding

Lesson 6: emit GUI element Dream

SCRAPYD batch to clear pending task Refrain

Directory traversal learning

gan in the target detection application

Random Posts

Video monitoring

jmeter pressure test value configuration JDBC Connection Configuration (1)

JENKINS Gradle plug -in configuration

Elementui restrictions start and end the number of days of the end of the day, you can choose up to 31 days

Shenzhou III number serial port 2 Send experimental program