In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Zookeeper installation deployment:
Download address on the official website:
Https://archive.apache.org/dist/zookeeper/zookeeper-3.5.5/apache-zookeeper-3.5.5-bin.tar.gz
Zookeeper supports two modes of operation: stand-alone mode (standalone) and replication mode (replicated)
Zookeeper that is actually used in a production environment must use replication mode, which avoids a single point of problem. Want to use replication mode, but because there is no spare machine to use
So replication mode can be configured on a single machine to simulate a real cluster environment.
Because the Zookeeper cluster generates leader by majority election, the cluster needs to be composed of an odd number of Zookeeper instances, that is, at least 3
Demo environment description:
Ucloud CVM
The system is CentOS6.5 x8634 64-bit
Introduction and installation of zookeeper:
The following link is an introduction:
Https://yq.aliyun.com/articles/638031?spm=a2c4e.11153940.0.0.2d9713d4u8uZMC
Start the installation:
1. The version of zookeeper downloaded is apache-zookeeper-3.5.5-bin.tar.gz.
two。 Prepare the java environment:
Because apache-zookeeper is based on java environment, jdk should be deployed in advance.
The jdk version of this ucloud CVM 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
Add environment variables to the path:
Tail-4 / etc/profileexport JAVA_HOME=/usr/local/jdk1.8.0_172export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATHexport CLASSPATH=.$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar
3. Download the zookeeper package
Https://archive.apache.org/dist/zookeeper/zookeeper-3.5.5/apache-zookeeper-3.5.5-bin.tar.gz
Tip: the binary installation of the zookeeper package has changed since version 3.5. you need to download the binary package with bin and decompress it before you can use it, instead of downloading packages like apache-zookeeper-3.5.5.tar.gz.
4. Decompress 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 zookeeper02cp-rp zookeeper01 zookeeper03
Copy three copies of the directory zookeeper-3.5.5, representing three instances.
Then, create zoo.conf configuration files and place them in the conf/ directory under the corresponding instance. The contents of the files are as follows:
[root@10-13,12512323] # egrep-v'^ # | ^ $'/ usr/local/zookeeper01/conf/zoo.cfgtickTime=2000initLimit=10syncLimit=5dataDir=/data/zkdata/zookeeper01clientPort=32181server.1=127.0.0.1:2878:4880server.2=127.0.0.1:2879:4881server.3=127.0.0.1:2880:4892 [root@10-13,125123123] # egrep-v'^ # | ^ $'/ usr/local/zookeeper02/conf/zoo.cfgtickTime=2000initLimit=10syncLimit=5dataDir=/data/zkdata/zookeeper02clientPort=32182server.1=127.0 .0.1: 2878:4880server.2=127.0.0.1:2879:4881server.3=127.0.0.1:2880:4892 [root@10-13-125123] # egrep-v'^ # | ^ $'/ usr/local/zookeeper03/conf/zoo.cfgtickTime=2000initLimit=10syncLimit=5dataDir=/data/zkdata/zookeeper03clientPort=32183server.1=127.0.0.1:2878:4880server.2=127.0.0.1:2879:4881server.3=127.0.0.1:2880:4892
Here are some points to pay attention to:
DataDir this specifies the storage path of instance data, and different instances should be distinguished. Also, the comments remind you not to set it to the / tmp directory. For example, it can be set to:
# ll / data/zkdata/total 12drwxr-xr-x 3 root root 4096 Dec 3 18:12 zookeeper01drwxr-xr-x 3 root root 4096 Dec 3 18:12 zookeeper02drwxr-xr-x 3 root root 4096 Dec 3 18:12 zookeeper03
ClientPort is the port number for the client to connect to this instance, and different instances should be distinguished. For example, you can specify: 32181, 32182, 32183, respectively.
Server. {X} this X can take a number to identify a unique instance in the cluster. How many server are configured. {X} indicates how many instances are in the cluster.
The format of the back face value is: {host}: {port1}: {port2}, where {host} is the host IP where the instance resides, because it is all on the same machine.
Therefore, they are all specified as local addresses; {port1} is the port used for data communication between instances in the cluster; and {port2} is the communication port used by instances in the cluster for leader election.
For the same instance {port1} and {port2} are not the same. In the case of multiple instances deployed on the same machine, the same port of different instances also needs to be distinguished.
* * configure myid file
The {X} in the server. {X} configuration item mentioned earlier is the myid of an instance, which needs to be written in the {dataDir} / myid file of the corresponding instance.
Next, you need to create a file named myid in the {dateDir} directory specified by each instance, and the content of the file is a number corresponding to the X in server. {X}. **
For example, here is the configuration:
Write 1 in / data/zkdata/zookeeper01/myid file, 2 in / data/zkdata/zookeeper02/myid file, and 3 in / data/zkdata/zookeeper03/myid file. Mkdir / data/zkdata/ {zookeeper01,zookeeper02,zookeeper03}-pecho 1 > / data/zkdata/zookeeper01/myidecho 2 > / data/zkdata/zookeeper02/myidecho 3 > / data/zkdata/zookeeper03/myid
Create scripts to start and stop
For multiple instances, it is troublesome to start and stop respectively. You can write a script to do this automatically.
Content of start-zk-servers.sh: # cat / data/scripts/start-zk-servers.sh echo `/ usr/local/zookeeper01/bin/zkServer.sh start`echo` / usr/local/zookeeper02/bin/zkServer.sh start`ec ho `/ usr/local/zookeeper03/bin/zkServer.sh start` [root@10-13-125123zkdata] # 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, the log file zookeeper.out for Zookeeper is generated under the user directory (~ /). You can see the process and results of the leader election from the log.
Zookeeper installation reference documentation:
Https://www.jianshu.com/p/a79ea43c49bc
Second, install 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.gzhttp://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.49/bin/apache-tomcat-8.5.49.tar.gztar 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,125123] # tail-8 / etc/profileexport JAVA_HOME=/usr/local/jdk1.8.0_172export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATHexport CLASSPATH=.$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jarexport TOMCAT_HOME=/usr/local/tomcat8export PATH=/usr/local/redis/bin: / usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/binsource / etc/profilecd / usr/local/tomcat8/webapps & & rm-fr * upload the dubbo-admin package dubbo-admin-2.5.10.warmv dubbo-admin-2.5.10 ROOT played by the developer
Configure the address dubbo.properties of the dubbo-admin link zookeeper
[root@10-13,125123] # cat / usr/local/tomcat8/webapps/ROOT/WEB-INF/dubbo.properties dubbo.registry.address=zookeeper://127.0.0.1:32181?backup=127.0.0.1:32182127.0.0.1:32183dubbo.admin.root.password=roortdubbo.admin.guest.password=guestse
Restart the Tomcat service
Browser open
Http://106.75.162.9:50876/
Output root / roort
Login is completed.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.