ZooKeeper client connection serialized protocol buffer

A connection ZooKeeper client  

1. encountered a problem when performing zkCli.sh

-bash: zkCli.sh: command not found

2. The introduction of environmental variables on the line, pay attention to the bin directory

locate  zkCli.sh

/opt/cloudera/parcels/CDH-5.13.1-1.cdh5.13.1.p0.2/lib/zookeeper/bin/zkCli.sh

export PATH=/opt/cloudera/parcels/CDH-5.13.1-1.cdh5.13.1.p0.2/lib/zookeeper/bin:$PATH

3. When you can do whatever

4. View a copy of the case ls / hbase / replication

 

Two, protocol buffer serialized

Come on, leave it to convert the file into a proto-generated Java file cmd command. \ Protoc.exe --java_out =.. \ Risk.proto

1. The new version of the program to make storage serialized with a protocol buffer. Thrown to a buff will be serialized hex head. (Hbase client binary not show, will be displayed in hex)

See thrown to the code sequence is a structure of buf

1.2 continue to look

pb results hex head plus value, which is obviously not the Pb structure.

Look at the code

Direct thrown to the string

 

Look again at 1.3

Data format on the HDFS

Hbase into the data format, each field has a hexadecimal \ x0 beginning

Third, on the zkCli.sh

1. zkCli.sh representation of the path name for zookeeper-client /opt/cloudera/parcels/CDH-5.13.1-1.cdh5.13.1.p0.2/bin

Can be started directly by zookeeper-client

 

2. cd to the directory each time it needs, too much trouble, and thus used the alias

alias zkCli.sh='/opt/cloudera/parcels/CDH-5.13.1-1.cdh5.13.1.p0.2/bin/zookeeper-client'

3. 可以加到环境变量  .bashrc 里,以后直接zkCli.sh 就可以启动啦。

另外 shift zz =wq! (vi 模式下的保存)

发布了131 篇原创文章 · 获赞 79 · 访问量 31万+

Guess you like

Origin blog.csdn.net/qq_31780525/article/details/101051426