zookeeper+dubbo-admin

zookeeper installation and deployment:

Download the official website:

https://archive.apache.org/dist/zookeeper/zookeeper-3.5.5/apache-zookeeper-3.5.5-bin.tar.gz

zookeeper supports two operating modes: standalone mode (standalone) and copy mode (replicated)
real production environment for Zookeeper are certainly using the copy mode, single-point done to avoid the problem. Copy mode you want to use, but because there is no surplus machines can be used,
it is possible to use the copy mode configured on a single machine to simulate the real cluster environment.
As the leader of Zookeeper clusters are produced by means of majority vote, therefore, we need an odd number of clusters Zookeeper instances, that requires at least three

Demo environment Description:

ucloud cloud host,
the system is CentOS6.5 x86_64-bit

A, zookeeper, and installation:

The following link is to introduce:
https://yq.aliyun.com/articles/638031?spm=a2c4e.11153940.0.0.2d9713d4u8uZMC

Start the installation:
1. ZooKeeper downloaded version is apache-zookeeper-3.5.5-bin.tar.gz

2. Prepare java environment:
Because apache-zookeeper is a java-based environment, so to advance the deployment of jdk
jdk version of the ucloud cloud hosting deployment is jdk-8u172-linux-x64.tar.gz

tar xf jdk-8u172-linux-x64.tar.gz -C /usr/local/
ln -sv /usr/local/jdk1.8.0_172/bin/java /sbin/java

Join the path environment variable:


tail -4 /etc/profile
export JAVA_HOME=/usr/local/jdk1.8.0_172
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
export CLASSPATH=.$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar

3. Download the package zookeeper

https://archive.apache.org/dist/zookeeper/zookeeper-3.5.5/apache-zookeeper-3.5.5-bin.tar.gz

Tip: zookeeper package began to change from the beginning of the binary version 3.5 installed, you need to download binary packages with bin, after decompression can be used, instead of downloading apache-zookeeper-3.5.5.tar.gz such a package

4. decompression apache-zookeeper-3.5.5-bin.tar.gz

tar xf /root/apache-zookeeper-3.5.5-bin.tar.gz -C /usr/local/
cd /usr/local/
mv apache-zookeeper-3.5.5-bin zookeeper01  
cp  -rp zookeeper01  zookeeper02
cp -rp zookeeper01    zookeeper03

The zookeeper-3.5.5 directory copy in triplicate, representing three instances.

Then, create separate zoo.conf profile, placed in the conf / directory under corresponding instances of the file as follows:

[root@10-13-125-123 ~]# egrep -v '^#|^$' /usr/local/zookeeper01/conf/zoo.cfg
tickTime=2000
initLimit=10
syncLimit=5
dataDir=/data/zkdata/zookeeper01
clientPort=32181
server.1=127.0.0.1:2878:4880
server.2=127.0.0.1:2879:4881
server.3=127.0.0.1:2880:4892
[root@10-13-125-123 ~]# egrep -v '^#|^$' /usr/local/zookeeper02/conf/zoo.cfg
tickTime=2000
initLimit=10
syncLimit=5
dataDir=/data/zkdata/zookeeper02
clientPort=32182
server.1=127.0.0.1:2878:4880
server.2=127.0.0.1:2879:4881
server.3=127.0.0.1:2880:4892
[root@10-13-125-123 ~]# egrep -v '^#|^$' /usr/local/zookeeper03/conf/zoo.cfg
tickTime=2000
initLimit=10
syncLimit=5
dataDir=/data/zkdata/zookeeper03
clientPort=32183
server.1=127.0.0.1:2878:4880
server.2=127.0.0.1:2879:4881
server.3=127.0.0.1:2880:4892

The following describes the following points should be noted:

This is designated dataDir instance data storage path, the instance to separate different areas. Also, a reminder not to comment to the / tmp directory. For example, can be set separately:

[root@10-13-125-123 ~]# ll /data/zkdata/
total 12
drwxr-xr-x 3 root root 4096 Dec  3 18:12 zookeeper01
drwxr-xr-x 3 root root 4096 Dec  3 18:12 zookeeper02
drwxr-xr-x 3 root root 4096 Dec  3 18:12 zookeeper03

clientPort This is the port number for client connections the present example, but also to distinguish different instances. For example, you can specify as follows: 32181,32182,32183.

server. {X} X can take this number is used to uniquely identify an instance of the cluster. Configuring the number of server. {X} indicates how many instances will have a cluster.
After the face value of the form: {host}: {port1} : {port2} wherein, {host} instances where IP is the host, since there are on one machine,
it will specify the host address; {port1} is ports for data communication between the cluster instance; {port2} is a communication port used for instance in the cluster leader election.
For the same example {port1} and {port2} are not the same. In the case of the same machine to deploy multiple instances, different instances of the same port also need to distinguish.

** myid configuration files
mentioned earlier Server. CI {X} {X} is the myid one example, it needs to be written in the {dataDir} / myid file corresponding instance.

Needs to be specified below in each instance {dateDir} Create a directory named myid file, the content file is a number corresponding to the server. {X} of X. **

For example, here is this configuration:

在/data/zkdata/zookeeper01/myid文件中写入1;
在/data/zkdata/zookeeper02/myid文件中写入2;
在/data/zkdata/zookeeper03/myid文件中写入3。
mkdir /data/zkdata/{zookeeper01,zookeeper02,zookeeper03}  -p
echo 1 >/data/zkdata/zookeeper01/myid
echo 2 >/data/zkdata/zookeeper02/myid
echo 3 >/data/zkdata/zookeeper03/myid

Create a script to start and stop
for multiple instances, respectively, start and stop too much trouble, you can write a script to automate this job

start-zk-servers.sh的内容:
[root@10-13-125-123 zkdata]# cat /data/scripts/start-zk-servers.sh 
echo `/usr/local/zookeeper01/bin/zkServer.sh start`
echo `/usr/local/zookeeper02/bin/zkServer.sh start`
echo `/usr/local/zookeeper03/bin/zkServer.sh start`
[root@10-13-125-123 zkdata]# cat /data/scripts/stop-zk-servers.sh 
echo `/usr/local/zookeeper01/bin/zkServer.sh stop`
echo `/usr/local/zookeeper02/bin/zkServer.sh stop`
echo `/usr/local/zookeeper03/bin/zkServer.sh stop`

By default, a user directory (~ /) following log files generated Zookeeper zookeeper.out. As can be seen in the election process leader and the results from the log.

zookeeper installation reference documentation:
https://www.jianshu.com/p/a79ea43c49bc

Second, the installation Tomcat8

apache-tomcat-8.5.31.tar.gz 
http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.49/bin/apache-tomcat-8.5.31.tar.gz
http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.49/bin/apache-tomcat-8.5.49.tar.gz

tar xf apache-tomcat-8.5.31.tar.gz -C /usr/local/
ln -sv /usr/local/apache-tomcat-8.5.31  /usr/local/tomcat8

[root@10-13-125-123 ~]# tail -8  /etc/profile
export JAVA_HOME=/usr/local/jdk1.8.0_172
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
export CLASSPATH=.$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar
export TOMCAT_HOME=/usr/local/tomcat8
export PATH=/usr/local/redis/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

source /etc/profile
cd /usr/local/tomcat8/webapps &&rm -fr *
上传开发打的dubbo-admin包
dubbo-admin-2.5.10.war
mv  dubbo-admin-2.5.10  ROOT

Configuring address dubbo.properties dubbo-admin links to the zookeeper

[root@10-13-125-123 ~]# cat /usr/local/tomcat8/webapps/ROOT/WEB-INF/dubbo.properties 
dubbo.registry.address=zookeeper://127.0.0.1:32181?backup=127.0.0.1:32182,127.0.0.1:32183
dubbo.admin.root.password=roort
dubbo.admin.guest.password=guestse

Restart Tomcat service
browser to open
http://106.75.162.9:50876/
output root / roort

Log on to complete

Guess you like

Origin blog.51cto.com/wujianwei/2455836