[root@name01 zookeeper-3.4.6]# cd -
/usr/local/zookeeper/zookeeper-3.4.6/bin
[root@name01 bin]# ls -l
total 36
-rwxr-xr-x 1 1000 1000  238 Feb 20  2014 README.txt
-rwxr-xr-x 1 1000 1000 1937 Feb 20  2014 zkCleanup.sh
-rwxr-xr-x 1 1000 1000 1049 Feb 20  2014 zkCli.cmd
-rwxr-xr-x 1 1000 1000 1534 Feb 20  2014 zkCli.sh
-rwxr-xr-x 1 1000 1000 1333 Feb 20  2014 zkEnv.cmd
-rwxr-xr-x 1 1000 1000 2696 Feb 20  2014 zkEnv.sh
-rwxr-xr-x 1 1000 1000 1084 Feb 20  2014 zkServer.cmd
-rwxr-xr-x 1 1000 1000 5742 Feb 20  2014 zkServer.sh
[root@name01 bin]# pwd
/usr/local/zookeeper/zookeeper-3.4.6/bin
[root@name01 bin]# vi zkEnv.sh 
[root@name01 bin]# zkServer.sh start
JMX enabled by default
Using config: /usr/local/zookeeper/zookeeper-3.4.6/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@name01 bin]# jps
18433 Master
17602 DataNode
17926 ResourceManager
17513 NameNode
19322 SparkSubmit
17724 SecondaryNameNode
26062 QuorumPeerMain
26078 Jps
18015 NodeManager
[root@name01 bin]# jps
18433 Master
17602 DataNode
17926 ResourceManager
17513 NameNode
19322 SparkSubmit
17724 SecondaryNameNode
26062 QuorumPeerMain
26126 Jps
18015 NodeManager
[root@name01 bin]# 
[root@name01 bin]# 
[root@name01 bin]# zkServer.sh status
JMX enabled by default
Using config: /usr/local/zookeeper/zookeeper-3.4.6/bin/../conf/zoo.cfg
Mode: standalone
[root@name01 bin]# zkCli.sh
Connecting to localhost:2181
2016-06-12 18:06:04,162 [myid:] - INFO  [main:Environment@100] - Client environment:zookeeper.version=3.4.6-1569965, built on 02/20/2014 09:09 GMT
2016-06-12 18:06:04,180 [myid:] - INFO  [main:Environment@100] - Client environment:host.name=localhost
2016-06-12 18:06:04,180 [myid:] - INFO  [main:Environment@100] - Client environment:java.version=1.8.0_20
2016-06-12 18:06:04,183 [myid:] - INFO  [main:Environment@100] - Client environment:java.vendor=Oracle Corporation
2016-06-12 18:06:04,183 [myid:] - INFO  [main:Environment@100] - Client environment:java.home=/usr/local/jdk/jre
2016-06-12 18:06:04,183 [myid:] - INFO  [main:Environment@100] - Client environment:java.class.path=/usr/local/zookeeper/zookeeper-3.4.6/bin/../build/classes:/usr/local/zookeeper/zookeeper-3.4.6/bin/../build/lib/*.jar:/usr/local/zookeeper/zookeeper-3.4.6/bin/../lib/slf4j-log4j12-1.6.1.jar:/usr/local/zookeeper/zookeeper-3.4.6/bin/../lib/slf4j-api-1.6.1.jar:/usr/local/zookeeper/zookeeper-3.4.6/bin/../lib/netty-3.7.0.Final.jar:/usr/local/zookeeper/zookeeper-3.4.6/bin/../lib/log4j-1.2.16.jar:/usr/local/zookeeper/zookeeper-3.4.6/bin/../lib/jline-0.9.94.jar:/usr/local/zookeeper/zookeeper-3.4.6/bin/../zookeeper-3.4.6.jar:/usr/local/zookeeper/zookeeper-3.4.6/bin/../src/java/lib/*.jar:/usr/local/zookeeper/zookeeper-3.4.6/bin/../conf:
2016-06-12 18:06:04,183 [myid:] - INFO  [main:Environment@100] - Client environment:java.library.path=/usr/java/packages/lib/i386:/lib:/usr/lib
2016-06-12 18:06:04,184 [myid:] - INFO  [main:Environment@100] - Client environment:java.io.tmpdir=/tmp
2016-06-12 18:06:04,186 [myid:] - INFO  [main:Environment@100] - Client environment:java.compiler=<NA>
2016-06-12 18:06:04,187 [myid:] - INFO  [main:Environment@100] - Client environment:os.name=Linux
2016-06-12 18:06:04,187 [myid:] - INFO  [main:Environment@100] - Client environment:os.arch=i386
2016-06-12 18:06:04,187 [myid:] - INFO  [main:Environment@100] - Client environment:os.version=2.6.32-358.el6.i686
2016-06-12 18:06:04,187 [myid:] - INFO  [main:Environment@100] - Client environment:user.name=root
2016-06-12 18:06:04,188 [myid:] - INFO  [main:Environment@100] - Client environment:user.home=/root
2016-06-12 18:06:04,188 [myid:] - INFO  [main:Environment@100] - Client environment:user.dir=/usr/local/zookeeper/zookeeper-3.4.6/bin
2016-06-12 18:06:04,191 [myid:] - INFO  [main:ZooKeeper@438] - Initiating client connection, connectString=localhost:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@6c589e
Welcome to ZooKeeper!
2016-06-12 18:06:04,272 [myid:] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@975] - Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
JLine support is enabled
[zk: localhost:2181(CONNECTING) 0] 2016-06-12 18:06:04,461 [myid:] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@852] - Socket connection established to localhost/127.0.0.1:2181, initiating session
2016-06-12 18:06:04,508 [myid:] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1235] - Session establishment complete on server localhost/127.0.0.1:2181, sessionid = 0x15547453b750000, negotiated timeout = 30000

WATCHER::

WatchedEvent state:SyncConnected type:None path:null

[zk: localhost:2181(CONNECTED) 0] 
[zk: localhost:2181(CONNECTED) 0] 
[zk: localhost:2181(CONNECTED) 0] zkServer.sh stop
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) 1] jps
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) 2] jps
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) 3] zkServer.sh stop
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) 4] quit;
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) 5] zkServer.sh quit
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) 6] help
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] quit 
Quitting...
2016-06-12 18:10:29,234 [myid:] - INFO  [main-EventThread:ClientCnxn$EventThread@512] - EventThread shut down
2016-06-12 18:10:29,234 [myid:] - INFO  [main:ZooKeeper@684] - Session: 0x15547453b750000 closed
[root@name01 bin]# zkServer.sh status
JMX enabled by default
Using config: /usr/local/zookeeper/zookeeper-3.4.6/bin/../conf/zoo.cfg
Mode: standalone
[root@name01 bin]# jps
18433 Master
17602 DataNode
17926 ResourceManager
26249 Jps
17513 NameNode
19322 SparkSubmit
17724 SecondaryNameNode
26062 QuorumPeerMain
18015 NodeManager
[root@name01 bin]# zkServer.sh status
JMX enabled by default
Using config: /usr/local/zookeeper/zookeeper-3.4.6/bin/../conf/zoo.cfg
Mode: standalone
[root@name01 bin]# zkServer.sh stop
JMX enabled by default
Using config: /usr/local/zookeeper/zookeeper-3.4.6/bin/../conf/zoo.cfg
Stopping zookeeper ... STOPPED
[root@name01 bin]# jps
18433 Master
17602 DataNode
17926 ResourceManager
17513 NameNode
19322 SparkSubmit
17724 SecondaryNameNode
26302 Jps
18015 NodeManager
[root@name01 bin]# 

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐