The content of this article is about the configuration of Springboot's zookeeper cluster. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
Jdk1.7, window system (using window10 window7), or linux system (this test uses centos7)
There are two key roles in the zookeeper cluster: leader and follower.
All nodes in the cluster provide services for distributed applications as a whole. Each node in the cluster is connected to each other. Therefore, when configuring the zookeeper cluster, the host of each node The mapping to the IP address must be configured with the mapping information of other nodes in the cluster.
For example, the configuration of each node in my zookeeper cluster, taking master as an example, the content of /etc/hosts is as follows:
192.168.0.253 master (virtual machine linux system)
192.168.0.219 follow-1 (my physical machine window system)
192.168.0.133 follow-2 (Yujie physical machine window system)
window The system closes the firewall or opens the corresponding port. The ports used in this system are 2181, 2888, 3888
Linux system uses systemctl iptables.service stop Stop the firewall (commands vary in different Linux versions)
lIn this test, since the centos7 firewall cannot access the network after it is closed, it is necessary to enable the firewall and configure open ports
Configuration method:
1. Find the iptables file corresponding to the firewall. The path under centos is: /etc/sysconfig/iptables
2. Add
-A INPUT -p tcp -m state--state NEW -m tcp --dport 80 -j ACCEPT (port number)
-A INPUT -p tcp -m state--state NEW -m tcp --dport 2000:4000 -j ACCEPT (port number range)
## This possible problem. Check the following steps
Step 4: Add dubbo configuration
1.Pom file dependency
org.springframework.boot spring-boot-starter-dubbo 1.3.1.RELEASE com.alibaba dubbo
1.Yaml configuration dubbo parameters
-------privoder provider----- --#spring:
dubbo:registry:
address:
192.168.0.129:2181,192.168.0.165:2181,192.168.0.133: 2181 number port:
20882
monitor:protocol:registry
provider:
timeout:120000
threadpool:fixed
threads:100
accepts:
1000
------customer Consumer----- --
#spring:
dubbo:
application:name:atme-crm-service
registry:address:192.168.0.129:2181,192.168.0.165:2181,192.168.0.253:2181
protocol:zookeeper
protocol :name:dubbo
prot:20886
threads:
1000
heartbeat:100000
host:192.168.0.165
monitor:
protocol:registry
##2.
Start project introduction dubbo configuration
@ImportResource({"classpath:config/dubbo.xml"
})
Finally: the pitfalls encountered
1. Whether the /conf/zoo.cfg dataDir and dataDirLog file paths exist. If they do not exist, please create them manually.
2. Check whether the myid file is created under the dataDir path and whether the server is stored in the file. The number of x in File
Related recommendations:
Installing Zookeeper cluster on CentOS 7About the version of Pacemaker cluster configuration_PHP Tutorial
The above is the detailed content of Configuration of Springboot's zookeeper cluster. For more information, please follow other related articles on the PHP Chinese website!