zookeeper 注册中心的简单搭建

zookeeper 官网
官网地址
zookeeper 部署
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
➜  ~ sftp root@106.15.xxx.xxx
Connected to 106.15.xxx.xxx.
sftp> put /Users/niuhesm/resouces/major/remoteServer/zookeeper-3.4.10.tar.gz /usr/local/zookeeper
Uploading /Users/niuhesm/resouces/major/remoteServer/zookeeper-3.4.10.tar.gz to /usr/local/zookeeper/zookeeper-3.4.10.tar.gz
/Users/niuhesm/resouces/major/remoteServer/zookeeper-3.4.10.tar.gz 100% 33MB 1.2MB/s 00:28
sftp>

[root@iZuf6iq8e7ya9v3ix71k0pZ zookeeper]# tar zxf zookeeper-3.4.10.tar.gz
[root@iZuf6iq8e7ya9v3ix71k0pZ zookeeper]# ll
总用量 34228
drwxr-xr-x 10 www www 4096 3月 23 2017 zookeeper-3.4.10
-rw-r--r-- 1 root root 35042811 2月 18 13:59 zookeeper-3.4.10.tar.gz
[root@iZuf6iq8e7ya9v3ix71k0pZ zookeeper-3.4.10]# ll
总用量 1588
drwxr-xr-x 2 www www 4096 3月 23 2017 bin
-rw-rw-r-- 1 www www 84725 3月 23 2017 build.xml
drwxr-xr-x 2 www www 4096 3月 23 2017 conf
drwxr-xr-x 10 www www 4096 3月 23 2017 contrib
drwxr-xr-x 2 www www 4096 3月 23 2017 dist-maven
drwxr-xr-x 6 www www 4096 3月 23 2017 docs
-rw-rw-r-- 1 www www 1709 3月 23 2017 ivysettings.xml
-rw-rw-r-- 1 www www 5691 3月 23 2017 ivy.xml
drwxr-xr-x 4 www www 4096 3月 23 2017 lib
-rw-rw-r-- 1 www www 11938 3月 23 2017 LICENSE.txt
-rw-rw-r-- 1 www www 3132 3月 23 2017 NOTICE.txt
-rw-rw-r-- 1 www www 1770 3月 23 2017 README_packaging.txt
-rw-rw-r-- 1 www www 1585 3月 23 2017 README.txt
drwxr-xr-x 5 www www 4096 3月 23 2017 recipes
drwxr-xr-x 8 www www 4096 3月 23 2017 src
-rw-rw-r-- 1 www www 1456729 3月 23 2017 zookeeper-3.4.10.jar
-rw-rw-r-- 1 www www 819 3月 23 2017 zookeeper-3.4.10.jar.asc
-rw-rw-r-- 1 www www 33 3月 23 2017 zookeeper-3.4.10.jar.md5
-rw-rw-r-- 1 www www 41 3月 23 2017 zookeeper-3.4.10.jar.sha1
[root@iZuf6iq8e7ya9v3ix71k0pZ zookeeper-3.4.10]# cd bin
[root@iZuf6iq8e7ya9v3ix71k0pZ bin]# ll
总用量 36
-rwxr-xr-x 1 www www 232 3月 23 2017 README.txt
-rwxr-xr-x 1 www www 1937 3月 23 2017 zkCleanup.sh
-rwxr-xr-x 1 www www 1056 3月 23 2017 zkCli.cmd
-rwxr-xr-x 1 www www 1534 3月 23 2017 zkCli.sh
-rwxr-xr-x 1 www www 1628 3月 23 2017 zkEnv.cmd
-rwxr-xr-x 1 www www 2696 3月 23 2017 zkEnv.sh
-rwxr-xr-x 1 www www 1089 3月 23 2017 zkServer.cmd
-rwxr-xr-x 1 www www 6773 3月 23 2017 zkServer.sh
[root@iZuf6iq8e7ya9v3ix71k0pZ bin]# cd ..
[root@iZuf6iq8e7ya9v3ix71k0pZ zookeeper-3.4.10]# mkdir data
[root@iZuf6iq8e7ya9v3ix71k0pZ zookeeper-3.4.10]#

## 记录 data 路径
[root@iZuf6iq8e7ya9v3ix71k0pZ zookeeper-3.4.10]# cd data
[root@iZuf6iq8e7ya9v3ix71k0pZ data]# pwd
/usr/local/zookeeper/zookeeper-3.4.10/data
[root@iZuf6iq8e7ya9v3ix71k0pZ data]# cd ../conf
[root@iZuf6iq8e7ya9v3ix71k0pZ conf]# ll
总用量 12
-rw-rw-r-- 1 www www 535 3月 23 2017 configuration.xsl
-rw-rw-r-- 1 www www 2161 3月 23 2017 log4j.properties
-rw-rw-r-- 1 www www 922 3月 23 2017 zoo_sample.cfg
[root@iZuf6iq8e7ya9v3ix71k0pZ conf]# mv zoo_sample.cfg zoo.cfg
[root@iZuf6iq8e7ya9v3ix71k0pZ conf]# vim zoo.cfg
dataDir=/tmp/zookeeper
改成
dataDir=/usr/local/zookeeper/zookeeper-3.4.10/data

## 服务相关命令
[root@iZuf6iq8e7ya9v3ix71k0pZ bin]# ./zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper/zookeeper-3.4.10/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@iZuf6iq8e7ya9v3ix71k0pZ bin]# ./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper/zookeeper-3.4.10/bin/../conf/zoo.cfg
Mode: standalone
[root@iZuf6iq8e7ya9v3ix71k0pZ bin]# ./zkServer.sh stop
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper/zookeeper-3.4.10/bin/../conf/zoo.cfg
Stopping zookeeper ... STOPPED
[root@iZuf6iq8e7ya9v3ix71k0pZ bin]#

dubbo-admin 管理平台的结合

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# 推收文件
➜ ~ sftp root@106.15.191.27
Connected to 106.15.191.27.
sftp> put /Users/niuhesm/resouces/major/remoteServer/apache-tomcat-8.5.28.tar.gz /usr/local/tomcat
Uploading /Users/niuhesm/resouces/major/remoteServer/apache-tomcat-8.5.28.tar.gz to /usr/local/tomcat/apache-tomcat-8.5.28.tar.gz
/Users/niuhesm/resouces/major/remoteServer/apache 100% 9321KB 1.5MB/s 00:06


# 解压配置tomcat
[root@iZuf6iq8e7ya9v3ix71k0pZ tomcat]# ll
总用量 9324
-rw-r--r-- 1 root root 9544774 4月 4 21:21 apache-tomcat-8.5.28.tar.gz
[root@iZuf6iq8e7ya9v3ix71k0pZ tomcat]# tar zxf apache-tomcat-8.5.28.tar.gz
[root@iZuf6iq8e7ya9v3ix71k0pZ tomcat]# ll
总用量 9328
drwxr-xr-x 9 root root 4096 4月 4 21:22 apache-tomcat-8.5.28
-rw-r--r-- 1 root root 9544774 4月 4 21:21 apache-tomcat-8.5.28.tar.gz
[root@iZuf6iq8e7ya9v3ix71k0pZ tomcat]# ll
总用量 9328
drwxr-xr-x 9 root root 4096 4月 4 21:22 apache-tomcat-8.5.28
-rw-r--r-- 1 root root 9544774 4月 4 21:21 apache-tomcat-8.5.28.tar.gz
[root@iZuf6iq8e7ya9v3ix71k0pZ tomcat]# rm -rf apache-tomcat-8.5.28.tar.gz
[root@iZuf6iq8e7ya9v3ix71k0pZ tomcat]# cp -r apache-tomcat-8.5.28/ /usr/local/tomcat/tomcat-8081
[root@iZuf6iq8e7ya9v3ix71k0pZ tomcat]# ll
总用量 8
drwxr-xr-x 9 root root 4096 4月 4 21:22 apache-tomcat-8.5.28
drwxr-xr-x 9 root root 4096 4月 4 21:24 tomcat-8081
[root@iZuf6iq8e7ya9v3ix71k0pZ tomcat]# vim tomcat-8081/conf/server.xml
...

# 接受dubbo-admi管理工程
sftp> put /Users/niuhesm/resouces/major/remoteServer/dubbo-admin-2.6.0.war /usr/local/tomcat/tomcat-8081/webapps
Uploading /Users/niuhesm/resouces/major/remoteServer/dubbo-admin-2.6.0.war to /usr/local/tomcat/tomcat-8081/webapps/dubbo-admin-2.6.0.war
/Users/niuhesm/resouces/major/remoteServer/dubbo- 100% 31MB 1.3MB/s 00:24
sftp>


# 配置
[root@iZuf6iq8e7ya9v3ix71k0pZ webapps]# ll
总用量 31416
drwxr-x--- 14 root root 4096 4月 4 21:24 docs
drwxr-x--- 8 root root 4096 4月 4 21:30 dubbo-admin-2.6.0
-rw-r--r-- 1 root root 32089280 4月 4 21:28 dubbo-admin-2.6.0.war
-rw-r----- 1 root root 51229 4月 4 21:30 dubbo-governance.log
drwxr-x--- 6 root root 4096 4月 4 21:24 examples
drwxr-x--- 5 root root 4096 4月 4 21:24 host-manager
drwxr-x--- 5 root root 4096 4月 4 21:24 manager
drwxr-x--- 3 root root 4096 4月 4 21:24 ROOT
[root@iZuf6iq8e7ya9v3ix71k0pZ webapps]# mv dubbo-admin-2.6.0.war dubbo-admin.war
[root@iZuf6iq8e7ya9v3ix71k0pZ webapps]# /usr/local/tomcat/tomcat-8081/bin/startup.sh
[root@iZuf6iq8e7ya9v3ix71k0pZ webapps]# ll
总用量 31400
drwxr-x--- 14 root root 4096 4月 4 21:24 docs
drwxr-x--- 8 root root 4096 4月 4 21:33 dubbo-admin
-rw-r--r-- 1 root root 32089280 4月 4 21:28 dubbo-admin.war
-rw-r----- 1 root root 35083 4月 4 21:33 dubbo-governance.log
drwxr-x--- 6 root root 4096 4月 4 21:24 examples
drwxr-x--- 5 root root 4096 4月 4 21:24 host-manager
drwxr-x--- 5 root root 4096 4月 4 21:24 manager
drwxr-x--- 3 root root 4096 4月 4 21:24 ROOT
[root@iZuf6iq8e7ya9v3ix71k0pZ dubbo-admin]# vim WEB-INF/dubbo.properties
dubbo.registry.address=zookeeper://127.0.0.1:2181
dubbo.admin.root.password=root
dubbo.admin.guest.password=guest
~
~