Registration Center
Optional options: Zookeeper, Redis
1. We recommend using the Zookeeper Registration Center client with dubbo-2.3.3 or above version
2, Zookeeper is Apache Hadoop sub-project, the strength is relatively good, it is recommended that the production environment to use the registration center.
3, Dubbo does not make any intrusion modification to the zookeeper server, just install the native zookeeper server, all the registration center logical adaptation is done when the zookeeper client is called.
Install Dubbo Registration Center (Zookeeper-3.4.6)
1, modify the operating system of the/etc/hosts file to add:
# Zookeeper Servers
192.168.3.71 edu-provider-01
2, to http://apache.fayea.com/zookeeper/download zookeeper-3.4.6:
$ wget http://apache.fayea.com/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gz
3, Decompression zookeeper installation package:
$ TAR-ZXVF zookeeper-3.4.6.tar.gz
4. Create the following directory under the/home/jeesml/zookeeper-3.4.6 directory:
$ cd/home/jeesml/zookeeper-3.4.6
$ mkdir Data
$ mkdir Logs
5, copy the Zoo_sample.cfg file under the zookeeper-3.4.6/conf directory, named as Zoo.cfg
$ CP zoo_sample.cfg Zoo.cfg
6. Modify the Zoo.cfg configuration file:
$ VI zoo.cfg
# The number of milliseconds of each tick
ticktime=2000
# The number of ticks that initial
# Synchronization phase can take
initlimit=10
# The number of ticks that can pass between
# Sending a request and getting an acknowledgement
Synclimit=5
# The directory where the snapshot is stored.
# do not use/tmp for storage,/tmp here are just
# example Sakes.
Datadir=/home/jeesml/zookeeper-3.4.6/data
Datalogdir=/home/jeesml/zookeeper-3.4.6/logs
# The port at which the clients would connect
clientport=2181
#2888, 3888 is election port
server.1=edu-provider-01:2888:3888
which
The 2888 port number is the port of communication between the zookeeper services.
3888 is the port that zookeeper communicates with other applications.
EDU-PROVIDER-01 is the host name of the IP that was mapped in the hosts.
Initlimit: This configuration item is used to configure the Zookeeper accept client (the client here is not the client connecting the Zookeeper server, but the Zookeeper server cluster is connected to the
Leader Follower Server) The maximum number of heartbeat intervals that can be tolerated when a connection is initialized. The client connection failed when the Zookeeper server has not received the return information of the client after 10 heartbeats (that is, ticktime) length. The total length of time is 5*2000=10 seconds.
Synclimit: This configuration item identifies the length of time that a message, request and response is sent between Leader and Follower, the maximum number of ticktime, and the total length of time is 2*2000=4 seconds.
Server. A=b:c:d: Where A is a number, indicating this is the name of the server, B is the IP address of the server or the/etc/hosts file mapped the IP hostname, C is the server and the Leader server in the cluster to exchange information on the port; D indicates that in the event of a cluster The Leader server hangs up and requires a port to re-elect a new Leader, which is the port that the server communicates with each other when the election is performed. If it is a pseudo-cluster configuration, because B is the same, so different Zookeeper instance communication port number can not be the same, so they should be assigned a different port number
7. Create the myID file under Datadir=/home/jeesml/zookeeper-3.4.6/data
Edit the myID file and enter the corresponding number on the corresponding IP machine. As on zookeeper, the contents of the myID file are 1. If the installation is configured only on a single point, then there is only one server.1.
$ VI myID
1
8, JEESML users to modify the Vi/home/jeesml/.bash_profile, increase the zookeeper configuration:
# Zookeeper Env
Export zookeeper_home=/home/jeesml/zookeeper-3.4.6
Export path= $ZOOKEEPER _home/bin: $PATH
Make the configuration file effective $ source/home/jeesml/.bash_profile
9, open the firewall to use the port 2181, 2888, 3888 switch to root user rights, execute the following command:
# chkconfig Iptables on
# service Iptables Start
Edit/etc/sysconfig/iptables
# Vi/etc/sysconfig/iptables
Add the following 3 lines:
-A input-m state--state new-m tcp-p TCP--dport 2181-j ACCEPT
-A input-m state--state new-m tcp-p TCP--dport 2888-j ACCEPT
-A input-m state--state new-m tcp-p TCP--dport 3888-j ACCEPT
Restart Firewall: # service iptables restart
To view the firewall port status:
# Service Iptables Status
Table:filter
Chain INPUT (Policy ACCEPT)
Num Target prot opt source destination
1 ACCEPT All – 0.0.0.0/0 0.0.0.0/0 State related,established
2 ACCEPT ICMP--0.0.0.0/0 0.0.0.0/0
3 ACCEPT All--0.0.0.0/0 0.0.0.0/0
4 ACCEPT TCP--0.0.0.0/0 0.0.0.0/0 state NEW TCP dpt:22
5 ACCEPT TCP--0.0.0.0/0 0.0.0.0/0 state NEW TCP dpt:2181
6 ACCEPT TCP--0.0.0.0/0 0.0.0.0/0 state NEW TCP dpt:2888
7 ACCEPT TCP--0.0.0.0/0 0.0.0.0/0 state NEW TCP dpt:3888
8 REJECT All--0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain FORWARD (Policy ACCEPT)
Num Target prot opt source destination
1 REJECT All--0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain OUTPUT (Policy ACCEPT)
Num Target prot opt source destination
10, start and test zookeeper (to use JEESML user start, do not use root):
(1) Use the JEESML user to the/home/jeesml/zookeeper-3.4.6/bin directory to execute:
$ zkserver.sh Start
(2) Enter the JPS command to view the process:
$ JPS
1456 Quorumpeermain
1475 Jps
Wherein, Quorumpeermain is the zookeeper process, starts the normal
(3) View status:
$ zkserver.sh Status
(4) View Zookeeper service output information:
Because the service information output file is in/home/jeesml/zookeeper-3.4.6/bin/zookeeper.out
$ tail-500f Zookeeper.out
11. Stop the Zookeeper process:
$ zkserver.sh Stop
12. Configure zookeeper Boot using JEESML User:
Edit/etc/rc.local file, add:
Su-jeesml-c '/home/jeesml/zookeeper-3.4.6/bin/zkserver.sh start '
Please continue to follow me on the installation of Dubbo-dubbo Management Console (2)
Because the first time to write about Dubbo blog, but also want you to join Dubbo Learning Exchange Group (446855438), study together.
Learn from me Dubbo-zookeeper Registration Center installation (2)